public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: normalize_win32_path: allow drive without trailing backslash
Date: Fri, 17 Jan 2020 12:38:00 -0000	[thread overview]
Message-ID: <20200117123825.104010.qmail@sourceware.org> (raw)

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

commit 85aff2830a68ce79a280e5ea31fcf01342d61986
Author: Ken Brown <kbrown@cornell.edu>
Date:   Wed Jan 15 10:49:21 2020 -0500

    Cygwin: normalize_win32_path: allow drive without trailing backslash
    
    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.

Diff:
---
 winsup/cygwin/path.cc       | 2 +-
 winsup/cygwin/release/3.1.3 | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c8e73c6..a002702 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 */
diff --git a/winsup/cygwin/release/3.1.3 b/winsup/cygwin/release/3.1.3
index 0fcdcca..4897411 100644
--- a/winsup/cygwin/release/3.1.3
+++ b/winsup/cygwin/release/3.1.3
@@ -6,3 +6,7 @@ Bug Fixes
 
 - Fix the problem which overrides the code page setting.
   Addresses: https://www.cygwin.com/ml/cygwin/2019-12/msg00292.html
+
+- Fix a regression that prevents the root of a drive from being the
+  Cygwin installation root.
+  Addresses: https://cygwin.com/ml/cygwin/2020-01/msg00111.html


                 reply	other threads:[~2020-01-17 12:38 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=20200117123825.104010.qmail@sourceware.org \
    --to=kbrown@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).