Subject: coreutils 8.31 tests/df/skip-rootfs.sh fail when using rootfs

From: Rickard Nilsson <[email-masked]>
Date: Thu, 12 Dec 2019 00:26:31 +0100

I have build server where /proc/self/mountinfo looks like this:

1 1 0:2 / / rw - rootfs rootfs rw,size=959528k,nr_inodes=239882
24 1 0:23 / /dev/pts rw,relatime - devpts devpts rw,mode=600,ptmxmode=000
25 1 0:5 / /proc rw,relatime - proc proc rw
26 1 0:24 / /sys rw,relatime - sysfs sysfs rw
27 1 0:25 / /ro/store ro,nosuid,nodev,relatime - fuse.nixstore nixstore 
ro,user_id=0,group_id=0,allow_other
28 1 0:26 / /tmp rw,relatime - tmpfs tmpfs rw,size=1971456k
29 1 0:27 / /nix/var rw,relatime - tmpfs tmpfs rw,size=1971456k,mode=755
30 1 0:28 / /dev/shm rw,nosuid,nodev - tmpfs tmpfs rw,size=1971456k
31 1 0:2 /nix/store /nix/store_initrd rw - rootfs rootfs 
rw,size=959528k,nr_inodes=239882
35 1 0:29 / /nix/store rw,relatime - overlay overlay 
rw,lowerdir=/ro/store:/nix/store_initrd,upperdir=/nix/var/store_rw,workdir=/nix/var/store_wrk
36 29 259:0 / /nix/var/nix/db rw,noatime - ext4 /dev/pmem0 rw,nobarrier

There's a lot of stuff there that probably is irrelevant for this issue. 
What is special about the build server is that it actually uses the 
original rootfs from its initrd. That is, it never mounts any other root 
fs and runs switch_root or chroot or anything.

When I run df without options I get this:

Filesystem     1K-blocks   Used Available Use% Mounted on
rootfs            959528 121988    837540  13% /
tmpfs            1971456      0   1971456   0% /tmp
tmpfs            1971456      0   1971456   0% /nix/var
tmpfs            1971456      0   1971456   0% /dev/shm
overlay          1971456      0   1971456   0% /nix/store
/dev/pmem0       1032088   2608    960668   1% /nix/var/nix/db

With the -a option I get:

Filesystem     1K-blocks   Used Available Use% Mounted on
rootfs            959528 121988    837540  13% /
devpts                 0      0         0    - /dev/pts
proc                   0      0         0    - /proc
sysfs                  0      0         0    - /sys
nixstore               0      0         0    - /ro/store
tmpfs            1971456      0   1971456   0% /tmp
tmpfs            1971456      0   1971456   0% /nix/var
tmpfs            1971456      0   1971456   0% /dev/shm
rootfs            959528 121988    837540  13% /nix/store_initrd
overlay          1971456      0   1971456   0% /nix/store
/dev/pmem0       1032088   2608    960668   1% /nix/var/nix/db

The test phase of the coreutils 8.31 build fails on this server with the 
following failure:

FAIL: tests/df/skip-rootfs
==========================

Filesystem     1K-blocks   Used Available Use% Mounted on
rootfs           5964104 121976   5842128   3% /
tmpfs           11980608  93744  11886864   1% /tmp
tmpfs           11980608      8  11980600   1% /nix/var
overlay         11980608      8  11980600   1% /nix/store
/dev/pmem0       1032088  10860    952416   2% /nix/var/nix/db
rootfs           5964104 121976   5842128   3% /
rootfs           5964104 121976   5842128   3% /nix/store_initrd
rootfs           5964104 121976   5842128   3% /
Filesystem     1K-blocks   Used Available Use% Mounted on
rootfs           5964104 121976   5842128   3% /
tmpfs           11980608  93748  11886860   1% /tmp
tmpfs           11980608      8  11980600   1% /nix/var
overlay         11980608      8  11980600   1% /nix/store
/dev/pmem0       1032088  10860    952416   2% /nix/var/nix/db
rootfs           5964104 121976   5842128   3% /
Filesystem     1K-blocks   Used Available Use% Mounted on
rootfs           5964104 121976   5842128   3% /
rootfs           5964104 121976   5842128   3% /
rootfs           5964104 121976   5842128   3% /nix/store_initrd
1 1 0:2 / / rw - rootfs rootfs rw,size=5964104k,nr_inodes=1491026
24 1 0:23 / /dev/pts rw,relatime - devpts devpts rw,mode=600,ptmxmode=000
25 1 0:5 / /proc rw,relatime - proc proc rw
26 1 0:24 / /sys rw,relatime - sysfs sysfs rw
27 1 0:25 / /ro/store ro,nosuid,nodev,relatime - fuse.nixstore nixstore 
ro,user_id=0,group_id=0,allow_other
28 1 0:26 / /tmp rw,relatime - tmpfs tmpfs rw,size=11980608k
29 1 0:27 / /nix/var rw,relatime - tmpfs tmpfs rw,size=11980608k,mode=755
30 1 0:2 /nix/store /nix/store_initrd rw - rootfs rootfs 
rw,size=5964104k,nr_inodes=1491026
34 1 0:28 / /nix/store rw,relatime - overlay overlay 
rw,lowerdir=/ro/store:/nix/store_initrd,upperdir=/nix/var/store_rw,workdir=/nix/var/store_wrk
35 29 259:0 / /nix/var/nix/db rw,noatime - ext4 /dev/pmem0 rw,nobarrier
FAIL tests/df/skip-rootfs.sh (exit status: 1)

Is the df/skip-rootfs test case really correct? Looking at it, it seems 
that rootfs entries should never appear in the df output except for when 
specified with -t rootfs. But as you can see above, df does output 
rootfs entries in other cases (and that does not seem wrong to me).

Best regards,
   Rickard Nilsson