summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-24 09:37:36 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-24 09:37:36 +0000
commit29160356f2166e8b11d5fd1fa70da85579914437 (patch)
tree47eaf899f270e093cd10bdbc8304e444a8fae36b
parent911692e5684749c293bed767d0c6c37a29833383 (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--dir.c2
-rw-r--r--test/ruby/test_rubyoptions.rb11
-rw-r--r--version.h2
4 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a705bd3d39..e6da5aeeaf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Sep 20 23:23:05 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@cozmixng.org>
* lib/rexml/xpath_parser.rb, test/rexml/test_xpath.rb:
diff --git a/dir.c b/dir.c
index 3818974a4d..0339697279 100644
--- a/dir.c
+++ b/dir.c
@@ -108,6 +108,7 @@ bracket(
int r;
int ok = 0, not = 0;
+ if (p >= pend) return NULL;
if (*p == '!' || *p == '^') {
not = 1;
p++;
@@ -120,6 +121,7 @@ bracket(
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;
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index f572ab7083..43802db202 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -445,4 +445,15 @@ class TestRubyOptions < Test::Unit::TestCase
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
diff --git a/version.h b/version.h
index d71d58cb0b..a942d374e7 100644
--- a/version.h
+++ b/version.h
@@ -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