public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: symlinks: Allow traversing WSL symlinks
Date: Sun,  5 Apr 2020 15:02:08 +0000 (GMT)	[thread overview]
Message-ID: <20200405150208.ACA6C385B831@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ece49e4090564e7ac7b936692e15a78e1a3cb39c

commit ece49e4090564e7ac7b936692e15a78e1a3cb39c
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sun Apr 5 16:17:36 2020 +0200

    Cygwin: symlinks: Allow traversing WSL symlinks
    
    Unfortunately Windows doesn't understand WSL symlinks,
    despite being a really easy job.  NT functions trying
    to access paths traversing WSL symlinks return the status
    code STATUS_IO_REPARSE_TAG_NOT_HANDLED.  Handle this
    status code same as STATUS_OBJECT_PATH_NOT_FOUND in
    symlink_info::check to align behaviour to traversing
    paths with other non-NTFS type symlinks.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/path.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index e6dc03ffa..f2b5cdbf1 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3115,6 +3115,11 @@ restart:
 	  /* One of the inner path components is invalid, or the path contains
 	     invalid characters.  Bail out with ENOENT.
 
+	     STATUS_IO_REPARSE_TAG_NOT_HANDLED is returned when trying to
+	     traversing a WSL symlink.  For all practical purposes it's
+	     equivalent to traversing SYSTEM- or LNK-type symlink returning
+	     STATUS_OBJECT_PATH_NOT_FOUND.
+
 	     Note that additional STATUS_OBJECT_PATH_INVALID and
 	     STATUS_OBJECT_PATH_SYNTAX_BAD status codes exist.  The first one
 	     is seemingly not generated by NtQueryInformationFile, the latter
@@ -3123,6 +3128,7 @@ restart:
 	     error in get_nt_native_path.  Both status codes are deliberately
 	     not tested here unless proved necessary. */
 	  if (status == STATUS_OBJECT_PATH_NOT_FOUND
+	      || status == STATUS_IO_REPARSE_TAG_NOT_HANDLED
 	      || status == STATUS_OBJECT_NAME_INVALID
 	      || status == STATUS_BAD_NETWORK_PATH
 	      || status == STATUS_BAD_NETWORK_NAME


                 reply	other threads:[~2020-04-05 15:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200405150208.ACA6C385B831@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).