Re: posix_spawn

2025-04-23 Thread Mark Geisert via Cygwin
Hi Camm, On 4/23/2025 12:46 PM, Camm Maguire via Cygwin wrote: Greetings! Trying to isolate this as you suggest. On first attempt, copying the exact same strings and calls into a main() function succeeds. I am near stumped, and can only guess that the addresses returned by malloc on _init of

Re: posix_spawn

2025-04-23 Thread Camm Maguire via Cygwin
Greetings! Trying to isolate this as you suggest. On first attempt, copying the exact same strings and calls into a main() function succeeds. I am near stumped, and can only guess that the addresses returned by malloc on _init of the file_actions and attr structures is triggering something. Sug

Re: posix_spawn

2025-04-22 Thread Mark Geisert via Cygwin
Hi Camm, On 4/22/2025 12:31 PM, Camm Maguire via Cygwin-apps wrote: Greetings! posix_spawnp is returning 10, or ECHILD, on the following call. At least on my first reading (:-)), ECHILD is not one of the documented errors for fork, vfork, or clone referenced by the Linux manpage for posix_spaw

Re: posix_spawn

2025-04-22 Thread Camm Maguire via Cygwin
Greetings! posix_spawnp is returning 10, or ECHILD, on the following call. At least on my first reading (:-)), ECHILD is not one of the documented errors for fork, vfork, or clone referenced by the Linux manpage for posix_spawnp. Suggestions? Take care,

Re: posix_spawn

2025-04-22 Thread Camm Maguire via Cygwin
Greetings, and thanks so much! Mark Geisert via Cygwin-apps writes: > On 4/19/2025 1:42 PM, Camm Maguire via Cygwin-apps wrote: >> Greetings! >> posix_spawn is returning non-zero without setting errno: >>massert(!posix_spawnp(&pid, *p1, &file_actions, &attr, (void >> *)p1, environ)); >> Is

Re: posix_spawn

2025-04-21 Thread Mark Geisert via Cygwin
On 4/19/2025 1:42 PM, Camm Maguire via Cygwin-apps wrote: Greetings! posix_spawn is returning non-zero without setting errno: massert(!posix_spawnp(&pid, *p1, &file_actions, &attr, (void *)p1, environ)); Is this intended to be supported? Is it known to be working or not working elsewhere

Re: posix_spawn facility

2023-07-31 Thread Corinna Vinschen via Cygwin
Hi Eric, On Jul 31 13:58, Eric Blake via Cygwin wrote: > Following up on an older thread: > > On Tue, Apr 18, 2023 at 03:49:20PM -0500, Eric Blake wrote: > > The glibc bug points to the sample posix_spawn() implementation in > > POSIX XRAT - but that example implementation is non-normative and >

Re: posix_spawn facility

2023-07-31 Thread Eric Blake via Cygwin
Following up on an older thread: On Tue, Apr 18, 2023 at 03:49:20PM -0500, Eric Blake wrote: > The glibc bug points to the sample posix_spawn() implementation in > POSIX XRAT - but that example implementation is non-normative and > known buggy, so it is not safe to rely on it. > > Clarifying the

Re: posix_spawn facility

2023-05-10 Thread gs-cygwin.com--- via Cygwin
On Thu, Apr 20, 2023 at 04:00:15PM -0400, gs-cygwin@gluelogic.com wrote: > On Thu, Apr 20, 2023 at 09:31:38PM +0200, Bruno Haible wrote: > > Glenn wrote: > > > > > https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-startupinfoexa > > > > > > > > > > and the PROC_THREAD_ATTR

Re: posix_spawn facility

2023-05-10 Thread gs-cygwin.com--- via Cygwin
On Thu, Apr 20, 2023 at 03:14:59AM -0400, gs-cygwin@gluelogic.com wrote: > On Mon, Apr 17, 2023 at 08:44:51PM +0200, Bruno Haible via Cygwin wrote: > > Btw, there are two more functions in the posix_spawn family meanwhile: > > * posix_spawn_file_actions_addchdir_np > > implemented by glib

Re: posix_spawn facility

2023-04-20 Thread gs-cygwin.com--- via Cygwin
On Thu, Apr 20, 2023 at 09:31:38PM +0200, Bruno Haible wrote: > Glenn wrote: > > > > https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-startupinfoexa > > > > > > > > and the PROC_THREAD_ATTRIBUTE_HANDLE_LIST argument described in > > > > > > > > https://learn.microsoft.com/en

