cygwin-devel vs libbsd-devel: arc4random_stir() macro in stdlib.h breaks bsd/stdlib.h
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Mar 14 15:50:34 GMT 2025
On Mar 14 13:48, Christian Franke via Cygwin wrote:
> Corinna Vinschen via Cygwin wrote:
> > On Mar 13 08:59, Christian Franke via Cygwin wrote:
> > > Problem introduced in a8891c93:
> > >
> > > $ cygcheck -f /usr/include/stdlib.h
> > > cygwin-devel-3.6.0-0.430.ga942476236b5
> > >
> > > $ cygcheck -f /usr/include/bsd/stdlib.h
> > > libbsd-devel-0.12.2-2
> > >
> > > $ gcc -c -xc - <<<'#include <bsd/stdlib.h>'
> > > In file included from <stdin>:1:
> > > /usr/include/bsd/stdlib.h:62:26: error: macro "arc4random_stir" passed 1
> > > arguments, but takes just 0
> > > 62 | void arc4random_stir(void);
> > > | ^
> > > In file included from /usr/include/stdlib.h:26,
> > > from /usr/include/bsd/stdlib.h:32:
> > > /usr/include/cygwin/stdlib.h:26: note: macro "arc4random_stir" defined here
> > > 26 | #define arc4random_stir()
> > Should work again with cygwin-3.6.0-0.431.gad29c33229e5
> >
>
> This fixes the problem, thanks.
>
> There are possibly still inconsistencies:
>
> $ gcc -E -xc - <<<'#include <stdlib.h>' | grep arc4random_stir
> void arc4random_stir(void);
>
> $ gcc -E -xc - <<<'#include <bsd/stdlib.h>' | grep arc4random_stir
> void arc4random_stir(void); // from cygwin/stdlib.h
> void arc4random_stir(void); // from bsd/stdlib.h
Yes, that's ok. We could drop the declarations in bsd/stdlib.h,
but they are equivalent, so they don't hurt.
> $ gcc -E -xc - <<<'#include <stdlib.h>' | grep arc4random_addrandom
>
> $ gcc -E -xc - <<<'#include <bsd/stdlib.h>' | grep arc4random_addrandom
> void arc4random_addrandom(unsigned char *dat, int datlen);
Yes, that's deliberate. arc4random_addrandom() shouldn't be used.
Well, arc4random_stir() shouldn't be used either, but there's the
autoconf problem with OpenSSH.
> $ gcc -E -xc - <<<'#include <bsd/stdlib.h>' | grep arc4random_buf
> void arc4random_buf (void *, size_t); // from stdlib.h
> void arc4random_buf(void *_buf, size_t n); // from bsd/stdlib.h
Equivalent, no worries.
> $ nm /usr/lib/libcygwin.a | grep ' arc4random'
> 0000000000000000 T arc4random
> 0000000000000000 T arc4random_addrandom
> 0000000000000000 T arc4random_buf
> 0000000000000000 T arc4random_stir
> 0000000000000000 T arc4random_uniform
>
> $ nm /usr/lib/libbsd.dll.a | grep ' arc4random' || echo not found
> not found
>
> I guess:
> - arc4random_addrandom() should be removed from libcygwin.a or added to
> cygwin/stdlib.h.
No, we can't do that (OpenSSH)
> - all arc4random*() should be hidden for __CYGWIN__ in bsd/stdlib.h.
This, we can do. Let me check.
Corinna
More information about the Cygwin
mailing list