[ruby/tmpdir] Display the offending parent path in the exception

https://github.com/ruby/tmpdir/commit/7751b12e97
This commit is contained in:
Nobuyoshi Nakada 2024-04-08 18:29:13 +09:00 committed by git
parent 76efed65bd
commit 8217fbf4bd

View File

@ -107,9 +107,10 @@ class Dir
yield path.dup yield path.dup
ensure ensure
unless base unless base
stat = File.stat(File.dirname(path)) base = File.dirname(path)
stat = File.stat(base)
if stat.world_writable? and !stat.sticky? if stat.world_writable? and !stat.sticky?
raise ArgumentError, "parent directory is world writable but not sticky" raise ArgumentError, "parent directory is world writable but not sticky: #{base}"
end end
end end
FileUtils.remove_entry path FileUtils.remove_entry path