[Feature:trunk] Dir instance methods for relative path

e$B$J$+$@$G$9!#e(B

http://www.ipa.go.jp/security/fy20/reports/tech1-tg/2_05.html e$B$re(B
e$B$_$F;W$$=P$7$?$s$G$9$,!“AjBP%Q%9$r;H$&e(BDire$B$N%$%s%9%?%s%9%a%=%C%Ie(B
e$B$O$I$&$G$7$g$&$+!#<BAu$Oe(Bmvme$B%V%i%s%A$K$”$j$^$9!#e(B

$ ./ruby -v -e ‘p Dir.open(“ext”){|d|d.open(“extmk.rb”){|f|f.gets}}’
ruby 1.9.1 (2008-12-25 mvm 20976) [i686-linux]
“#! /usr/local/bin/ruby\n”

$ mkdir tmp
$ touch tmp/x tmp/y
$ ./ruby -e ‘p Dir.open(“tmp”){|d|d.unlink(“x”)}’
0
$ ls tmp/
y

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:39606] [Feature:trunk] Dir instance methods
for relative path”
on Mon, 2 Nov 2009 17:48:13 +0900, Nobuyoshi N.
[email protected] writes:

|http://www.ipa.go.jp/security/fy20/reports/tech1-tg/2_05.html e$B$re(B
|e$B$_$F;W$$=P$7$?$s$G$9$,!“AjBP%Q%9$r;H$&e(BDire$B$N%$%s%9%?%s%9%a%=%C%Ie(B
|e$B$O$I$&$G$7$g$&$+!#<BAu$Oe(Bmvme$B%V%i%s%A$K$”$j$^$9!#e(B

opene$B$,$“$j!“e(Bunlinke$B$,$”$j!”$=$NB>%G%#%l%/%H%j0J2<$N%U%!%$%k$re(B
e$BA`:n$9$k$5$^$6$^$J%a%=%C%I$,$“$k$H$J$k$He(B(e$B$$$/$DDj5A$7$^$7$?e(B
e$B$+!)e(B)e$B!”$J$s$+e(BDire$B$NLr3d$,$$d$1$FMh$^$;$s$+$M$(!#e(B

e$BH?BP$H$$$&$[$I$G$O$J$$$N$G$9$,!#e(B

kosakie$B$G$9e(B

e$B$h$/$o$+$C$F$J$$$N$G$9$,!#e(B

e$BA`:n$9$k$5$^$6$^$J%a%=%C%I$,$"$k$H$J$k$He(B(e$B$$$/$DDj5A$7$^$7$?e(B
e$B$+!)e(B)e$B!"$J$s$+e(BDire$B$NLr3d$,$$d$1$FMh$^$;$s$+$M$(!#e(B

e$BH?BP$H$$$&$[$I$G$O$J$$$N$G$9$,!#e(B

openat()e$B$O%;%-%e%j%F%#E*$J4QE@$+$i!"?d>)$7$F$$$/$Y$-$J$N$G!"e(B
e$B4JC1$K;H$($k$h$&$K$J$k$N$O;?@.$G$9!#e(B

e$B$G$b!">e5-%a!<%k$+$ie(B

open(dir, relative-path)

e$B$H$$$&%a%=%C%I$G%@%a$JM}M3$,$h$/J,$+$j$^$;$s$G$7$?!#2r@b$*4j$$$7$F$be(B
e$B$h$$$G$7$g$&$+!)e(B

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

e$B%9%F!<%?%9e(B Closede$B$+$ie(BOpene$B$KJQ99e(B

e$B$$$&!"@h$Ke(Bduplicatede$B$r$D$1$F$7$^$C$?e(B

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

e$B$J$+$@$G$9!#e(B

At Tue, 3 Nov 2009 00:51:18 +0900,
KOSAKI Motohiro wrote in [ruby-dev:39611]:

e$B$G$b!">e5-%a!<%k$+$ie(B

open(dir, relative-path)

e$B$H$$$&%a%=%C%I$G%@%a$JM}M3$,$h$/J,$+$j$^$;$s$G$7$?!#2r@b$*4j$$$7$F$be(B
e$B$h$$$G$7$g$&$+!)e(B

dire$B$O!"e(BDire$B$+%G%#%l%/%H%j$KBP1~$9$ke(BFilee$B$N%$%s%9%?%s%9$H$$$&$3$H$Ge(B
e$B$9$+e(B?
e$B$=$l$b2DG=$@$H$O;W$$$^$9$,!"e(BDir#to_pathe$B$bDj5A$5$l$k$h$&$Ke(B
e$B$J$C$?$N$G6hJL$,Fq$7$/$J$C$?$s$8$c$J$$$G$7$g$&$+!#e(B

dire$B$O!"e(BDire$B$+%G%#%l%/%H%j$KBP1~$9$ke(BFilee$B$N%$%s%9%?%s%9$H$$$&$3$H$Ge(B
e$B$9$+e(B? e$B$=$l$b2DG=$@$H$O;W$$$^$9$,!"e(BDir#to_pathe$B$bDj5A$5$l$k$h$&$Ke(B
e$B$J$C$?$N$G6hJL$,Fq$7$/$J$C$?$s$8$c$J$$$G$7$g$&$+!#e(B

e$B$&$$!#$J$k$[$I!#e(B

e$BC1=c$J5?Ld$H$7$F!":G=i$K;W$C$?$N$O<+J,$,AjBP%Q%9$G%U%!%$%k$re(B
e$B3+$-$?$$>u67$K$J$C$?$H$-$K!"!V$^$C$5$-$KD4$Y$k$N$,e(BDire$B%/%i%9$Ne(BAPIe$B%j%U%!%l%s%9$+!)!We(B
e$B$H$$$&$He(BNOe$B$@$H;W$C$?$+$i$G$9!#e(B

e$B<+J,$J$i!"!V%U%!%$%k%*!<%W%s!W$C$F$I$&$d$k$s$@$C$1!)$H!";W9M$,F/$/$N$Ge(B

open(dir, relative-path) or
openat(dir, relative-path)

e$B$N$[$&$,!"e(BAPIe$B$K0lH/%R%C%H$G$-$F%J%$%9$+$J$H!#$^$"D>46$J$s$G$9$,!#e(B

e$B$H$3$m$G!"$_$J$5$s$,e(Bopenate$B$,7y$J$N$OL>A0$,%@%5%$$+$i$G$7$g$&$+!)e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:39620] Re: [Feature:trunk] Dir instance
methods for relative path”
on Tue, 3 Nov 2009 12:57:58 +0900, KOSAKI Motohiro
[email protected] writes:

|e$BC1=c$J5?Ld$H$7$F!“:G=i$K;W$C$?$N$O<+J,$,AjBP%Q%9$G%U%!%$%k$re(B
|e$B3+$-$?$$>u67$K$J$C$?$H$-$K!”!V$^$C$5$-$KD4$Y$k$N$,e(BDire$B%/%i%9$Ne(BAPIe$B%j%U%!%l%s%9$+!)!We(B
|e$B$H$$$&$He(BNOe$B$@$H;W$C$?$+$i$G$9!#e(B

e$B$=$&$G$9$h$M$(!#e(B

|e$B<+J,$J$i!“!V%U%!%$%k%*!<%W%s!W$C$F$I$&$d$k$s$@$C$1!)$H!”;W9M$,F/$/$N$Ge(B
|
|open(dir, relative-path) or
|openat(dir, relative-path)
|
|e$B$N$[$&$,!"e(BAPIe$B$K0lH/%R%C%H$G$-$F%J%$%9$+$J$H!#$^$"D>46$J$s$G$9$,!#e(B

e$BCfED$5$s$,$9$G$K;XE&$7$?$h$&$JM}M3$Ge(Bopen(dir, relative-path)
e$B$OFq$7$=$&$G$9!#e(Bopen(relative-path, “rw”, base: dir) e$B$H$+$Je(B
e$B$i2DG=$+$b$7$l$^$;$s$,!"$A$g$C$H>iD9$J5$$b$7$^$9!#e(B

|# e$B$H$3$m$G!"$_$J$5$s$,e(Bopenate$B$,7y$J$N$OL>A0$,%@%5%$$+$i$G$7$g$&$+!)e(B

e$B%@%5$$$H$$$&$+!“e(Bopenatee$B$H$$$&C18l$N>JN,7A$+$H;W$C$F<-=q0z$-$^e(B
e$B$7$?!”:G=i!#$=$s$JC18l$J$$$s$G$9$1$I!#e(Bcreate e$B"*e(B creat
e$B$_$?$$e(B
e$B$J$b$N$+$H;W$C$F!#e(B

In article [email protected],
Nobuyoshi N. [email protected] writes:

http://www.ipa.go.jp/security/fy20/reports/tech1-tg/2_05.html e$B$re(B
e$B$_$F;W$$=P$7$?$s$G$9$,!“AjBP%Q%9$r;H$&e(BDire$B$N%$%s%9%?%s%9%a%=%C%Ie(B
e$B$O$I$&$G$7$g$&$+!#<BAu$Oe(Bmvme$B%V%i%s%A$K$”$j$^$9!#e(B

openat e$B$K$D$$$F$Oe(B Dir e$B$N%$%s%9%?%s%9%a%=%C%I$b0-$/$J$$$H;W$&e(B
e$B$N$G$9$,!“e(Brenameat, linkat e$B$Oe(B Dir
e$B$,$U$?$DI,MW$G$=$&$O$G$-$Je(B
e$B$$$N$G!”$A$g$C$H0l4S@-$,$J$!!#e(B

e$B$J$+$@$G$9!#e(B

At Tue, 3 Nov 2009 23:18:49 +0900,
NARUSE, Yui wrote in [ruby-dev:39625]:

e$B$=$b$=$b!":,K\E*$Ke(B openat e$B$Ne(B API e$B$C$F<BAu$NET9g$,=P2a$.$F$$$^$;$s$+$M!#e(B
C e$B8@8l$N4X?t$J$i$P$H$b$+$/!"e(BRuby e$B$Ne(B API e$B$H$7$F$O!“e(B
e$B$b$&$A$g$C$H%f!<%9%1!<%9%Y!<%9$Ne(B API e$B$K$7$J$$$H;H$o$l$J$$5$$,$7$^$9!#e(B
(e$B;H$&$Y$-?M$,;H$&e(B API e$B$G$$$$$d$H3d$j@Z$k$H$$$&9M$($b$”$k$G$7$g$&$,e(B)

e$B2?$+JL$N%/%i%9$r?7@_$7$?$[$&$,$$$$!"$H$$$&$3$H$G$7$g$&$+!#e(B

./ruby -v -e ‘p open([“ext”, “extmk.rb”]){|f|f.gets}}’
./ruby -v -e ‘p open([dir, “extmk.rb”]){|f|f.gets}}’
e$B$r5v$9$J$ie(B join e$B$N<j4V$,>J$1$k$N$G;H$C$F$/$l$k$+$J$!!#e(B

e$B<j4V$O>J$1$^$9$,!"e(Bsymlink attacke$B$K$OL50UL#$G$9!#e(B

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

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

e$B=EJ#$J$N$GJD$8$^$9e(B

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

e$B@.@%$G$9!#e(B

Yukihiro M. wrote:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:39620] Re: [Feature:trunk] Dir instance methods for relative path”
on Tue, 3 Nov 2009 12:57:58 +0900, KOSAKI Motohiro [email protected] writes:

|e$BC1=c$J5?Ld$H$7$F!“:G=i$K;W$C$?$N$O<+J,$,AjBP%Q%9$G%U%!%$%k$re(B
|e$B3+$-$?$$>u67$K$J$C$?$H$-$K!”!V$^$C$5$-$KD4$Y$k$N$,e(BDire$B%/%i%9$Ne(BAPIe$B%j%U%!%l%s%9$+!)!We(B
|e$B$H$$$&$He(BNOe$B$@$H;W$C$?$+$i$G$9!#e(B

e$B$=$&$G$9$h$M$(!#e(B

e$B$=$b$=$b!":,K\E*$Ke(B openat e$B$Ne(B API
e$B$C$F<BAu$NET9g$,=P2a$.$F$$$^$;$s$+$M!#e(B
C e$B8@8l$N4X?t$J$i$P$H$b$+$/!"e(BRuby e$B$Ne(B API e$B$H$7$F$O!“e(B
e$B$b$&$A$g$C$H%f!<%9%1!<%9%Y!<%9$Ne(B API
e$B$K$7$J$$$H;H$o$l$J$$5$$,$7$^$9!#e(B
(e$B;H$&$Y$-?M$,;H$&e(B API
e$B$G$$$$$d$H3d$j@Z$k$H$$$&9M$($b$”$k$G$7$g$&$,e(B)

e$BNc$K=P$5$l$F$$$k%F%s%]%i%j%G%#%l%/%H%j$N:o=|$K$D$$$F$O!“e(B
e$B$H$j$”$($:$I$C$+$7$i$KMQ0U$7$F!"$=$l$re(B fileutils
e$B$G;H$($P$$$$$N$G$7$g$&$,!"e(B

./ruby -v -e ‘p Dir.open(“ext”){|d|d.open(“extmk.rb”){|f|f.gets}}’
e$B$N>l9g$@$H!“?M9)E*$JNc$r8@$&$N$r:9$70z$$$F$b!“e(B
e$B0lHL$N?M$,;H$C$F$/$l$k$H$O$J$+$J$+9M$($E$i$$$h$&$K46$8$^$9!#e(B
e$B$”$H$O!”$=$N%G%#%l%/%H%j$N2<$Ne(B
d.open(“some_directory”){|dd| …}e$B$b$"$k$J$!$H$+!#e(B

e$B$C$H;W$C$?$1$I!"e(B

./ruby -v -e ‘p open([“ext”, “extmk.rb”]){|f|f.gets}}’
./ruby -v -e ‘p open([dir, “extmk.rb”]){|f|f.gets}}’
e$B$r5v$9$J$ie(B join e$B$N<j4V$,>J$1$k$N$G;H$C$F$/$l$k$+$J$!!#e(B

e$B$3$l0J30$@$H!"e(B__DIR__ e$B$HMm$a$k$H$+$G$9$+$M$'!#e(B

e$B@.@%$G$9!#e(B

Nobuyoshi N. wrote:

At Tue, 3 Nov 2009 23:18:49 +0900,
NARUSE, Yui wrote in [ruby-dev:39625]:

e$B$=$b$=$b!":,K\E*$Ke(B openat e$B$Ne(B API e$B$C$F<BAu$NET9g$,=P2a$.$F$$$^$;$s$+$M!#e(B
C e$B8@8l$N4X?t$J$i$P$H$b$+$/!"e(BRuby e$B$Ne(B API e$B$H$7$F$O!“e(B
e$B$b$&$A$g$C$H%f!<%9%1!<%9%Y!<%9$Ne(B API e$B$K$7$J$$$H;H$o$l$J$$5$$,$7$^$9!#e(B
(e$B;H$&$Y$-?M$,;H$&e(B API e$B$G$$$$$d$H3d$j@Z$k$H$$$&9M$($b$”$k$G$7$g$&$,e(B)

e$B2?$+JL$N%/%i%9$r?7@_$7$?$[$&$,$$$$!"$H$$$&$3$H$G$7$g$&$+!#e(B

e$B$($’!"Nc$($P!“e(BFileinfo
e$B%/%i%9$r:n$j!”?F%G%#%l%/%H%j$N%U%!%$%k%O%s%I%k$He(B
e$B$=$N%G%#%l%/%H%j$+$i$NAjBP%Q%9$r;}$D!#e(B

e$B$G!“Nc$($Pe(B Dir.foreach e$B$J$i0J2<$N$h$&$K;H$&!”$H!#e(B
Dir.foreach("/tmp") do |fileinfo|
fileinfo.open{|f| f.read} if fileinfo.file?
end

./ruby -v -e ‘p open([“ext”, “extmk.rb”]){|f|f.gets}}’
./ruby -v -e ‘p open([dir, “extmk.rb”]){|f|f.gets}}’
e$B$r5v$9$J$ie(B join e$B$N<j4V$,>J$1$k$N$G;H$C$F$/$l$k$+$J$!!#e(B

e$B<j4V$O>J$1$^$9$,!"e(Bsymlink attacke$B$K$OL50UL#$G$9!#e(B

e$B$$$d!"e(Bopen e$BFb$Ge(B join e$B$9$k$N$G$O$J$/$F!"e(B
open e$B$NCf$Ge(B ext e$B$r3+$$$F$+$ie(B openat e$B$Ge(B extmk.rb
e$B$r3+$$$?$j!"e(B
dir e$B$+$ie(B openat e$B$Ge(B extmk.rb e$B$r3+$/$H$$$&OC$G$9!#e(B

e$B8=:_e(B open(File.join(dir, “extmk.rb”)){|f|f.gets}}
e$B$J$I$H=q$$$F$$$k$H$3$m$r!“e(B
open([dir, “extmk.rb”])
e$B$H=q$/$h$&$K$5$;$k!”$@$H<u$1F~$l$d$9$$$+$J$H!#e(B

In article [email protected],
“NARUSE, Yui” [email protected] writes:

e$B$=$b$=$b!":,K\E*$Ke(B openat e$B$Ne(B API e$B$C$F<BAu$NET9g$,=P2a$.$F$$$^$;$s$+$M!#e(B
C e$B8@8l$N4X?t$J$i$P$H$b$+$/!"e(BRuby e$B$Ne(B API e$B$H$7$F$O!“e(B
e$B$b$&$A$g$C$H%f!<%9%1!<%9%Y!<%9$Ne(B API e$B$K$7$J$$$H;H$o$l$J$$5$$,$7$^$9!#e(B
(e$B;H$&$Y$-?M$,;H$&e(B API e$B$G$$$$$d$H3d$j@Z$k$H$$$&9M$($b$”$k$G$7$g$&$,e(B)

e$BNI$/;H$&$b$N$K:GE,2=$7$?e(B API e$B$O$b$A$m$s=EMW$G$9$,!"$G$-$k$3e(B
e$B$H$r$J$s$G$b$G$-$ke(B API e$B$b$^$?=EMW$G$9!#e(B

e$B$J$s$G$b$G$-$k$N$KNI$/;H$&$b$N$K:GE,2=$7$F$“$k!”$H$$$&$N$,$$e(B
e$B$A$P$s$G$9$,!#e(B

In article [email protected],
“NARUSE, Yui” [email protected] writes:

./ruby -v -e ‘p open([“ext”, “extmk.rb”]){|f|f.gets}}’
./ruby -v -e ‘p open([dir, “extmk.rb”]){|f|f.gets}}’
e$B$r5v$9$J$ie(B join e$B$N<j4V$,>J$1$k$N$G;H$C$F$/$l$k$+$J$!!#e(B

e$B<j4V$O>J$1$^$9$,!"e(Bsymlink attacke$B$K$OL50UL#$G$9!#e(B

e$B$$$d!"e(Bopen e$BFb$Ge(B join e$B$9$k$N$G$O$J$/$F!"e(B
open e$B$NCf$Ge(B ext e$B$r3+$$$F$+$ie(B openat e$B$Ge(B extmk.rb e$B$r3+$$$?$j!"e(B
dir e$B$+$ie(B openat e$B$Ge(B extmk.rb e$B$r3+$/$H$$$&OC$G$9!#e(B

symlink attack e$B$rKI$0$?$a$K$Oe(B ext e$B$r3+$$$?7k2L$,0U?^$7$?$b$Ne(B
e$B$G$“$k$3$H$r3NG’$7$J$$$H$$$1$J$$$N$G!”$=$&$$$&OC$J$i%;%-%e%je(B
e$B%F%#E*$J8z2L$O$"$j$^$;$s$M!#e(B

e$BG[Ns$NBh0lMWAG$,e(B Dir (e$B$de(B IO) e$B$N$H$-$K!“$=$Ne(B fd
e$B$re(B openat e$B$Ne(B
dirfd e$B$KEO$9$H$$$&OC$J$i%;%-%e%j%F%#E*$J0UL#$O$”$k$H;W$$$^$9!#e(B

e$B$^$!!“$=$NG[Ns$N7A<0$Oe(B pathname e$B$KAGD>$KF~$l$i$l$J$$$H$$$&Lde(B
e$BBj$,$”$k$s$G$9$,!"$=$l$r=|$1$P0-$/$O$J$$$H;W$$$^$9!#e(B

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

e$B$$$m$$$m9M$($k$H!“$3$N!”$$$^$^$G%Q%9L>$r<u$1IU$1$F$$$?$H$3$m$Ke(B
[dir, str] e$B$H$$$&e(B 2e$BMWAG$NG[Ns$r<u$1IU$1$k$H$$$&$N$,$$$$$s$8$ce(B
e$B$J$$$G$9$+$M!#e(B

e$B$3$l$O$3$l$G$J$s$G$b$G$-$ke(B API e$B$H$7$FNI$$$N$G$9$,!“$R$H$D9Me(B
e$B$($i$l$k0[$J$k7A$Ne(B API e$B$H$7$F$O!”%o!<%-%s%0%G%#%l%/%H%j$r%9e(B
e$B%l%C%IKh$K$7$F$7$^$&!“$H$$$&$b$N$,$”$k$+$b$7$l$^$;$s!#e(B

e$B$?$@!"%a%=%C%I$H$+$N7A<0$r$<$s$<$sJQ$($J$$$G$=$&$7$F$7$^$&$H!“e(B
e$B$=$l$r<B8=$G$-$J$$4D6-$G$I$&$7$?$i$$$$$N$+Ff$G$O$”$j$^$9!#e(B

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

e$BG[Ns$NBh0lMWAG$,e(B Dir (e$B$de(B IO) e$B$N$H$-$K!“$=$Ne(B fd e$B$re(B openat e$B$Ne(B
dirfd e$B$KEO$9$H$$$&OC$J$i%;%-%e%j%F%#E*$J0UL#$O$”$k$H;W$$$^$9!#e(B

e$B$$$m$$$m9M$($k$H!“$3$N!”$$$^$^$G%Q%9L>$r<u$1IU$1$F$$$?$H$3$m$Ke(B
[dir, str] e$B$H$$$&e(B
2e$BMWAG$NG[Ns$r<u$1IU$1$k$H$$$&$N$,$$$$$s$8$ce(B
e$B$J$$$G$9$+$M!#e(B

  • e$B%a%=%C%I$rA}$d$5$J$$$N$G3P$($k$3$H$,>/$J$$e(B

  • File.rename e$B$He(B File.link e$B$bF1$8J}?K$G07$($k$N$G3P$($k$3$He(B
    e$B$,>/$J$$e(B
    (renameat e$B$He(B linkat e$B$O%G%#%l%/%H%j$r$U$?$D;XDj$G$-$k$N$Ge(B
    Dir e$B$N%$%s%9%?%s%9%a%=%C%I$H$$$&7A$G$O07$($J$$e(B)

  • to_path e$B$NJV$jCM$be(B [dir, str] e$B$r<u$1IU$1$k$h$&$K$9$l$Pe(B
    Pathname e$B$b07$($ke(B
    (Pathname e$B$Oe(B dir e$B$b5-O?$G$-$k$h$&$K3HD%$7!"e(B
    Pathname#to_path e$B$,e(B [dir, str] e$B$rJV$9e(B)

e$B35G0E*$J$3$H$r$$$&$H!"%Q%9L>$H$$$&$N$,%U%!%$%k%7%9%F%Fb$G%U%!e(B e$B%$%k$rF1Dj$9$k$b$N$H$9$k$H!"AjBP%Q%9$O$$7$m$=$lC1FH$G$OIT40e(B
e$BA4$J$b$N$G$9!#$=$N>l9g!“5/E@$H$J$ke(B Dir e$B$HBP$K$7$?$[$&$,0U?^e(B
e$B$r3N<B$KI=8=$G$-$k$N$G!”$=$NBP$r$R$H$^$H$^$j$H$7$F07$C$?$[$&e(B
e$B$,0U?^$;$6$k$3$H$,5/$-$K$/$$!"0BDj$7$?%W%m%0%i%`$r=q$-$d$9$/e(B
e$B$J$k$G$7$g$&!#e(B

e$B7gE@$O!"5!G=$NM-L5$re(B respond_to? e$B$G$OH=Dj$G$-$J$$$H$3$m$G$9e(B
e$B$+$M!#%a%=%C%I$,A}$($J$$$N$G!#e(B

e$B$"$H$Oe(B dir e$B$,e(B close e$B$5$l$k$H$=$Ne(B dir e$B$r4^$`e(B
Pathname e$B$,;H$(e(B
e$B$J$/$J$k$3$H$+$J!#$=$l$O$^$!$=$&$$$&$b$N$@$H$$$&$3$H$G!#e(B

e$B$J$!"e(Bopenat e$BEy$,$J$$4D6-$K$D$$$F$O!"e(Brenameat e$B$He(B
linkat e$B$r=|e(B
e$B$1$P!“e(Bfchdir e$B$He(B GVL
e$B$,$”$l$P$=$l$J$j$K$I$&$K$+$J$k$N$G$O$J$$e(B
e$B$+$H;W$$$^$9!#e(B(fchdir e$B$G0l;~E
$K%+%l%s%H%G%#%l%/%H%j$rJQ$($Fe(B
e$B$7$F%7%9%F%`%3!<%k$rH/9T$9$k!#e(BGVL e$B$K$h$jB>$N%9%l%C%I$,e(B chdir
e$B$9$k2DG=@-$,$J$1$l$P!"$3$l$O0BA4$J$O$:$G$9e(B)