summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-02 11:23:42 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-02 11:23:42 +0000
commit82019f272dff1990e7a273125a8414d056f6306d (patch)
tree4e5c2b970690abbe61eba9a9f6ec0c5eea04c0d4 /lib
parentdad70fa6a85990f61ec76a62456fde153e093af4 (diff)
merge revision(s) a19228f8: [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. --- lib/fileutils.rb | 3 ++- test/pathname/test_pathname.rb | 2 +- test/ruby/test_notimp.rb | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 8981ef98e8..6332fcd6f1 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -1320,6 +1320,7 @@ module FileUtils
else
File.chmod mode, path()
end
+ rescue Errno::EOPNOTSUPP
end
def chown(uid, gid)
@@ -1411,7 +1412,7 @@ module FileUtils
if st.symlink?
begin
File.lchmod mode, path
- rescue NotImplementedError
+ rescue NotImplementedError, Errno::EOPNOTSUPP
end
else
File.chmod mode, path