Skip to content

df: issues when dealing with nested mounts #6073

@cre4ture

Description

@cre4ture

I create this issue from a finding from pullrequest #5821.

When running tests of uutils df on my own android phone (not on AVD),
and after fixing the issue with the integer overflow addressed in #6071,
they are still failing in test test_df::test_type_option_with_file:

---- test_df::test_type_option_with_file stdout ----
run: /data/data/com.termux/files/home/rust/coreutils/target/debug/coreutils df --output=fstype .
run: /data/data/com.termux/files/home/rust/coreutils/target/debug/coreutils df -t f2fs .
run: /data/data/com.termux/files/home/rust/coreutils/target/debug/coreutils df -t nonexisting .
run: /data/data/com.termux/files/home/rust/coreutils/target/debug/coreutils df --output=fstype
run: /data/data/com.termux/files/home/rust/coreutils/target/debug/coreutils df -t erofs .
thread 'test_df::test_type_option_with_file' panicked at tests/by-util/test_df.rs:292:14:
Command was expected to fail.
stdout = Filesystem       1K-blocks   Used Available Use% Mounted on
/dev/block/dm-15    595792 595792         0 100% /

 stderr = 
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    test_df::test_type_option_with_file

test result: FAILED. 48 passed; 1 failed; 0 ignored; 0 measured; 2946 filtered out; finished in 0.97s

for easier debugging and comparison (termux uses toybox df) I tried to reproduce the issue on my ubuntu.
There I tried to setup a similar setup as I have it on the phone - two nested filesystem mounts with different fstypes.
As my /home - which is a nested mount - has the same fstype as the root, I can't use it for the test.

So I simply mounted a ISO image I recently downloaded and did the tests manually there:

GNU output:

uli@hp13-ulix:/media/uli/OpenBSD_amd64   7.4 Install CD$ df -T .
Filesystem     Type    1K-blocks   Used Available Use% Mounted on
/dev/loop20    iso9660    617966 617966         0 100% /media/uli/OpenBSD_amd64   7.4 Install CD
uli@hp13-ulix:/media/uli/OpenBSD_amd64   7.4 Install CD$ df -T -t iso9660 .
Filesystem     Type    1K-blocks   Used Available Use% Mounted on
/dev/loop20    iso9660    617966 617966         0 100% /media/uli/OpenBSD_amd64   7.4 Install CD
uli@hp13-ulix:/media/uli/OpenBSD_amd64   7.4 Install CD$ df -T -t ext4 .
df: no file systems processed

uutils output:

uli@hp13-ulix:/media/uli/OpenBSD_amd64   7.4 Install CD$ ~/dev_rust/coreutils/target/debug/coreutils df -T .
Filesystem     Type 1K-blocks     Used Available Use% Mounted on
/dev/nvme0n1p7 ext4 100904268 34242964  61489496  36% /
uli@hp13-ulix:/media/uli/OpenBSD_amd64   7.4 Install CD$ ~/dev_rust/coreutils/target/debug/coreutils df -T -t iso9660 .
df: no file systems processed
uli@hp13-ulix:/media/uli/OpenBSD_amd64   7.4 Install CD$ ~/dev_rust/coreutils/target/debug/coreutils df -T -t ext4 .
Filesystem     Type 1K-blocks     Used Available Use% Mounted on
/dev/nvme0n1p7 ext4 100904268 34242964  61489496  36% /

So, even worse then on android, uutils wrongly ignores the nested mount of ISO image and reports type ext4 of root mount.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions