From 54a83cc65add6561a3d6ed4af39c8b3a899a3d4a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 9 Jan 2009 16:20:26 +0000 Subject: [PATCH] * mount.cc (mount_info::from_fstab_line): Always convert drive letter in native path to uppercase. * path.cc (normalize_win32_path): Ditto. (path_prefix_p): Revert previous patch. * path.cc (symlink_info::check): Check for STATUS_INVALID_PARAMETER return code to circumvent weird behaviour of Samba 3.2.x shares. --- winsup/cygwin/ChangeLog | 10 +++++++++ winsup/cygwin/mount.cc | 3 +++ winsup/cygwin/path.cc | 45 +++++++++++++++++++---------------------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a2c604c9c..2e1053092 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2009-01-09 Corinna Vinschen + + * mount.cc (mount_info::from_fstab_line): Always convert drive + letter in native path to uppercase. + * path.cc (normalize_win32_path): Ditto. + (path_prefix_p): Revert previous patch. + + * path.cc (symlink_info::check): Check for STATUS_INVALID_PARAMETER + return code to circumvent weird behaviour of Samba 3.2.x shares. + 2009-01-09 Christopher Faylor * include/sys/cygwin.h (CW_SETERRNO): Define. diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 364c77b01..67998b24c 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -876,6 +876,9 @@ mount_info::from_fstab_line (char *line, bool user) char *cend = find_ws (c); *cend = '\0'; native_path = conv_fstab_spaces (c); + /* Always convert drive letter to uppercase for case sensitivity. */ + if (isdrive (native_path)) + native_path[0] = cyg_toupper (native_path[0]); /* Second field: POSIX path. */ c = skip_ws (cend + 1); if (!*c) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index f736be496..2cca8f8e2 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -169,20 +169,8 @@ path_prefix_p (const char *path1, const char *path2, int len1, return isdirsep (path2[0]) && !isdirsep (path2[1]); if (isdirsep (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':') - { - if (len1 < 2 || (path1[1] != ':') || (path2[1] != ':')) - /* nothing */; - else if (tolower (*path1) != tolower(*path2)) - return 0; - else - { - path1 += 2; - path2 += 2; - len1 -= 2; - } - return caseinsensitive ? strncasematch (path1, path2, len1) - : !strncmp (path1, path2, len1); - } + return caseinsensitive ? strncasematch (path1, path2, len1) + : !strncmp (path1, path2, len1); return 0; } @@ -1177,17 +1165,23 @@ normalize_win32_path (const char *src, char *dst, char *&tail) } } } - if (tail == dst && !isdrive (src) && *src != '/') + if (tail == dst) { - if (beg_src_slash) - tail += cygheap->cwd.get_drive (dst); - else if (!cygheap->cwd.get (dst, 0)) - return get_errno (); - else + if (isdrive (src)) + /* Always convert drive letter to uppercase for case sensitivity. */ + *tail++ = cyg_toupper (*src++); + else if (*src != '/') { - tail = strchr (tail, '\0'); - if (tail[-1] != '\\') - *tail++ = '\\'; + if (beg_src_slash) + tail += cygheap->cwd.get_drive (dst); + else if (!cygheap->cwd.get (dst, 0)) + return get_errno (); + else + { + tail = strchr (tail, '\0'); + if (tail[-1] != '\\') + *tail++ = '\\'; + } } } @@ -2167,7 +2161,10 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt, | FILE_OPEN_FOR_BACKUP_INTENT, eabuf, easize); /* No right to access EAs or EAs not supported? */ - if (status == STATUS_ACCESS_DENIED || status == STATUS_EAS_NOT_SUPPORTED) + if (status == STATUS_ACCESS_DENIED || status == STATUS_EAS_NOT_SUPPORTED + /* Or a bug in Samba 3.2.x when accessing a share's root dir which + has EAs enabled? */ + || status == STATUS_INVALID_PARAMETER) { no_ea = true; /* If EAs are not supported, there's no sense to check them again