Issue #10998 has been updated by Vit Ondruch.


statfs(2) might be good candidate to replace the current mtab implementation.

----------------------------------------
Bug #10998: TestIO#test_seek fails in chroot with Linux 3.19
https://bugs.ruby-lang.org/issues/10998#change-51926

* Author: Vit Ondruch
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Recently, Ruby builds driven by CI started to fail on Fedora builders [1] with following error [6]:

~~~
  2) Error:
TestIO#test_seek:
Errno::ENOENT: No such file or directory - no matching entry
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1711:in `fsname'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1711:in `can_seek_data'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1752:in `block (2 levels) in test_seek'
    /builddir/build/BUILD/ruby-2.2.1/lib/open-uri.rb:36:in `open'
    /builddir/build/BUILD/ruby-2.2.1/lib/open-uri.rb:36:in `open'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1751:in `block in test_seek'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1470:in `make_tempfile'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1728:in `test_seek'
  3) Error:
TestIO#test_seek_symwhence:
Errno::ENOENT: No such file or directory - no matching entry
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1711:in `fsname'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1711:in `can_seek_data'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1800:in `block (2 levels) in test_seek_symwhence'
    /builddir/build/BUILD/ruby-2.2.1/lib/open-uri.rb:36:in `open'
    /builddir/build/BUILD/ruby-2.2.1/lib/open-uri.rb:36:in `open'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1799:in `block in test_seek_symwhence'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1470:in `make_tempfile'
    /builddir/build/BUILD/ruby-2.2.1/test/ruby/test_io.rb:1781:in `test_seek_symwhence'
~~~

We tracked down the issue and we believe that it is due to upgrade of Kernel from 3.17.8 to 3.19.1. In recent kernel, this commit [2] influences content of mtab in chroot (which we are using to setup our build roots). This is content of /etc/mtab using 3.17 kernel [3] and this is with 3.19 kernel [4]. As you can see, with recent kernel, there is no trace of root directory and hence the fsname method [5] can't find the underlying filesystem and the test case fails.

Is there any chance identify the FS by different/more reliable means.

BTW As I understand after discussion with colleagues, I believe that the /etc/mtab is kept around just for backward compatibility and there are several parties which would like to see this file dead entirely. It is currently just symlink anyway. So it might be just about time to stop using it.

[1] http://koschei.cloud.fedoraproject.org/package/ruby
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9d4d6574
[3] http://paste.fedoraproject.org/201571/42712927/
[4] http://paste.fedoraproject.org/201618/14271327/
[5] https://github.com/ruby/ruby/blob/trunk/ext/-test-/file/fs.c#L14
[6] https://kojipkgs.fedoraproject.org/work/tasks/3012/9303012/build.log



-- 
https://bugs.ruby-lang.org/