From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id ACA6C385B831; Sun, 5 Apr 2020 15:02:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACA6C385B831 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: symlinks: Allow traversing WSL symlinks X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 44fe41a766b1f4dbb6d2f16523aea3507d10b6ef X-Git-Newrev: ece49e4090564e7ac7b936692e15a78e1a3cb39c Message-Id: <20200405150208.ACA6C385B831@sourceware.org> Date: Sun, 5 Apr 2020 15:02:08 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Apr 2020 15:02:08 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ece49e4090564e7ac7b936692e15a78e1a3cb39c commit ece49e4090564e7ac7b936692e15a78e1a3cb39c Author: Corinna Vinschen 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 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