delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 16B203857342 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1681916760; | |
bh=OGqB8Prx6uTLzNyM5izES6CuA5h/4RCV+0NiQo/vtxo=; | |
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=BcGw3ygLP/7Lx9fq7M/1b1N2fKVJItgXfEN9obZYSxSDqu+IhSq/AgARsnwwzbQpK | |
YUlCG00hrpmIMuEkr8o3NNTjR/UzfiBCD5a+JvivUcs0rozr6aW5K7IqKLbB9JKsm0 | |
3mJJf8JeTgrOQPxx2iwsO/0ZebiNNQLtXQ1P/Voo= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 381733858D37 |
Date: | Wed, 19 Apr 2023 17:05:20 +0200 |
To: | Bruno Haible <bruno AT clisp DOT org> |
Subject: | Re: posix_spawn_file_actions_add[f]chdir_np |
Message-ID: | <ZEADMM0Ri7NlU/Di@calimero.vinschen.de> |
Mail-Followup-To: | Bruno Haible <bruno AT clisp DOT org>, cygwin AT cygwin DOT com |
References: | <1752276 DOT 7aRn1RRit1 AT nimes> <5022555 DOT upeRZZJTqa AT nimes> |
<ZD+lJeaXDZ8V4WWk AT calimero DOT vinschen DOT de> <1962645 DOT 3CdzvNlvnA AT nimes> | |
MIME-Version: | 1.0 |
In-Reply-To: | <1962645.3CdzvNlvnA@nimes> |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.29 |
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>, 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> |
Hi Bruno, On Apr 19 13:24, Bruno Haible via Cygwin wrote: > Hi Corinna, > > > Actually I had some spare time yesterday so I came up with an > > implementation of posix_spawn_file_actions_addchdir_np and > > posix_spawn_file_actions_addfchdir_np. It's pretty straightforward: > > > > https://cygwin.com/cgit/newlib-cygwin/commit/?id=7e03fc35f528 > > Yes, it's pretty straightforward on Unix-like platforms. > > Note that there is a small inconsistency between implementations: > The manual page > https://man.freebsd.org/cgi/man.cgi?query=posix_spawn_file_actions_addfchdir_np&apropos=0&sektion=3&manpath=FreeBSD+13.2-RELEASE+and+Ports&arch=default&format=html > mentions that when the dirfd argument is negative, the > posix_spawn_file_actions_addfchdir function should fail with error EBADF. > musl libc, FreeBSD, macOS do this; glibc doesn't. Test program attached below. > Confirmed by looking at the source code: > - musl libc: > if (fd < 0) return EBADF; > - FreeBSD: > if (fildes < 0) > return (EBADF); Ok, good to know. I implemented it like glibc, so fd isn't tested in posix_spawn_file_actions_addfchdir_np, but Austin group issue 1208 at https://www.austingroupbugs.net/view.php?id=1208 documents it like it's implemented in musl and FreeBSD: ERRORS The posix_spawn_file_actions_addfchdir( ) function shall fail if: [EBADF] The value specified by fildes is negative. [...] I will fix this in Cygwin. > > You can install the just building test release > > cygwin-3.5.0-0.287.g53f7fb20a064 via our installer, if you'd > > like to test it. > > > > Actually... do you have a testcase readily available to share with us? > > Indeed, I'm not likely to install test releases. (Due to the way I work > with my Windows VM, it's a bit clumsy to create a snapshot.) I don't quite understand the snapshot thingy. Can't you just run setup in your Windows VM? > It's easier > for me to provide you a test case, with the unit tests from Gnulib. > [...] > You can download the resulting tarball from > https://haible.de/bruno/gnu/testdir-posix-spawn.tar.gz . > > When configuring it, set the environment variable > gl_cv_func_posix_spawnp_secure_exec=yes . This will prevent the > autoconfiguration from attempting to override the entire posix_spawn facility: > $ env gl_cv_func_posix_spawnp_secure_exec=yes ./configure > Verify through > $ grep REPLACE_POSIX_SPAWN config.status > that the values of REPLACE_POSIX_SPAWN and REPLACE_POSIX_SPAWNP are 0; > if they are 1, the output of 'configure' should reveal why. > > Then build it: > $ make > Verify through > $ ls -l gllib/*.o > that no posix_spawn_*.o object file was built. > > Then run > $ make check > and it will run the unit tests against the Cygwin libc. It's likely > that you will see 1 test failure (test-posix_spawnp-script); but > other than that, there ought to be no test failures. Indeed, thanks a lot! I checked all the above and ran the testsuite. All tests pass except the test-posix_spawnp-script.exe testcase. Great! Thanks again, 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |