From 1d63878e2fd83bfa6caeb3661e9efa57feeeb12e Mon Sep 17 00:00:00 2001
From: Jeremy Drake <cygwin@jdrake.com>
Date: Wed, 19 May 2021 14:40:23 +0200
Subject: [PATCH 36/N] Cygwin: Handle virtual drives as non-symlinks

This avoids MAX_PATH-related problems in native tools in case the
virtual drive points to a deep directory

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
---
 winsup/cygwin/path.cc | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4ebaf4d..1b50ed5 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3665,14 +3665,9 @@ restart:
 
 		     subst X: C:\foo\bar
 
-		   Treat it like a symlink.  This is required to tell an
-		   lstat caller that the "drive" is actually pointing
-		   somewhere else, thus, it's a symlink in POSIX speak. */
+		   Treat it as a normal file. */
 		if (upath.Length == 14)	/* \??\X:\ */
-		  {
-		    fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
-		    path_flags |= PATH_SYMLINK;
-		  }
+		  goto file_not_symlink;
 		/* For final paths differing in inner path components return
 		   length as negative value.  This informs path_conv::check
 		   to skip realpath handling on the last path component. */
-- 
2.31.1

