This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CWD and long paths


On Oct 12 12:21, Brian Dessent wrote:
> Jose A Fernandez wrote:
> 
> > Is it okay to simply return the moral equivalent of ENAMETOOLONG?  It's
> 
> That would be another way to go, but it requires knowing beforehand that
> you're about to exec a non-Cygwin binary and I'm not sure we can
> guarantee that.

The spawn code checks if the executable is a Cygwin executable so usually
we know this.

Returning ENAMETOOLONG from exec(3) would be another interesting option.
Maybe it's even the option with the least surprise factor...

As another option we could do what cmd does when it's started in a
directory path it doesn't support.  This is the case, for instance,
when your CWD is set to a network path.  I have no idea why cmd.exe
doesn't support network paths... Anyway, what it does is to print a
longish message and to set the CWD to $SYSTEMROOT.

So, for now we have four options(*)what to do in exec(3) when trying to
start a native child process from a long CWD (> MAX_PATH):

1. Return ENAMETOOLONG and don't start the native child.

2. CWD for the native child is set to $SYSTEMROOT.

3. CWD is set to the root of the current drive (either X:\ or
   \\server\share).

4. CWD is set to the longest leading path component of CWD which still
   fits into MAX_PATH.

As an additional possible feature, regardless of which of the above
options we choose:

- Print a longish message along the lines of what's printed by CMD.

Now we just have to make a decision.  Opinions?  Personally I tend
to opt for 1 or 3.


Corinna


(*) Sorry, Lev, but your idea is too sophisticated from my point of
    view.  Cygwin would have to create a directory on the fly, create a
    reparse point on it, and start the child.  Besides of not working on
    NT4, there's room for collisions.  There's also the problem of how
    to know when to remove the reparse point and the temporary directory
    again (aka: are there still grandchildren which might require the
    reparse point/temp dir?).


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]