[patch] cygcheck.cc update for cygpath()

Corinna Vinschen corinna-cygwin@cygwin.com
Sun Mar 9 09:51:00 GMT 2008

On Mar  9 01:40, Brian Dessent wrote:
> Corinna Vinschen wrote:
> > Given that Cygwin changes to support long path names, I don't really
> > like to see new code still using MAX_PATH and Win32 Ansi functions
> > in the utils dir.
> Regardless of this patch, path.cc:rel_vconcat() currently uses
> GetCurrentDirectory() to resolve relative paths.  

Yup, that's why I said "new code".  The existing code simply didn't have
that problem.  I just think it would be a waste to introduce new code
which sticks to the old ways.

> > Bash as well as tcsh, as well as zsh (and probbaly pdksh, too) create an
> > environment variable $PWD.  Maybe Cygwin should create $PWD for native
> > apps if it's not already available through the parent shell.  I'd
> > suggest that the Cygwin utils first try to fetch $PWD from the
> > environment and use that as cwd.  Only if that fails, use
> > GetCurrentDirectory.
> I will work on a patch that both adds an interface to allow the caller
> to supply a CWD as well as trying to use $PWD to get the value
> otherwise.

Cool, thank you!

> > Never use SetCurrentDirectory, rather convert the path to an absolute
> > path, prepend \\?\ and call the Win32 unicode functions (CreateFileW,
> > etc).
> Setting the CWD can be totally avoided I think, by the above replumbing.
> > SYMLINK_MAX is PATH_MAX - 1 == 4095.
> > 
> > I'm wondering if you would like to tweak the readlink functions, too.
> > Cygwin shortcuts can now have the path name appended to the actual
> > shortcut data.  This hack was necessary to support pathnames longer than
> > 2000 chars.  See the comment and code in cygwin/path.cc, line 3139ff.
> Oh, I didn't know that.  I'll add that to the list.

Thanks again.  I'm finally seeing light at the end of the long path
name tunnel :)

Have a nice weekend,

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

More information about the Cygwin-patches mailing list