Re: posix_spawn facility

2023-04-20 Thread Bruno Haible via Cygwin
Glenn wrote: > > > https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-startupinfoexa > > > > > > and the PROC_THREAD_ATTRIBUTE_HANDLE_LIST argument described in > > > > > > https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthr

Re: posix_spawn facility

2023-04-20 Thread gs-cygwin.com--- via Cygwin
On Thu, Apr 20, 2023 at 05:40:52PM +0200, Corinna Vinschen via Cygwin wrote: > On Apr 20 16:58, Bruno Haible via Cygwin wrote: > > Corinna Vinschen wrote: > > > > Hmm. Your code uses lpReserved2 for that, but the functionality is > > > > one implemented in MSVCRT. For obvious reasons, Cygwin exec

Re: posix_spawn facility

2023-04-20 Thread gs-cygwin.com--- via Cygwin
On Thu, Apr 20, 2023 at 04:58:20PM +0200, Bruno Haible via Cygwin wrote: > Corinna Vinschen wrote: > > > Hmm. Your code uses lpReserved2 for that, but the functionality is > > > one implemented in MSVCRT. For obvious reasons, Cygwin executables > > > are not linked against msvcrt.dll and we're us

Re: posix_spawn facility

2023-04-20 Thread gs-cygwin.com--- via Cygwin
On Thu, Apr 20, 2023 at 04:40:52PM +0200, Corinna Vinschen via Cygwin wrote: > On Apr 20 16:21, Corinna Vinschen via Cygwin wrote: > > On Apr 20 12:18, Bruno Haible via Cygwin wrote: > > > The "inheritable handles" is a data structure that allows for the > > > arbitrary reshuffling of fil

Re: posix_spawn facility

2023-04-20 Thread Corinna Vinschen via Cygwin
On Apr 20 16:58, Bruno Haible via Cygwin wrote: > Corinna Vinschen wrote: > > > Hmm. Your code uses lpReserved2 for that, but the functionality is > > > one implemented in MSVCRT. For obvious reasons, Cygwin executables > > > are not linked against msvcrt.dll and we're using lpReserved2 for our >

Re: posix_spawn facility

2023-04-20 Thread Bruno Haible via Cygwin
Corinna Vinschen wrote: > > Hmm. Your code uses lpReserved2 for that, but the functionality is > > one implemented in MSVCRT. For obvious reasons, Cygwin executables > > are not linked against msvcrt.dll and we're using lpReserved2 for our > > own purposes. > > Oh, btw., did you know that there'

Re: posix_spawn facility

