Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Sep 2016 23:30:33 +0800
From:      Ben Woods <woodsb02@gmail.com>
To:        ed@freebsd.org, ruby@freebsd.org, Adam Weinberger <adamw@adamw.org>
Subject:   r303920: Add crypt_r(3)
Message-ID:  <CAOc73CCfyQrW24VtQ0=mOZKbjNOdMfPybTDOgFG6s_-qDgGL3A@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi Ed,

The recent addition of crypt_r(3) to FreeBSD 12 has broken the build of
port security/rubygem-bcrypt.

> current directory: /wrkdirs/usr/ports/security/rubygem-bcrypt/work/stage/usr/local/lib/ruby/gems/2.2/gems/bcrypt-3.1.11/ext/mri
> make "DESTDIR="
> compiling crypt_gensalt.c
> compiling crypt.c
> In file included from crypt.c:2:
> ./ow-crypt.h:19:14: error: conflicting types for 'crypt_r'
> extern char *crypt_r(__CONST char *key, __CONST char *setting, void *data);
>              ^
> /usr/include/unistd.h:499:7: note: previous declaration is here
> char    *crypt_r(const char *, const char *, struct crypt_data *);
>          ^
> 1 error generated.
> *** Error code 1
>
>
I tried patching the file in the port, with the following:

> --- ext/mri/ow-crypt.h.orig     2016-09-06 14:48:21 UTC
> +++ ext/mri/ow-crypt.h
> @@ -6,6 +6,8 @@
>  #ifndef _OW_CRYPT_H
>  #define _OW_CRYPT_H
>
> +#include <sys/param.h>
> +
>  #undef __CONST
>  #if defined __GNUC__
>  #define __CONST __const
> @@ -16,8 +18,10 @@
>
>  #ifndef __SKIP_GNU
>  extern char *crypt(__CONST char *key, __CONST char *setting);
> +#if __FreeBSD_version < 1200002
>  extern char *crypt_r(__CONST char *key, __CONST char *setting, void
> *data);
>  #endif
> +#endif
>
>  #ifndef __SKIP_OW
>  extern char *crypt_rn(__CONST char *key, __CONST char *setting,
>


But then the build fails in wrapper.c instead:

> wrapper.c:188:7: error: conflicting types for 'crypt_r'
> char *crypt_r(__CONST char *key, __CONST char *setting, void *data)
>       ^
> /usr/include/unistd.h:499:7: note: previous declaration is here
> char    *crypt_r(const char *, const char *, struct crypt_data *);
>          ^
> 1 error generated.
> *** Error code 1
>

This file only defines crypt_r if the following is not true:

> #if defined(__GLIBC__) && defined(_LIBC)
>

Any ideas on the right way to fix this?

Thanks in advance,
Ben

--
From: Benjamin Woods
woodsb02@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOc73CCfyQrW24VtQ0=mOZKbjNOdMfPybTDOgFG6s_-qDgGL3A>