From ece49e4090564e7ac7b936692e15a78e1a3cb39c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 5 Apr 2020 16:17:36 +0200 Subject: [PATCH] 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 --- 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