ruby-changes:54633
From: naruse <ko1@a...>
Date: Fri, 18 Jan 2019 06:47:57 +0900 (JST)
Subject: [ruby-changes:54633] naruse:r66848 (ruby_2_6): merge revision(s) 66838: [Backport #15540]
naruse 2019-01-18 06:46:40 +0900 (Fri, 18 Jan 2019) New Revision: 66848 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66848 Log: merge revision(s) 66838: [Backport #15540] dir.c: fix Dir.glob with braces and matching dir * dir.c (join_path_from_pattern): add the last slash for directory matching. * test/ruby/test_dir.rb (test_glob_recursive_directory): add a test for above. [ruby-core:91110] [Bug #15540] Modified directories: branches/ruby_2_6/ Modified files: branches/ruby_2_6/dir.c branches/ruby_2_6/test/ruby/test_dir.rb branches/ruby_2_6/version.h Index: ruby_2_6/test/ruby/test_dir.rb =================================================================== --- ruby_2_6/test/ruby/test_dir.rb (revision 66847) +++ ruby_2_6/test/ruby/test_dir.rb (revision 66848) @@ -191,6 +191,20 @@ class TestDir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_6/test/ruby/test_dir.rb#L191 end end + def test_glob_recursive_directory + Dir.chdir(@root) do + ['d', 'e'].each do |path| + FileUtils.mkdir_p("c/#{path}/a/b/c") + FileUtils.touch("c/#{path}/a/a.file") + FileUtils.touch("c/#{path}/a/b/b.file") + FileUtils.touch("c/#{path}/a/b/c/c.file") + end + bug15540 = '[ruby-core:91110] [Bug #15540]' + assert_equal(["c/d/a/", "c/d/a/b/", "c/d/a/b/c/", "c/e/a/", "c/e/a/b/", "c/e/a/b/c/"], + Dir.glob('c/{d,e}/a/**/'), bug15540) + end + end + if Process.const_defined?(:RLIMIT_NOFILE) def test_glob_too_may_open_files assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}", chdir: @root) Index: ruby_2_6/dir.c =================================================================== --- ruby_2_6/dir.c (revision 66847) +++ ruby_2_6/dir.c (revision 66848) @@ -2052,6 +2052,10 @@ join_path_from_pattern(struct glob_patte https://github.com/ruby/ruby/blob/trunk/ruby_2_6/dir.c#L2052 case RECURSIVE: str = "**"; break; + case MATCH_DIR: + /* append last slash */ + str = ""; + break; default: str = p->str; if (!str) continue; Index: ruby_2_6/version.h =================================================================== --- ruby_2_6/version.h (revision 66847) +++ ruby_2_6/version.h (revision 66848) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_6/version.h#L1 #define RUBY_VERSION "2.6.0" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 16 +#define RUBY_PATCHLEVEL 17 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_6 =================================================================== --- ruby_2_6 (revision 66847) +++ ruby_2_6 (revision 66848) Property changes on: ruby_2_6 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66838 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/