[前][次][番号順一覧][スレッド一覧]

ruby-changes:37215

From: naruse <ko1@a...>
Date: Sat, 17 Jan 2015 16:16:52 +0900 (JST)
Subject: [ruby-changes:37215] naruse:r49296 (ruby_2_2): merge revision(s) 49178: [Backport #10700]

naruse	2015-01-17 16:16:37 +0900 (Sat, 17 Jan 2015)

  New Revision: 49296

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49296

  Log:
    merge revision(s) 49178: [Backport #10700]
    
    * dir.c (glob_helper): match in case-folding only if the directory
      resides on a case-insensitve file system, on OSX.
      [ruby-core:67364] [Bug #10700]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/dir.c
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 49295)
+++ ruby_2_2/ChangeLog	(revision 49296)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Sat Jan 17 16:16:14 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* dir.c (glob_helper): match in case-folding only if the directory
+	  resides on a case-insensitve file system, on OSX.
+	  [ruby-core:67364] [Bug #10700]
+
 Sat Jan 17 02:04:01 2015  Eric Wong  <e@8...>
 
 	* lib/resolv.rb: consider ENETUNREACH as ResolvTimeout
Index: ruby_2_2/dir.c
===================================================================
--- ruby_2_2/dir.c	(revision 49295)
+++ ruby_2_2/dir.c	(revision 49296)
@@ -1327,6 +1327,24 @@ join_path(const char *path, long len, in https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L1327
 }
 
 #ifdef HAVE_GETATTRLIST
+static int
+is_case_sensitive(DIR *dirp)
+{
+    u_int32_t attrbuf[SIZEUP32(vol_capabilities_attr_t) + 1];
+    struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, 0, ATTR_VOL_INFO|ATTR_VOL_CAPABILITIES};
+    const vol_capabilities_attr_t *cap = (void *)(attrbuf+1);
+    const int idx = VOL_CAPABILITIES_FORMAT;
+    const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
+    struct statfs sf;
+
+    if (fstatfs(dirfd(dirp), &sf)) return -1;
+    if (getattrlist(sf.f_mntonname, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
+	return -1;
+    if (!(cap->valid[idx] & mask))
+	return -1;
+    return (cap->capabilities[idx] & mask) != 0;
+}
+
 static char *
 replace_real_basename(char *path, long base, int hfs_p)
 {
@@ -1518,7 +1536,10 @@ glob_helper( https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L1536
 	    closedir(dirp);
 	    goto literally;
 	}
-	flags |= FNM_CASEFOLD;
+# endif
+# ifdef HAVE_GETATTRLIST
+	if (is_case_sensitive(dirp) == 0)
+	    flags |= FNM_CASEFOLD;
 # endif
 	while ((dp = READDIR(dirp, enc)) != NULL) {
 	    char *buf;
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 49295)
+++ ruby_2_2/version.h	(revision 49296)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.0"
 #define RUBY_RELEASE_DATE "2015-01-17"
-#define RUBY_PATCHLEVEL 18
+#define RUBY_PATCHLEVEL 19
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49178


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]