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

ruby-changes:17905

From: yugui <ko1@a...>
Date: Wed, 24 Nov 2010 18:38:25 +0900 (JST)
Subject: [ruby-changes:17905] Ruby:r29916 (ruby_1_9_2): merges r29306 from trunk into ruby_1_9_2.

yugui	2010-11-24 18:37:36 +0900 (Wed, 24 Nov 2010)

  New Revision: 29916

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

  Log:
    merges r29306 from trunk into ruby_1_9_2.
    --
    * dir.c (bracket): get rid of scanning at the end of the pattern
      string, not to raise an exception while globbing command line.
      [ruby-core:32478]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/dir.c
    branches/ruby_1_9_2/test/ruby/test_rubyoptions.rb
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 29915)
+++ ruby_1_9_2/ChangeLog	(revision 29916)
@@ -1,3 +1,9 @@
+Mon Sep 20 23:23:05 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* dir.c (bracket): get rid of scanning at the end of the pattern
+	  string, not to raise an exception while globbing command line.
+	  [ruby-core:32478]
+
 Fri Sep 17 23:44:07 2010  Kouhei Sutou  <kou@c...>
 
 	* lib/rexml/xpath_parser.rb, test/rexml/test_xpath.rb:
Index: ruby_1_9_2/dir.c
===================================================================
--- ruby_1_9_2/dir.c	(revision 29915)
+++ ruby_1_9_2/dir.c	(revision 29916)
@@ -108,6 +108,7 @@
     int r;
     int ok = 0, not = 0;
 
+    if (p >= pend) return NULL;
     if (*p == '!' || *p == '^') {
 	not = 1;
 	p++;
@@ -120,6 +121,7 @@
 	if (!*t1)
 	    return NULL;
 	p = t1 + (r = rb_enc_mbclen(t1, pend, enc));
+	if (p >= pend) return NULL;
 	if (p[0] == '-' && p[1] != ']') {
 	    const char *t2 = p + 1;
 	    int r2;
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 29915)
+++ ruby_1_9_2/version.h	(revision 29916)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 48
+#define RUBY_PATCHLEVEL 49
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_2/test/ruby/test_rubyoptions.rb
===================================================================
--- ruby_1_9_2/test/ruby/test_rubyoptions.rb	(revision 29915)
+++ ruby_1_9_2/test/ruby/test_rubyoptions.rb	(revision 29916)
@@ -445,4 +445,15 @@
     s.close
     assert_equal("\"zzz\\n\"\n", result, '[ruby-core:30910]')
   end
+
+  def test_unmatching_glob
+    bug3851 = '[ruby-core:32478]'
+    a = "a[foo"
+    Dir.mktmpdir do |dir|
+      open(File.join(dir, a), "w") {|f| f.puts("p 42")}
+      assert_in_out_err(["-C", dir, a], "", ["42"], [], bug3851)
+      File.unlink(File.join(dir, a))
+      assert_in_out_err(["-C", dir, a], "", [], /LoadError/, bug3851)
+    end
+  end
 end

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

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