1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
aamine 2004-05-07 12:04:19 +00:00
parent 58860e0d64
commit 876aa19435
3 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Fri May 7 21:03:51 2004 Minero Aoki <aamine@loveruby.net>
* 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 <ocean@m2.ccsnet.ne.jp> Fri May 7 11:17:27 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* util.c (ruby_strtod): 0.0000000000000000001 == 0.0 should be false. * util.c (ruby_strtod): 0.0000000000000000001 == 0.0 should be false.

View file

@ -717,7 +717,7 @@ module FileUtils
end end
def fu_list(arg) def fu_list(arg)
Array(arg).map {|path| File.path(path) } [arg].flatten.map {|path| File.path(path) }
end end
def fu_each_src_dest(src, dest) def fu_each_src_dest(src, dest)

View file

@ -51,6 +51,18 @@ def have_hardlink?
HAVE_HARDLINK HAVE_HARDLINK
end 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.chdir prevdir
Dir.rmdir tmproot Dir.rmdir tmproot
@ -532,6 +544,12 @@ end
assert_equal 0700, (File.stat('tmp/tmp').mode & 0777) if have_file_perm? assert_equal 0700, (File.stat('tmp/tmp').mode & 0777) if have_file_perm?
Dir.rmdir 'tmp/tmp' 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 # pathname
assert_nothing_raised { assert_nothing_raised {
mkdir Pathname.new('tmp/tmpdirtmp') mkdir Pathname.new('tmp/tmpdirtmp')