delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/14/11:53:26

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52EFrPLU1495774
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 52EFrPLU1495774
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=Ku1Sl8h0
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D46833858C48
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1741967604;
bh=r2Nmt4GcYKVsd3ycsGG9S8foGyymom4BVpFPRFrhzx4=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=Ku1Sl8h0kTHJa8tBikuihCccHav3wApYBrvOhDK31gvZj0CSjoBayFxzKlo8z0FJ9
e50pz8WgDKS0LwigQicK6ZbV0GHTyw7icwnH/jmX5hdV+3hqqsbo2j8iFGkLF9xq0d
2029M1lCSEvWRAabpcmRG7Q5EWV8ZMqWWJqX/k6E=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACE973857835
Date: Fri, 14 Mar 2025 16:50:34 +0100
To: cygwin AT cygwin DOT com
Subject: Re: cygwin-devel vs libbsd-devel: arc4random_stir() macro in
stdlib.h breaks bsd/stdlib.h
Message-ID: <Z9RQSkDre9ogyyMy@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <8a442ec3-23e8-c09c-f9be-5a9fe7e6d801 AT t-online DOT de>
<Z9MTi-gbmLjzf88N AT calimero DOT vinschen DOT de>
<bb591e41-6303-cee6-920a-ab8b4f5a2733 AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <bb591e41-6303-cee6-920a-ab8b4f5a2733@t-online.de>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 52EFrPLU1495774

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

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019