e$B;38}$H?=$7$^$9!#e(B
tempfile.rb e$B$K$$1$ke(B Tempfile#path (@tmpname)
e$B$NCM$re(BTempfilee$B%%V%8%’%/%H:[email protected];~$Ke(B freeze
e$B$9$k$?$a$N%Q%C%A$rEj9FCW$7$^$9!#e(B
e$B8=:_e(B 1.8, 1.9 e$B6&$Ke(B tempfile.rb e$B$K$*$1$ke(B Tempfile#path
(@tmpname) e$B$NCM$Oe(B freeze
e$B$5$l$F$$$^$;$s!#$3$N$?$a!"e(B
- e$B4D6-JQ?te(B TMP e$BEy$,@_Dj$5$l$F$$$k$3$He(B
e$B%;!<%U%l%Y%ke(B0e$B$Ge(BTempfilee$B%*%V%8%’%/%H$,:[email protected]$5$l$F$$$k$3$He(B
[email protected]$r>r7o$H$7$F!"%;!<%U%l%Y%ke(B4e$B4D6-$+$iG$0U$N%U%!%$%k$r:o=|[email protected]$,$"$j$^$9!#e(B
$SAFE = 0
require “tempfile”
tmp = Tempfile.new(“test”)
Thread.new do
$SAFE = 4
eval(‘tmpfile.path.replace(“hello.txt”)’)
end.join
=> removing hello.txt…done
e$B$3$l$O%;!<%U%l%Y%ke(B4e$B4D6-$rF3F~$9$k0JA0$Ke(B tmpfile.path.freeze
e$B$r9T$J$&$3$H$G4JC1$KKI$0$3$H$,=PMh$k$N$G$9$,!“e(Btmpfile.path
e$B$NCM$,JQ992DG=$G$”[email protected]$O$J$$$H;W$o$l$^$9$N$G!"e(BTempfile
e$B%%V%8%’%/%H$,:[email protected]$5$l$?;[email protected]$Ge(B @tmpname e$B$re(B freeze
e$B$7$F$$$$?J}$,NI$$$H9M$($^$9!#$$$+$,$G$7$g$&$+!#e(B
Index: lib/tempfile.rb
— lib/tempfile.rb (revision 17564)
+++ lib/tempfile.rb (working copy)
@@ -40,6 +40,7 @@
begin
tmpname = File.join(tmpdir, make_tmpname(basename, n))
-
lock = tmpname + ‘.lock’tmpname.freeze
n += 1
end while @@cleanlist.include?(tmpname) or
e$BKL3$F;Bg3XBg3X1!J83X8&[email protected]&5f0we(B
e$B;38}[email protected](B
[email protected]