delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 5D295385772D |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1681903472; | |
bh=N+qFNFYLZ+YKNlzJYzTAHjsTYJ6EEDEqC7JT2PoOBPM=; | |
h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
From; | |
b=utb45gporGXzlkX0DxG/jbvKqx/m5kIqsXfVr4pQRbTiGubepYiqNphRp8jJ0NhGJ | |
aLHF0g33cnKh3Xc5ubVF7kzsBXnfO1tJvSh0jCQUXAdyq3YadG7VAykJhfF24cpeDy | |
gmCPFXrm9gKzGmEkLvON2g9YCtBdpcdBWmhLZzTE= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 5DA463857835 |
ARC-Seal: | i=1; a=rsa-sha256; t=1681903448; cv=none; |
d=strato.com; s=strato-dkim-0002; | |
b=ftvPfu5hKTPvN8WeamUu8XgD3aOhEAtLovrHuJG1SMyakhYsz7GGGnuge47J8Mu5xB | |
EtHPe/aRfCaaNbygLbdmQyRrsaWbTeuZi+S+IGi0GQC7HNDZ/3O4nGlh0urTNXsbZqYS | |
hMP5cNaWGQcENXJ824VJRTpQ0i8zez8lx15oFjOyl2Nbjt/feZu2JH64qQM8G54Xs1vJ | |
0lxcjg3PgEF42aQ6MrhdXf+++4uaMEjwdUCcj5l+j7u4jo1ckAGhAyKm5UMCbpvvWsFg | |
OGWtoGsTu8HRTjZsCMNVDOwr/PaOKoO65S3KbCfY1jqauDkntJSXiI2r+eV5AYbF8nZA | |
lG7g== | |
ARC-Message-Signature: | i=1; a=rsa-sha256; c=relaxed/relaxed; t=1681903448; |
s=strato-dkim-0002; d=strato.com; | |
h=References:In-Reply-To:Message-ID:Date:Subject:To:From:Cc:Date:From: | |
Subject:Sender; | |
bh=eOx21xrZetPpZwhvuqVSRDx5DBbxBgmZ/gtRSQHmih8=; | |
b=q9ikLwYP4/M6rKOcryKo12OOHceURN8ZJ/dZc+4/I7OrU6oMBxlaeTENJeh/MM54wF | |
xw6lYw3qfixnamI3ENCvGuq6f7ILWxptjdtO7l+NrAJDKME2td11NhJgZCoP3o8tlx6Y | |
s5yKApBdXRvjWCFBcOupi/L6n2QNN1qGefYhDduVLql8oHSzr7BRpwS2cHyhZv86M0fS | |
JyAH+1smfgDTcuiNbkujvgcmygaK8PFvs5L3bsJt39OhvvfJ8t8mnq28uMs6N4z6SGsg | |
ao3QmjQdg3tnlBvJV9pe1sRLjQhUjBrdZe/pzn5PUNZTIkGjQCJQrlRyC2JTDnBEug1O | |
eezw== | |
ARC-Authentication-Results: | i=1; strato.com; |
arc=none; | |
dkim=none | |
X-RZG-CLASS-ID: | mo00 |
X-RZG-AUTH: | ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpORjfFRfQFpq5Wynr6BO17R4trpiA==" |
To: | cygwin AT cygwin DOT com |
Subject: | Re: posix_spawn_file_actions_add[f]chdir_np |
Date: | Wed, 19 Apr 2023 13:24:07 +0200 |
Message-ID: | <1962645.3CdzvNlvnA@nimes> |
In-Reply-To: | <ZD+lJeaXDZ8V4WWk@calimero.vinschen.de> |
References: | <1752276 DOT 7aRn1RRit1 AT nimes> <5022555 DOT upeRZZJTqa AT nimes> |
<ZD+lJeaXDZ8V4WWk AT calimero DOT vinschen DOT de> | |
MIME-Version: | 1.0 |
X-Spam-Status: | No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, | |
SPF_HELO_PASS, SPF_NONE, TXREP, | |
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 | |
X-Spam-Checker-Version: | SpamAssassin 3.4.6 (2021-04-09) on |
server2.sourceware.org | |
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: | Bruno Haible via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Bruno Haible <bruno AT clisp DOT org> |
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 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); > 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.) It's easier for me to provide you a test case, with the unit tests from Gnulib. I ran the command ./gnulib-tool --create-testdir --dir=../testdir-posix-spawn --single-configure \ posix_spawn \ posix_spawnattr_destroy \ posix_spawnattr_getflags \ posix_spawnattr_getpgroup \ posix_spawnattr_getschedparam \ posix_spawnattr_getschedpolicy \ posix_spawnattr_getsigdefault \ posix_spawnattr_getsigmask \ posix_spawnattr_init \ posix_spawnattr_setflags \ posix_spawnattr_setpgroup \ posix_spawnattr_setschedparam \ posix_spawnattr_setschedpolicy \ posix_spawnattr_setsigdefault \ posix_spawnattr_setsigmask \ posix_spawn_file_actions_addclose \ posix_spawn_file_actions_adddup2 \ posix_spawn_file_actions_addopen \ posix_spawn_file_actions_addchdir \ posix_spawn_file_actions_addfchdir \ posix_spawn_file_actions_destroy \ posix_spawn_file_actions_init \ posix_spawnp 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. Bruno ================ Test program for EBADF check ================ #include <spawn.h> int main (void) { posix_spawn_file_actions_t actions; if (posix_spawn_file_actions_init (&actions) != 0) return 1; if (posix_spawn_file_actions_addfchdir_np (&actions, -3) != 0) return 2; else return 3; } -- 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 |