From 876aa19435d43da902ccfe6768342a613b72851a Mon Sep 17 00:00:00 2001 From: aamine Date: Fri, 7 May 2004 12:04:19 +0000 Subject: [PATCH] * lib/fileutils.rb (fu_list): Array() breaks pathes including "\n". [ruby-core:02843] * test/fileutils/test_fileutils.rb (mkdir): test "\n" in path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/fileutils.rb | 2 +- test/fileutils/test_fileutils.rb | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1463e25a53..8374f60cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri May 7 21:03:51 2004 Minero Aoki + + * lib/fileutils.rb (fu_list): Array() breaks pathes including "\n". + [ruby-core:02843] + + * test/fileutils/test_fileutils.rb (mkdir): test "\n" in path. + Fri May 7 11:17:27 Hirokazu Yamamoto * util.c (ruby_strtod): 0.0000000000000000001 == 0.0 should be false. diff --git a/lib/fileutils.rb b/lib/fileutils.rb index c15478ca1b..58513b2f87 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -717,7 +717,7 @@ module FileUtils end def fu_list(arg) - Array(arg).map {|path| File.path(path) } + [arg].flatten.map {|path| File.path(path) } end def fu_each_src_dest(src, dest) diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 6d8810b8f8..950e20499c 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -51,6 +51,18 @@ def have_hardlink? HAVE_HARDLINK end +begin + Dir.mkdir("\n") + Dir.rmdir("\n") + def lf_in_path_allowed? + true + end +rescue + def lf_in_path_allowed? + false + end +end + Dir.chdir prevdir Dir.rmdir tmproot @@ -532,6 +544,12 @@ end assert_equal 0700, (File.stat('tmp/tmp').mode & 0777) if have_file_perm? Dir.rmdir 'tmp/tmp' +if lf_in_path_allowed? + mkdir "tmp-first-line\ntmp-second-line" + assert_directory "tmp-first-line\ntmp-second-line" + Dir.rmdir "tmp-first-line\ntmp-second-line" +end + # pathname assert_nothing_raised { mkdir Pathname.new('tmp/tmpdirtmp')