[PATCH] Cygwin: spawn: Treat empty path as the current directory.

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 4 08:37:52 GMT 2022


On Jul  1 21:32, Ken Brown wrote:
> On 7/1/2022 7:31 PM, Takashi Yano wrote:
> > On Thu, 30 Jun 2022 21:16:35 -0400
> > Ken Brown wrote:
> > > On 6/30/2022 11:45 AM, Ken Brown wrote:
> > > > On 6/27/2022 8:44 AM, Takashi Yano wrote:
> > > > > - With this patch, the empty path (empty element in PATH or PATH is
> > > > >     absent) is treated as the current directory as Linux does.
> > > > > Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251730.html
> > > > 
> > > > It might be a good idea to include a comment in the code and the commit message
> > > > that this feature is being added for Linux compatibility but that it is
> > > > deprecated.  According to https://man7.org/linux/man-pages/man7/environ.7.html,
> > > > 
> > > >                 As a legacy feature, a zero-length prefix (specified as
> > > >                 two adjacent colons, or an initial or terminating colon)
> > > >                 is interpreted to mean the current working directory.
> > > >                 However, use of this feature is deprecated, and POSIX
> > > >                 notes that a conforming application shall use an explicit
> > > >                 pathname (e.g., .)  to specify the current working
> > > >                 directory.
> > > > 
> > > > Alternatively, maybe this is a case where we should prefer POSIX compliance to
> > > > Linux compatibility.  Corinna, WDYT?
> > > 
> > > I withdraw my suggestion.  There's already a comment in the code saying, "An
> > > empty path or '.' means the current directory", so it's clear that the intention
> > > was to support that feature, and the code was simply buggy.
> > > 
> > > I've now read through the patch, and it looks good to me.  This was pretty
> > > tricky to get right.
> > 
> > We still need to discuss whether it is better to align Linux
> > behavior or just keeping POSIX compliance, don't we?
> 
> I interpreted the existing comment as meaning that a decision was already
> made at some point to align with Linux.  But it can't hurt to wait for
> Corinna to weigh in.

Personally I don't like this old crufty feature and I would rather keep
this POSIX compatible, but in fact it was meant to work as on Linux, so,
please go ahead, Takashi.

However, maybe this should go into the master branch only? WDYT?


Corinna


More information about the Cygwin-patches mailing list