File exists - /tmp/bootstraptest.tmpwd

e$B$R$H$D$N%^%7%s$G!"$"$k%f!<%6$,e(B btest e$B$7$?8e!"B>$N%f!<%6$,e(B
btest e$B$9$k$H!"0J2<$N$h$&$J%(%i!<$K$J$j$^$9!#e(B

$ make btest
ruby “./bootstraptest/runner.rb” --ruby="./miniruby "
Mon Aug 13 12:59:14 +0900 2007
Driver is ruby 1.8.5 (2006-08-25) [i486-linux]
Target is ruby 1.9.0 (2007-08-13 patchlevel 0) [i686-linux]

./bootstraptest/runner.rb:157:in mkdir': File exists - /tmp/bootstraptest.tmpwd (Errno::EEXIST) from ./bootstraptest/runner.rb:157:inin_temporary_working_directory’
from ./bootstraptest/runner.rb:71:in `main’
from ./bootstraptest/runner.rb:178

/tmp/bootstraptest.tmpwd e$B$H$$$&%G%#%l%/%H%j$,;D$C$F$$$k$?$ae(B
e$B$N$h$&$G$9!#e(B

e$B!!$5$5$@$G$9!#e(B

Tanaka A. wrote:

e$B$R$H$D$N%^%7%s$G!"$"$k%f!<%6$,e(B btest e$B$7$?8e!"B>$N%f!<%6$,e(B
btest e$B$9$k$H!"0J2<$N$h$&$J%(%i!<$K$J$j$^$9!#e(B

e$B!!=*$o$C$?$i>C$9!"$H$$$&$N$,$$$$$s$G$7$g$&$+!#e(B

In article [email protected],
SASADA Koichi [email protected] writes:

e$B$R$H$D$N%^%7%s$G!“$”$k%f!<%6$,e(B btest e$B$7$?8e!"B>$N%f!<%6$,e(B
btest e$B$9$k$H!"0J2<$N$h$&$J%(%i!<$K$J$j$^$9!#e(B

e$B!!=*$o$C$?$i>C$9!"$H$$$&$N$,$$$$$s$G$7$g$&$+!#e(B

e$B$=$l$@$1$HB>$N%f!<%6$,e(B btest e$B$7$F$$$k:GCf$K$Oe(B btest
e$B$G$-$^$;e(B
e$B$s$h$M!#e(B

e$BIaDL$N%F%s%]%i%j%U%!%$%k$N47=,$I$*$j$KL>A0$rKh2sJQ$($F=E$J$ie(B
e$B$J$$$h$&$K$7$?$i$$$$$H;W$&$s$G$9$,!#e(B

e$B$^$!!"%F%s%]%i%j$J%G%#%l%/%H%j$r:n$k%i%$%V%i%j$,M_$7$$$H$O;We(B
e$B$$$^$9$1$l$I!#e(B

e$B$5$H$&$U$_$d$9e(B @ OSS e$B%F%/%N%m%8$G$9!#e(B

At Thu, 16 Aug 2007 01:47:27 +0900,
Tanaka A. wrote:

e$B$H$$$&$+!“e(BFileUtils.rm_rf e$B$Ge(B /tmp/bootstraptest.tmpwd e$B$r>C$9e(B
e$B$N$C$F!”%;%-%e%j%F%#E*$KLdBj$,$"$j$^$9$h$M!#e(B

/tmp/bootstraptest.tmpwd e$B0J2<e(B (/tmp/bootstraptest.tmpwd
e$B$b4^$`e(B)
e$B$KB>?Me(B (e$B?.Mj$G$-$J$$%f!<%6!<e(B)
e$B$,=q$-9~$a$k%G%#%l%/%H%j$,e(B
e$B$J$1$l$P%;%-%e%j%F%#$NLdBj$OH/@8$7$^$;$s!#e(B

e$B$^$?!"!Ve(Brm_rfe$B!W$H$$$&L>A0$+$iA[A|$9$k$Ke(B
(e$B<BAu$O8+$F$^$;$se(B)e$B!"e(B
e$B%7%s%%j%C%/%j%s%/$OC)$i$J$$$N$G$O$J$$$+$H;W$($k$N$G$9$,!"e(B
e$B0c$&$N$G$7$g$&$+e(B?

$ cd /tmp
$ mkdir test-symlink-target
$ touchtest-symlink-target/test-file
$ ln -s test-symlink-target test-symlink
$ ls test-*
test-symlink:
test-file

test-symlink-target:
test-file
$ rm -rf test-symlink
$ ls test-*
test-file

(FileUtils.rm_rf e$B$NLdBj$K4X$7$F$Oe(B
http://www.ruby-lang.org/ja/man/?cmd=view;name=fileutils e$B$Ke(B
e$B$$$/$i$+5-:$,$"$j$^$9!#e(B)

/tmp e$B$O$U$D$&e(B sticky bit e$B$,$D$$$F$$$k$N$G!"B>?M$Ne(B
e$B%U%!%$%k$d%G%#%l%/%H%j$r%j%M!<%`$7$?$j:o=|$G$-$J$$$N$Ge(B
e$B0BA4$G$9!#e(B

In article [email protected],
Tanaka A. [email protected] writes:

e$BIaDL$N%F%s%]%i%j%U%!%$%k$N47=,$I$*$j$KL>A0$rKh2sJQ$($F=E$J$ie(B
e$B$J$$$h$&$K$7$?$i$$$$$H;W$&$s$G$9$,!#e(B

e$B$H$$$&$o$1$G!"$3$&$$$&$h$&$Ke(B Dir.mktmpdir
e$B$r;H$&$N$O$I$&$G$7$ge(B
e$B$&$+!#e(B

e$B$H$$$&$+!“e(BFileUtils.rm_rf e$B$Ge(B /tmp/bootstraptest.tmpwd
e$B$r>C$9e(B
e$B$N$C$F!”%;%-%e%j%F%#E*$KLdBj$,$"$j$^$9$h$M!#e(B

(FileUtils.rm_rf e$B$NLdBj$K4X$7$F$Oe(B
http://www.ruby-lang.org/ja/man/?cmd=view;name=fileutils e$B$Ke(B
e$B$$$/$i$+5-:$,$"$j$^$9!#e(B)

Index: bootstraptest/runner.rb

— bootstraptest/runner.rb (e$B%j%S%8%g%se(B 12943)
+++ bootstraptest/runner.rb (e$B:n6H%3%T!<e(B)
@@ -16,7 +16,7 @@
def main
@ruby = File.expand_path(‘miniruby’)
@verbose = false

  • dir = File.join(Dir.tmpdir, ‘bootstraptest.tmpwd’)
  • dir = nil
    quiet = false
    tests = nil
    ARGV.delete_if {|arg|
    @@ -176,11 +176,19 @@
    end

def in_temporary_working_directory(dir)

  • FileUtils.rm_rf dir
  • Dir.mkdir dir
  • Dir.chdir(dir) {
  • yield
  • }
  • if dir
  • FileUtils.rm_rf dir
  • Dir.mkdir dir
  • Dir.chdir(dir) {
  •  yield
    
  • }
  • else
  • Dir.mktmpdir {|d|
  •  Dir.chdir(d) {
    
  •    yield
    
  •  }
    
  • }
  • end
    end

def cleanup_coredump

In article [email protected],
Tanaka A. [email protected] writes:

http://www.ruby-lang.org/ja/man/?cmd=view;name=fileutils e$B$Ke(B
e$B$$$/$i$+5-:$,$"$j$^$9!#e(B)

e$B$&$%$`!#e(Bbootstraptest e$B$O0c$&e(B ruby
e$B$G<B9T$5$l$k$3$H$,$"$k$+$i!“e(B
Dir.mktmpdir e$B$,$”$k$H$O8B$i$J$$$G$9$M!#e(B

e$B$H$9$k$H!“$J$$$H$-$O<+A0$GDj5A$9$k$3$H$K$7$F!”$3$&$G$7$g$&$+!#e(B

Index: bootstraptest/runner.rb

— bootstraptest/runner.rb (e$B%j%S%8%g%se(B 12943)
+++ bootstraptest/runner.rb (e$B:n6H%3%T!<e(B)
@@ -13,10 +13,38 @@
retry
end

+if !Dir.respond_to?(:mktmpdir)

  • copied from lib/tmpdir.rb

  • def Dir.mktmpdir(prefix=“d”, tmpdir=nil)
  • tmpdir ||= Dir.tmpdir
  • t = Time.now.strftime(“%Y%m%d”)
  • n = nil
  • begin
  •  path = 
    

“#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}”

  •  path << "-#{n}" if n
    
  •  Dir.mkdir(path, 0700)
    
  • rescue Errno::EEXIST
  •  n ||= 0
    
  •  n += 1
    
  •  retry
    
  • end
  • if block_given?
  •  begin
    
  •    yield path
    
  •  ensure
    
  •    FileUtils.remove_entry_secure path
    
  •  end
    
  • else
  •  path
    
  • end
  • end
    +end

def main
@ruby = File.expand_path(‘miniruby’)
@verbose = false

  • dir = File.join(Dir.tmpdir, ‘bootstraptest.tmpwd’)
  • dir = nil
    quiet = false
    tests = nil
    ARGV.delete_if {|arg|
    @@ -176,11 +204,19 @@
    end

def in_temporary_working_directory(dir)

  • FileUtils.rm_rf dir
  • Dir.mkdir dir
  • Dir.chdir(dir) {
  • yield
  • }
  • if dir
  • FileUtils.rm_rf dir
  • Dir.mkdir dir
  • Dir.chdir(dir) {
  •  yield
    
  • }
  • else
  • Dir.mktmpdir(“bootstraptest.tmpwd”) {|d|
  •  Dir.chdir(d) {
    
  •    yield
    
  •  }
    
  • }
  • end
    end

def cleanup_coredump

In article [email protected],
SATOH Fumiyasu [email protected] writes:

e$B$H$$$&$+!“e(BFileUtils.rm_rf e$B$Ge(B /tmp/bootstraptest.tmpwd e$B$r>C$9e(B
e$B$N$C$F!”%;%-%e%j%F%#E*$KLdBj$,$"$j$^$9$h$M!#e(B

/tmp/bootstraptest.tmpwd e$B0J2<e(B (/tmp/bootstraptest.tmpwd e$B$b4^$`e(B)
e$B$KB>?Me(B (e$B?.Mj$G$-$J$$%f!<%6!<e(B) e$B$,=q$-9~$a$k%G%#%l%/%H%j$,e(B
e$B$J$1$l$P%;%-%e%j%F%#$NLdBj$OH/@8$7$^$;$s!#e(B

e$BE:IU$7$?%Q%C%Ae(B (e$B$J$$$7$Oe(B bootstraptest/runner.rb)
e$B$rFI$s$G$$e(B
e$B$?$@$1$l$PJ,$+$k$H;W$$$^$9$,!“8=:_$N%3!<%I$O!”:G=i$K$H$K$+$/e(B
/tmp/bootstraptest.tmpwd e$B$r:o=|$9$k!"$H$$$&$b$N$K$J$C$F$$$^e(B
e$B$9!#e(B

e$B$D$^$j!“<+J,$,:n@.$7$?$N$G$J$/!“B>?M$,$”$i$+$8$a:n@.$7$?%G%#e(B
e$B%l%/%H%j$r:o=|$7$h$&$H$9$k2DG=@-$,$”$j$^$9!#e(B

e$B$^$?!"!Ve(Brm_rfe$B!W$H$$$&L>A0$+$iA[A|$9$k$Ke(B (e$B<BAu$O8+$F$^$;$se(B)e$B!"e(B
e$B%7%s%%j%C%/%j%s%/$OC)$i$J$$$N$G$O$J$$$+$H;W$($k$N$G$9$,!"e(B
e$B0c$&$N$G$7$g$&$+e(B?

e$B$?$I$i$J$$$h$&EXNO$7$F$$$k$H$O;W$$$^$9$,!“%7%s%%j%C%/%j%s%/e(B
e$B$8$c$J$$$H;W$C$?=V4V%7%s%%j%C%/%j%s%/$K$9$jJQ$o$k2DG=@-$,e(B
e$B$”$k!"$H$$$&$N$,e(B TOCTTOU e$B@H<e@-$G$7$g$&!#e(B