Project

General

Profile

Actions

Bug #16979

closed

FileUtils#cp_r with preserve, lchmod fails with ENOTSUPP

Added by vihai (Daniele Orlandi) over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [armv7-linux-musleabihf]
[ruby-core:98922]

Description

Hello,

I encountered an issue copying a directory tree with symlinks with FileUtils#cp_r with preserve flag.

Apparently FileUtils considers the possibility that lchmod raises NotImplementedError, however it apparently does not but still fails with ENOTSUPP.
Note that I am using musl libc (it is an Alpine 3.12 distribution) thus it may be related to how libc exposes unsupported lchmod.

I was unable to reproduce it with a minimal tree, thus here is the output with the actual tree (it is a bundled application):

cp -rp /root/kamaji/assets /root/kamaji/bin /root/kamaji/config /root/kamaji/lib /root/kamaji/vendor /root/kamaji/apk/build/data
Traceback (most recent call last):
        42: from apk/build.rb:28:in `<main>'
        41: from /usr/lib/ruby/2.7.0/fileutils.rb:467:in `cp_r'
        40: from /usr/lib/ruby/2.7.0/fileutils.rb:1586:in `fu_each_src_dest'
        39: from /usr/lib/ruby/2.7.0/fileutils.rb:1595:in `fu_each_src_dest0'
        38: from /usr/lib/ruby/2.7.0/fileutils.rb:1595:in `each'
        37: from /usr/lib/ruby/2.7.0/fileutils.rb:1597:in `block in fu_each_src_dest0'
        36: from /usr/lib/ruby/2.7.0/fileutils.rb:1588:in `block in fu_each_src_dest'
        35: from /usr/lib/ruby/2.7.0/fileutils.rb:468:in `block in cp_r'
        34: from /usr/lib/ruby/2.7.0/fileutils.rb:494:in `copy_entry'
        33: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        32: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        31: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        30: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        29: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        28: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        27: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        26: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        25: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        24: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        23: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        22: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        21: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        20: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        19: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        18: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        17: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        16: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        15: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        14: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        13: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
        12: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
        11: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
        10: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
         9: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
         8: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
         7: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
         6: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `wrap_traverse'
         5: from /usr/lib/ruby/2.7.0/fileutils.rb:1514:in `each'
         4: from /usr/lib/ruby/2.7.0/fileutils.rb:1515:in `block in wrap_traverse'
         3: from /usr/lib/ruby/2.7.0/fileutils.rb:1518:in `wrap_traverse'
         2: from /usr/lib/ruby/2.7.0/fileutils.rb:500:in `block in copy_entry'
         1: from /usr/lib/ruby/2.7.0/fileutils.rb:1441:in `copy_metadata'
/usr/lib/ruby/2.7.0/fileutils.rb:1441:in `lchmod': Not supported @ apply2files - /root/kamaji/apk/build/data/vendor/bundle/ruby/2.7.0/gems/ffi-1.13.1/ext/ffi_c/libffi-armv7-linux-musleabihf/.libs/libffi.la (Errno::ENOTSUP)
# ll /root/kamaji/apk/build/data/vendor/bundle/ruby/2.7.0/gems/ffi-1.13.1/ext/ffi_c/libffi-armv7-linux-musleabihf/.libs/
total 8
drwxr-xr-x 2 root root 4096 Jun 23 15:28 .
drwxr-xr-x 8 root root 4096 Jun 23 15:28 ..
lrwxrwxrwx 1 root root   12 Jun 23 15:28 libffi.la -> ../libffi.la

# ll /root/kamaji/apk/build/data/vendor/bundle/ruby/2.7.0/gems/ffi-1.13.1/ext/ffi_c/libffi-armv7-linux-musleabihf/
total 612
[...]
-rw-r--r-- 1 root root    915 Jun 23 13:48 libffi.la
[...]

# ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [armv7-linux-musleabihf]

# uname -a
Linux arm-builder 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux

LIBC is musl-1.1.24-r9

Actions #1

Updated by vihai (Daniele Orlandi) over 2 years ago

  • Description updated (diff)

Updated by shyouhei (Shyouhei Urabe) over 2 years ago

I guess this is already fixed in changeset a19228f878d955eaf2cce086bcf53f46fdf894b9

Actions #3

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: UNKNOWN, 2.6: REQUIRED, 2.7: REQUIRED

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Status changed from Open to Closed

Closed to backport.

Updated by nagachika (Tomoyuki Chikanaga) about 2 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: UNKNOWN, 2.6: REQUIRED, 2.7: DONE

ruby_2_7 799c5766a4dc215d139d2c26ac68636f43a64fbf merged revision(s) a19228f878d955eaf2cce086bcf53f46fdf894b9.

Updated by usa (Usaku NAKAMURA) over 1 year ago

  • Backport changed from 2.5: UNKNOWN, 2.6: REQUIRED, 2.7: DONE to 2.5: UNKNOWN, 2.6: DONE, 2.7: DONE

ruby_2_6 r67907 merged revision(s) a19228f8.

Actions

Also available in: Atom PDF