summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-06-27 12:29:42 +0900
committernagachika <nagachika@ruby-lang.org>2020-06-27 12:29:42 +0900
commit799c5766a4dc215d139d2c26ac68636f43a64fbf (patch)
tree03f4330b6617fde2167ad398b18047b19c399b3e /lib
parentd8a32b146561a0ddd3e60da9863a082b7e7725db (diff)
merge revision(s) a19228f878d955eaf2cce086bcf53f46fdf894b9: [Backport #16979]
brace the fact that lchmod(2) can EOPNOTSUPP Musl libc has this function as a tiny wrapper of fchmodat(3posix). On the other hand Linux kernel does not support changing modes of a symlink. The operation always fails with EOPNOTSUPP. This fchmodat behaviour is defined in POSIX. We have to take care of such exceptions.
Diffstat (limited to 'lib')
-rw-r--r--lib/fileutils.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index a7ad65ae5e..04788e26ca 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -1345,6 +1345,7 @@ module FileUtils
else
File.chmod mode, path()
end
+ rescue Errno::EOPNOTSUPP
end
def chown(uid, gid)
@@ -1439,7 +1440,7 @@ module FileUtils
if st.symlink?
begin
File.lchmod mode, path
- rescue NotImplementedError
+ rescue NotImplementedError, Errno::EOPNOTSUPP
end
else
File.chmod mode, path