public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Don't check directories always case-insensitive in rename(2)
@ 2016-10-19 11:26 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2016-10-19 11:26 UTC (permalink / raw)
  To: cygwin-cvs

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

commit e3ccb686104103898ac9615a72f0189aa980c273
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Oct 19 13:26:03 2016 +0200

    Don't check directories always case-insensitive in rename(2)
    
    Long-standing problem in one of the corner cases of rename(2):
    If we rename a directory a check is performed to see if newpath is
    identical to oldpath or a subdir of oldpath. This check is
    (accidentally? no hints anywhere in ChangeLogs or code) performed
    case-insensitive for as long as we use Unicode paths and NT functions.
    This leads to the problems described in
    https://cygwin.com/ml/cygwin/2016-09/msg00264.html
    
    Change this to be conditional case-sensitive as all other checks but
    let's take this with a grain of salt.  There may be corner-cases in
    this corner-case which require to chek parts of the path always
    case-insensitive.  Off the top of my head I can't construct such a
    case but that's no proof they don't exist :}
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/release/2.6.1 | 3 +++
 winsup/cygwin/syscalls.cc   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/release/2.6.1 b/winsup/cygwin/release/2.6.1
index 2d5aef8..61ce2de 100644
--- a/winsup/cygwin/release/2.6.1
+++ b/winsup/cygwin/release/2.6.1
@@ -11,3 +11,6 @@ Bug Fixes
 
 - Fix regression in console charset handling
   Addresses: https://cygwin.com/ml/cygwin/2016-10/msg00000.html
+
+- Fix case-sensitivity problem when renaming directories
+  Addresses: https://cygwin.com/ml/cygwin/2016-09/msg00264.html
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index ba7c743..13bb309 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -2224,7 +2224,7 @@ rename (const char *oldpath, const char *newpath)
 	  /* Check for newpath being identical or a subdir of oldpath. */
 	  if (RtlPrefixUnicodeString (oldpc.get_nt_native_path (),
 				      newpc.get_nt_native_path (),
-				      TRUE))
+				      oldpc.objcaseinsensitive ()))
 	    {
 	      if (newpc.get_nt_native_path ()->Length
 		  == oldpc.get_nt_native_path ()->Length)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-19 11:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19 11:26 [newlib-cygwin] Don't check directories always case-insensitive in rename(2) Corinna Vinschen

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).