Project

General

Profile

Actions

Bug #6715

closed

Dir.mktmpdir fails if you delete it yourself

Added by mitchellh (Mitchell Hashimoto) over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
1.9.3-p125
Backport:
[ruby-core:46290]

Description

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.

Updated by akr (Akira Tanaka) over 11 years ago

2012/7/10 mitchellh (Mitchell Hashimoto) :

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.

Tanaka Akira

Updated by akr (Akira Tanaka) over 11 years ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0