Hello,
1. Im in the process of an upgrade using Ubuntu 20.04, Ruby 2.7.1, and
Rails 6.0.3. Ive run into an issue using ActiveStorage::attach
with the File.open method (it worked with Ubuntu 12.04 (I know its
ancient), Ruby 2.7.1, and Rails 6.0.3) where I get the error:
Errno::ENOTSUP: Operation not supported - copy_file_range
2. I found a test script that demonstrates the failure as follows:
echo "Hello world" > test.txt
ruby -e "require 'fileutils'; FileUtils.copy_file('test.txt', 'test2.txt')"
Traceback (most recent call last):
7: from -e:1:in `<main>'
6: from
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:511:in
`copy_file'
5: from
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:1413:in
`copy_file'
4: from
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:1413:in
`open'
3: from
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:1414:in
`block in copy_file'
2: from
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:1414:in
`open'
1: from
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:1415:in
`block (2 levels) in copy_file'
/home/vagrant/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:1415:in
`copy_stream': Operation not supported - copy_file_range (Errno::ENOTSUP)
3. It looks to me from reading Gitlab
(https://gitlab.com/gitlab-org/gitlab/-/issues/218999) and Redhat BugZilla
that new Linux Kernels quit
supporting copy_file_range. I grabbed a patch for Ruby called Manually
disable copy_file_range() on RedHat kernels
<https://gitlab.com/gitlab-org/omnibus-gitlab/-/commit/6f078ae59134c3853e83c
5cf9b524cb4aece8de1> .
4. I attempted to reinstall Ruby 2.7.1 with this patch as follows:
rbenv install --patch 2.7.1 < ruby-disable-copy-file-range.patch
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
patching file io.c
Hunk #1 FAILED at 10834.
1 out of 1 hunk FAILED -- saving rejects to file io.c.rej
BUILD FAILED (Ubuntu 20.04 using ruby-build 20200819-2-g258455e)
5. I saw where folks had the same Hunk #1 failure and I tried to
resolve but to no avail.
Please let me know what more info I can give.
Nick Richardson
NickRich1951@gmail.com <mailto:NickRich1951@gmail.com>
(404) 665-7989