[PATCH v2] Cygwin: respect PC_SYM_FOLLOW and PC_SYM_NOFOLLOW_REP with inner links

Corinna Vinschen corinna-cygwin@cygwin.com
Mon May 31 08:02:40 GMT 2021

On May 30 12:58, Jeremy Drake via Cygwin-patches wrote:
> First, revert the handling of virtual drives as non-symlinks.  This is no
> longer necessary.

I'm all for it, because I like the idea that Cygwin can see virtual
drives as symlinks, but...

> The new GetFinalPathNameW handling for native symlinks in inner path
> components is disabled if caller doesn't want to follow symlinks, or
> doesn't want to follow reparse points.  Set flag to not follow reparse
> points in chdir, allowing native processes to see their cwd potentially
> including native symlinks, rather than dereferencing them.

So you're trying to keep the path length of the native CWD below
MAX_PATH?  I understand what you're trying to accomplish, but are
you sure this doesn't break Cygwin processes?  The idea of what
the native path of a directory is differs depending on calling
chdir and stuff like mkdir.

> For v2, I realized the PC_SYM_NOFOLLOW_REP flag was supposed to do this,
> and that lack of PC_SYM_FOLLOW was not being respected either.  With this,
> and patching `pwd -P` to `pwd` in makepkg, the long-named package builds
> successfully.  I did not re-indent the code for the addition of the if due
> to having learned from my patch to rebase, but it looks kind of ugly.

Formatting should try to stick to 80 chars max line length, if possible.
Kind of like this, just with TABs:

-	  for (unsigned pc_flags = opt & (PC_NO_ACCESS_CHECK | PC_KEEP_HANDLE);
+	  for (unsigned pc_flags = opt & (PC_NO_ACCESS_CHECK | PC_KEEP_HANDLE


More information about the Cygwin-patches mailing list