DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 51JDQvxw3957432 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 51JDQvxw3957432 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=GENqEF7E X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 949FB3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1739971616; bh=+TCOczL3dAIyQUJOcyc0uTLbQuYmMlDxJ0jc35h7BjE=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=GENqEF7E7OiDWEdkh/X2Ho52PUfeWKkq/FCjCs8CS+XwUnUDICfCRI9RurfP72uzz 2TV0rE7fDt7I2tbalQy/V9BvxyVMNkXHLdap15BqJBR1KNCSqO21/ZeAYmhSv+jBVj 700AyQijwjqU6QnbTUVPI/M2IGd/xibQooFWSKLY= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8BFCB3858C42 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8BFCB3858C42 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739971537; cv=none; b=T2LmhxNWL3eGMhgtJ+UY1tEnDB/29VV6Rm6nhXqgSMKP68LprScaFfDMZdxFR1a4FeBN05y4P3TR29cYZIeqJlFTrBVJABgAc4fh1Tsy0CeTobDdCzKP1Kx3jXF4zKe00gHeEpRmi0EbBr9a1A8D+m9owHhttQiZV1vadY/KXhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739971537; c=relaxed/simple; bh=ZWPWyQXh3KfZ4J/horb/6W5mBUhBoFT6aX56fXg0tlo=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=ogLnKQ3CiGhGBcX1CLnsIWNDLXTTHGoEOgiLsNu+R09S8aL7uWBH3geKwpKaAq3wSd+VzN0yyQ1EvBgzUx9NiTOVlStMcqJPDSAt+6onp9cett4gmIbdDj9XNz01iv9KVU8NVOXSRcCmTQpJaDN+KkT5TY/fapM7AsPIgLyaKrs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BFCB3858C42 Subject: Re: cygwin 3.6.0 vs. libbsd 0.11.7-3: -lbsd breaks setproctitle() To: cygwin AT cygwin DOT com References: <4250e737-217a-2b55-c6df-8567b283da15 AT t-online DOT de> Message-ID: Date: Wed, 19 Feb 2025 14:25:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 SeaMonkey/2.53.20 MIME-Version: 1.0 In-Reply-To: X-TOI-EXPURGATEID: 150726::1739971534-277FC5A1-3860E459/0/0 CLEAN NORMAL X-TOI-MSGID: f2f8fe4f-e13f-4532-9f50-a937f6d80289 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Christian Franke via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Christian Franke Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 51JDQvxw3957432 Hi Corinna, Corinna Vinschen via Cygwin wrote: > Hi Christian, > > On Feb 19 11:14, Christian Franke via Cygwin wrote: >> Testcase: >> >> $ uname -r >> 3.6.0-0.375.ged18acfe8c76.x86_64 >> >> $ cygcheck -f /usr/include/bsd/unistd.h >> libbsd-devel-0.11.7-3 >> >> $ cat spt.c >> #include >> >> int main(int argc, char **argv, char **envp) >> { >>   initsetproctitle(argc, argv, envp); >>   setproctitle("argc = %d", argc); >>   sleep(2); >>   return 0; >> } >> >> $ gcc -o spt-bsdovl -isystem /usr/include/bsd -DLIBBSD_OVERLAY spt.c -l bsd >> >> $ gcc -o spt-bsd spt.c -l bsd >> >> $ gcc -o spt-nobsd spt.c >> >> $ ./spt-bsdovl >> spt-bsdovl: setproctitle not initialized, please either call >> setproctitle_init() or link against libbsd-ctor. >> >> $ ./spt-bsd >> spt-bsd: setproctitle not initialized, please either call >> setproctitle_init() or link against libbsd-ctor. >> >> $ ./spt-nobsd & procps -o pid,args -p $! >> [1] 2750 >>   PID COMMAND >>  2750 spt-nobsd: argc = 1 > The problem the Cygwin patch was supposed to fix is that the libbsd > version of setproctitle just doesn't work correctly on Cygwin: > > $ uname -r > 3.5.7-1.x86_64 > $ ./spt-bsdovl & procps -o pid,args -p $! > [1] 140 > PID COMMAND > 140 spt-bsdovl: > > The way the include file /usr/include/bsd/unistd.h is designed, > we could make sure the libbsd version is used, by tweaking > /usr/include/sys/unistd.h: > > diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h > index e62e38d10ccf..732356d6a14e 100644 > --- a/newlib/libc/include/sys/unistd.h > +++ b/newlib/libc/include/sys/unistd.h > @@ -212,7 +212,7 @@ int setpgid (pid_t __pid, pid_t __pgid); > #if __SVID_VISIBLE || __XSI_VISIBLE >= 500 > int setpgrp (void); > #endif > -#if defined(__CYGWIN__) && __BSD_VISIBLE > +#if defined(__CYGWIN__) && __BSD_VISIBLE && !defined(LIBBSD_OVERLAY) > /* Stub for Linux libbsd compatibility. */ > #define initsetproctitle(c, a, e) setproctitle_init((c), (a), (e)) > static inline void setproctitle_init (int, char *[], char *[]) {} > > But that still allows to link against a non-working setproctitle. Yes, and it won't work if bsd/unistd.h is included without LIBBSD_OVERLAY which is discouraged but still documented on libbsd(7). > So I think we rather shouldn't supply the libbsd version of > setproctitle_init/setproctitle anymore, as soon as cygwin 3.6.0 is > released. > > What do you think? Makes sense. But then existing programs already using the functions from cygbsd-0.dll would no longer start. Perhaps keep the symbols in the DLL only for some time? -- Regards, Christian -- 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