This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH] Cygwin: normalize_win32_path: allow drive without trailing backslash
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Wed, 15 Jan 2020 17:46:54 +0000
- Subject: [PATCH] Cygwin: normalize_win32_path: allow drive without trailing backslash
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BKD8thmdQO4EHRrAi+GIVm2JUmYSABpD0X7qdRup+II=; b=PRdxIiYCccMPyWr1CcDPKaucKBgEonBwskWjUetFVYbfyJAMIndRHOq8Fty11N+njmDpEOeiOru0yVFSjltaQB0lEVl+m0oXfSm9l2BF3o30MWKfIJ5tm23vpah1BvWtFbLQFVhYY4+0Hw7BYGrLtLkVAuphJEdwbPlq5dXB1O8nRJHPG/enmGn/HV2sQyzF1fam+7L02p4XX6BptD8ATxKTTRORBJCuK3S3egy1vO9GDNIg4fwysNI9epQ8qvVJ0IIfAmjHVE5pxzUm7qPsaUFYFQxlMNhgkKQiwi7JXzhbpin1fubNjN5/xu1d/qKMGuaUyTVzhADvelZqyG7VvA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JVV+Di//GLY64fUcXr665Bzy+ecLvkE22lAsHOnfiBgxTLN5I6i6ygv8Iwauw+1DI7fZ4XosszPUzNR6B2kWrB4YJwG3U/EClfi77MvCw10NsUWzAC0DZfAubGrI6718ZCO2x2pdfttp8coR1mk8bHNmp6bur6esJKdlqMXfcOQwEDehD0teH0ieMWjlVXk3MC/Xlgh9NnKFT88gOHaF9hwDMZsw15KnTbo1HdFlYBxFL81uuqO+DtIzbYApA/a7jWxQCqmD+puVqMoeWz77ZfcFhis7KiV0yLXiJ7prKBYSAERM8729DDPU/24t9uhaVV0WOfuzkjaXzRd5Q7uvQQ==
Commit 283cb372, "Cygwin: normalize_win32_path: improve error
checking", required a prefix '\\?\' or '\??\' in the source path to be
followed by 'UNC\' or 'X:\', where X is a drive letter. That was too
restrictive, since it disallowed the paths '\\?\X: and '\??\X:'. This
caused problems when a user tried to use the root of a drive as the
Cygwin installation root, as reported here:
https://cygwin.com/ml/cygwin/2020-01/msg00111.html
Modify the requirement so that '\??\X:' and '\\?\X:' are now allowed
as source paths, without a trailing backslash.
---
winsup/cygwin/path.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c8e73c64c..a00270210 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1411,7 +1411,7 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
&& src[2] == '?' && isdirsep (src[3]))
{
src += 4;
- if (isdrive (src) && isdirsep (src[2]))
+ if (isdrive (src) && (isdirsep (src[2]) || !src[2]))
beg_src_slash = false;
else if (!strncmp (src, "UNC", 3) && isdirsep (src[3]))
/* native UNC path */
--
2.21.0