2023-04-20 Thread Corinna Vinschen via Cygwin
On Apr 20 16:21, Corinna Vinschen via Cygwin wrote: > On Apr 20 12:18, Bruno Haible via Cygwin wrote: > > The "inheritable handles" is a data structure that allows for the > > arbitrary reshuffling of file descriptors required by posix_spawn > > (the addopen, adddup2, addclose action

Re: posix_spawn facility

2023-04-20 Thread Corinna Vinschen via Cygwin
On Apr 20 12:18, Bruno Haible via Cygwin wrote: > Corinna Vinschen wrote: > > Unfortunately you can't expect any noticable difference on Cygwin by > > using posix_spawn. While Cygwin has a spawn() family of functions, we > > don't (and can't... yet) use them. > > > > The problem is that we don't

Re: posix_spawn facility

2023-04-20 Thread Bruno Haible via Cygwin
Corinna Vinschen wrote: > Unfortunately you can't expect any noticable difference on Cygwin by > using posix_spawn. While Cygwin has a spawn() family of functions, we > don't (and can't... yet) use them. > > The problem is that we don't have a safe way to perform the spawn > attributes and file a

Re: posix_spawn facility

2023-04-20 Thread Corinna Vinschen via Cygwin
On Apr 20 03:14, gs-cygwin.com--- via Cygwin wrote: > On Mon, Apr 17, 2023 at 08:44:51PM +0200, Bruno Haible via Cygwin wrote: > > Btw, there are two more functions in the posix_spawn family meanwhile: > > * posix_spawn_file_actions_addchdir_np > > implemented by glibc [1], musl libc, macOS,

Re: posix_spawn facility

2023-04-20 Thread gs-cygwin.com--- via Cygwin
On Mon, Apr 17, 2023 at 08:44:51PM +0200, Bruno Haible via Cygwin wrote: > Btw, there are two more functions in the posix_spawn family meanwhile: > * posix_spawn_file_actions_addchdir_np > implemented by glibc [1], musl libc, macOS, FreeBSD [2], Solaris ≥ 11.3 > used by a few packages (Fi

Re: posix_spawn facility

2023-04-19 Thread Csaba Raduly via Cygwin
On Wed, 19 Apr 2023 at 13:56, Bruno Haible via Cygwin wrote: > Note a typo: line 126541 is on page 3694 not on page 3594. > That sentence is scary in and of itself :) Csaba -- You can get very substantial performance improvements by not doing the right thing. - Scott Meyers, An Effective C++11/

Re: posix_spawn facility

2023-04-19 Thread Bruno Haible via Cygwin
Eric Blake wrote: > POSIX issue now filed as > https://www.austingroupbugs.net/view.php?id=1674 Thank you very much! Note a typo: line 126541 is on page 3694 not on page 3594. Bruno -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Docum

Re: posix_spawn facility

2023-04-19 Thread Bruno Haible via Cygwin
I wrote: > * posix_spawn_file_actions_addfchdir_np > implemented in glibc, musl libc Correction: posix_spawn_file_actions_addfchdir_np is implemented in glibc, musl libc, FreeBSD ≥ 13.1, macOS ≥ 10.15. Bruno -- Problem reports: https://cygwin.com/problems.html FAQ:

Re: posix_spawn facility

2023-04-19 Thread Corinna Vinschen via Cygwin
Hi Bruno, On Apr 17 20:44, Bruno Haible via Cygwin wrote: > Btw, there are two more functions in the posix_spawn family meanwhile: > * posix_spawn_file_actions_addchdir_np > implemented by glibc [1], musl libc, macOS, FreeBSD [2], Solaris ≥ 11.3 > used by a few packages (Firefox, Chromiu

Re: posix_spawn facility

2023-04-19 Thread Corinna Vinschen via Cygwin
On Apr 18 21:39, Eric Blake via Cygwin wrote: > On Wed, Apr 19, 2023 at 12:10:34AM +0200, Bruno Haible wrote: > > Eric Blake wrote: > > > we now have implementations in the wild that differ in behavior, and > > > use security as a reason for the divergence, it is worth getting that > > > clarified

Re: posix_spawn facility

2023-04-18 Thread Eric Blake via Cygwin
On Wed, Apr 19, 2023 at 12:10:34AM +0200, Bruno Haible wrote: > Eric Blake wrote: > > we now have implementations in the wild that differ in behavior, and > > use security as a reason for the divergence, it is worth getting that > > clarified in POSIX. I'll file a bug against POSIX shortly > > Fo

Re: posix_spawn facility

2023-04-18 Thread Bruno Haible via Cygwin
Eric Blake wrote: > we now have implementations in the wild that differ in behavior, and > use security as a reason for the divergence, it is worth getting that > clarified in POSIX. I'll file a bug against POSIX shortly For the reference, the systems that return ENOEXEC for posix_spawnp attempti

Re: posix_spawn facility

2023-04-18 Thread Corinna Vinschen via Cygwin
Hi Eric, On Apr 18 15:49, Eric Blake via Cygwin wrote: > On Tue, Apr 18, 2023 at 11:25:11AM +0200, Corinna Vinschen via Cygwin wrote: > Jumping in to this conversation a bit belatedly, but as someone on the > Austin Group that can try to get an answer upstream... Many thanks for your input, it's

Re: posix_spawn facility

2023-04-18 Thread Eric Blake via Cygwin
On Tue, Apr 18, 2023 at 11:25:11AM +0200, Corinna Vinschen via Cygwin wrote: > Hi Bruno, > > On Apr 17 20:44, Bruno Haible via Cygwin wrote: > > Hi Corinna, Jumping in to this conversation a bit belatedly, but as someone on the Austin Group that can try to get an answer upstream... > But I'm not

Re: posix_spawn facility

2023-04-18 Thread Corinna Vinschen via Cygwin
Hi Bruno, On Apr 17 20:44, Bruno Haible via Cygwin wrote: > Hi Corinna, > > > > Would it be possible to change Cygwin's posix_spawnp implementation, > > > so that both tests succeed? > > > > Basically, yes, but... > > Thanks! > > > > Disclaimer: I have done my tests with Cygwin 2.9.0; so, if t

Re: posix_spawn facility

2023-04-17 Thread Bruno Haible via Cygwin
Hi Corinna, > > Would it be possible to change Cygwin's posix_spawnp implementation, > > so that both tests succeed? > > Basically, yes, but... Thanks! > > Disclaimer: I have done my tests with Cygwin 2.9.0; so, if things have > >

Re: posix_spawn facility

2023-04-17 Thread Corinna Vinschen via Cygwin
Hi Bruno, On Apr 16 13:46, Bruno Haible via Cygwin wrote: > Hi, > > AFAIU, Cygwin has a working posix_spawn[p] implementation since 2020 > (commit 3fbfcd11fb09d5f47af3043ee47ec5c7d863d872, 2020-08-03, Cygwin 3.1.7). > [

Re: posix_spawn issues on i686

2022-01-14 Thread Corinna Vinschen
On Jan 12 13:25, Jeremy Drake via Cygwin wrote: > > > > Sorry, I am not subscribed to the list so don't have the message to > > > > reply > > > > to for threading purposes > > > New developer snapshot is up at https://cygwin.com/snapshots/ > > Please test. > > This works, and make's "make check"

Re: posix_spawn issues on i686

2022-01-12 Thread Jeremy Drake via Cygwin
> > > Sorry, I am not subscribed to the list so don't have the message to reply > > > to for threading purposes > New developer snapshot is up at https://cygwin.com/snapshots/ > Please test. This works, and make's "make check" now gets the same results as it does when built with --disable-posix-s

Re: posix_spawn issues on i686

2022-01-12 Thread Ken Brown
On 1/12/2022 5:41 AM, Corinna Vinschen wrote: On Jan 11 16:08, Ken Brown wrote: I don't have time to check this carefully, but it looks to me like the problem is that process_spawnattr calls setegid and seteuid instead of setegid32 and seteuid32. This causes truncation of the gid and uid. You

Re: posix_spawn issues on i686

2022-01-12 Thread Corinna Vinschen
On Jan 12 11:41, Corinna Vinschen wrote: > On Jan 11 16:08, Ken Brown wrote: > > On 1/11/2022 1:45 PM, Jeremy Drake via Cygwin wrote: > > > Sorry, I am not subscribed to the list so don't have the message to reply > > > to for threading purposes, but attached please find a C reproducer that > > > w

Re: posix_spawn issues on i686

2022-01-12 Thread Corinna Vinschen
On Jan 11 16:08, Ken Brown wrote: > On 1/11/2022 1:45 PM, Jeremy Drake via Cygwin wrote: > > Sorry, I am not subscribed to the list so don't have the message to reply > > to for threading purposes, but attached please find a C reproducer that > > works on x86_64 but fails on i686. The particular i

Re: posix_spawn issues on i686

2022-01-11 Thread Ken Brown
On 1/11/2022 1:45 PM, Jeremy Drake via Cygwin wrote: Sorry, I am not subscribed to the list so don't have the message to reply to for threading purposes, but attached please find a C reproducer that works on x86_64 but fails on i686. The particular issue seems to be the POSIX_SPAWN_RESETIDS flag

Re: posix_spawn issues on i686

2022-01-11 Thread Jeremy Drake via Cygwin
On Mon, 10 Jan 2022, Jeremy Drake wrote: > From https://github.com/msys2/MSYS2-packages/issues/2801 > > MSYS2 recently rebuilt GNU make 4.3, and I found that after rebuilding, it > broke rather horribly on i686, where any attempt to run a command resulted > in "Invalid argument" errors. Some debu

Re: posix_spawn issues on i686

2022-01-11 Thread Corinna Vinschen
On Jan 10 11:38, Jeremy Drake via Cygwin wrote: > >From https://github.com/msys2/MSYS2-packages/issues/2801 > > MSYS2 recently rebuilt GNU make 4.3, and I found that after rebuilding, it > broke rather horribly on i686, where any attempt to run a command resulted > in "Invalid argument" errors. S