[Ruby 1.9 - Bug #272] (Open) test_chdir failed when Dir.tmpdir is symlink

e$B%A%1%C%He(B #272 e$B$,Js9p$5$l$^$7$?!#e(B (by Kazuhiro NISHIYAMA)


Bug #272: test_chdir failed when Dir.tmpdir is symlink
http://redmine.ruby-lang.org/issues/show/272

e$B5/I<<Te(B: Kazuhiro NISHIYAMA
e$B%9%F!<%?%9e(B: Open
e$BM%@hEYe(B: Normal
e$BC4Ev<Te(B:
e$B%+%F%4%je(B:
Target version:

Dir.tmpdire$B$,JV$9%G%#%l%/%H%j$,e(Bsymlinke$B$N$H$-$Ke(Btest_chdire$B$,<:GT$7$^$9!#e(B

% ln -s /tmp $HOME/symlink-tmpdir
% env TMPDIR=$HOME/symlink-tmpdir ruby-trunk -v test/ruby/test_dir.rb
ruby 1.9.0 (2008-07-14 revision 18060) [i686-linux]
Loaded suite test/ruby/test_dir
Started
.test/ruby/test_dir.rb:111: warning: conflicting chdir during another
chdir block
F…
Finished in 0.0631458779999999 seconds.

  1. Failure:
    test_chdir(TestDir)
    [test/ruby/test_dir.rb:112:in block in test_chdir' test/ruby/test_dir.rb:109:inchdir’
    test/ruby/test_dir.rb:109:in `test_chdir’]:
    <"/home/kazu/symlink-tmpdir/__test_dir__20080714-13467-1l19gzu">
    expected but was
    <"/tmp/__test_dir__20080714-13467-1l19gzu">.

12 tests, 78 assertions, 1 failures, 0 errors

[email protected]>;3OB9-$G$9!#e(B

At Mon, 14 Jul 2008 17:54:40 +0900,
Kazuhiro NISHIYAMA wrote:

Dir.tmpdire$B$,JV$9%G%#%l%/%H%j$,e(Bsymlinke$B$N$H$-$Ke(Btest_chdire$B$,<:GT$7$^$9!#e(B

test_execopts_chdir(TestProcess)e$B$bF1MM$K<:GT$7$^$9!#e(B

Pathname#realpathe$B$r;H$($P2r7h$9$k$h$&$G$9$,!"e(B
e$B$3$&$$$&2r7hJ}K!$GNI$$$N$G$7$g$&$+e(B?

Index: test/ruby/test_dir.rb

— test/ruby/test_dir.rb (revision 18104)
+++ test/ruby/test_dir.rb (working copy)
@@ -2,11 +2,12 @@ require ‘test/unit’

require ‘tmpdir’
require ‘fileutils’
+require ‘pathname’

class TestDir < Test::Unit::TestCase

def setup

  • @root = Dir.mktmpdir(‘test_dir’)
  • @root = Pathname.new(Dir.mktmpdir(‘test_dir’)).realpath.to_s
    @nodir = File.join(@root, “dummy”)
    for i in ?a…?z
    if i.ord % 2 == 0
    Index: test/ruby/test_process.rb
    ===================================================================
    — test/ruby/test_process.rb (revision 18104)
    +++ test/ruby/test_process.rb (working copy)
    @@ -1,5 +1,6 @@
    require ‘test/unit’
    require ‘tmpdir’
    +require ‘pathname’
    require_relative ‘envutil’

class TestProcess < Test::Unit::TestCase
@@ -21,6 +22,7 @@ class TestProcess < Test::Unit::TestCase

def with_tmpchdir
Dir.mktmpdir {|d|

  •  d = Pathname.new(d).realpath.to_s
     Dir.chdir(d) {
       yield d
     }

e$B%A%1%C%He(B #272 e$B$,99?7$5$l$^$7$?!#e(B (by Anonymous)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r18153.

http://redmine.ruby-lang.org/issues/show/272

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs