From 7751b12e97561ae1aff1f85b047ebae1b7cdc84a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 8 Apr 2024 18:29:13 +0900 Subject: [PATCH] Display the offending parent path in the exception --- lib/tmpdir.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index 65c86e9..fe3e0e1 100644 --- a/lib/tmpdir.rb +++ b/lib/tmpdir.rb @@ -107,9 +107,10 @@ def self.mktmpdir(prefix_suffix=nil, *rest, **options) yield path.dup ensure unless base - stat = File.stat(File.dirname(path)) + base = File.dirname(path) + stat = File.stat(base) 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 FileUtils.remove_entry path