Forum: Ruby-core [ruby-trunk - Bug #6715][Open] Dir.mktmpdir fails if you delete it yourself

Posted by Mitchell Hashimoto (mitchellh)
on 2012-07-10 04:13
(Received via mailing list)
Issue #6715 has been reported by mitchellh (Mitchell Hashimoto).

----------------------------------------
Bug #6715: Dir.mktmpdir fails if you delete it yourself
https://bugs.ruby-lang.org/issues/6715

Author: mitchellh (Mitchell Hashimoto)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.3-p125


Dir.mktmpdir when given a block will call `FileUtil.remove_entry_secure` 
in the ensure section. If the contents of the block happens to 
move/delete/modify that folder, then that will fail with Errno::ENOENT. 
I believe the correct behavior in this case should be to successfully 
return, since the folder is clearly gone in some way.
Posted by Tanaka Akira (Guest)
on 2012-07-10 04:22
(Received via mailing list)
2012/7/10 mitchellh (Mitchell Hashimoto) <mitchell.hashimoto@gmail.com>:

> Dir.mktmpdir when given a block will call `FileUtil.remove_entry_secure` in the 
ensure section. If the contents of the block happens to move/delete/modify that 
folder, then that will fail with Errno::ENOENT. I believe the correct behavior in 
this case should be to successfully return, since the folder is clearly gone in 
some way.

I think such application may remove another application's temporary
directory unintentionally.

After you remove the directory, another application may create a
directory with same name.
Then Dir.mktmpdir {} removes that.

If an application itself removes a temporary directory, Dir.mktmpdir
without a block should be used.
It avoids the problem above because Dir.mktmpdir without a block
doesn't remove the directory anyway.
Posted by akr (Akira Tanaka) (Guest)
on 2012-07-14 11:25
(Received via mailing list)
Issue #6715 has been updated by akr (Akira Tanaka).

Status changed from Open to Rejected


----------------------------------------
Bug #6715: Dir.mktmpdir fails if you delete it yourself
https://bugs.ruby-lang.org/issues/6715#change-28078

Author: mitchellh (Mitchell Hashimoto)
Status: Rejected
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.3-p125


Dir.mktmpdir when given a block will call `FileUtil.remove_entry_secure` 
in the ensure section. If the contents of the block happens to 
move/delete/modify that folder, then that will fail with Errno::ENOENT. 
I believe the correct behavior in this case should be to successfully 
return, since the folder is clearly gone in some way.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.