Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/uucore/src/lib/features/fsext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@
// for NetBSD 3.0
| "kernfs"
// for Irix 6.5
| "ignore" => true,
| "ignore"
// Binary format support pseudo-filesystem
| "binfmt_misc" => true,
_ => fs_type == "none"
&& !mount_option.contains(MOUNT_OPT_BIND)
}
Expand Down Expand Up @@ -1220,4 +1222,11 @@
crate::os_str_from_bytes(b"/mnt/some- -dir-\xf3").unwrap()
);
}

#[test]
#[cfg(all(unix, not(any(target_os = "aix", target_os = "redox"))))]
fn test_binfmt_misc_is_dummy() {

Check failure on line 1228 in src/uucore/src/lib/features/fsext.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'src/uucore/src/lib/features/fsext.rs', line:1228)

Check failure on line 1228 in src/uucore/src/lib/features/fsext.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'src/uucore/src/lib/features/fsext.rs', line:1228)
use super::is_dummy_filesystem;
assert!(is_dummy_filesystem("binfmt_misc", ""));

Check failure on line 1230 in src/uucore/src/lib/features/fsext.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'src/uucore/src/lib/features/fsext.rs', line:1230)

Check failure on line 1230 in src/uucore/src/lib/features/fsext.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'src/uucore/src/lib/features/fsext.rs', line:1230)
}
}
32 changes: 32 additions & 0 deletions tests/by-util/test_df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,3 +1046,35 @@
.stderr_is("df: does-not-exist: No such file or directory\n")
.stdout_is("File\n.\n");
}

#[test]
#[cfg(target_os = "linux")]
fn test_df_all_shows_binfmt_misc() {

Check failure on line 1052 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1052)

Check failure on line 1052 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1052)
if std::path::Path::new("/proc/sys/fs/binfmt_misc").exists() {

Check failure on line 1053 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1053)

Check failure on line 1053 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1053)
let output = new_ucmd!()
.args(&["--all", "--output=fstype,target"])
.succeeds()
.stdout_str_lossy();

assert!(
output.contains("binfmt_misc"),

Check failure on line 1060 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1060)

Check failure on line 1060 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1060)
"Expected binfmt_misc filesystem to appear in df --all output"

Check failure on line 1061 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1061)

Check failure on line 1061 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1061)
);
}
}

#[test]
#[cfg(target_os = "linux")]
fn test_df_hides_binfmt_misc_by_default() {

Check failure on line 1068 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1068)

Check failure on line 1068 in tests/by-util/test_df.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: `cspell`: Unknown word 'binfmt' (file:'tests/by-util/test_df.rs', line:1068)
if std::path::Path::new("/proc/sys/fs/binfmt_misc").exists() {
let output = new_ucmd!()
.args(&["--output=fstype,target"])
.succeeds()
.stdout_str_lossy();

assert!(
!output.contains("binfmt_misc"),
"Expected binfmt_misc filesystem to be hidden in df output without --all"
);
}
}
Loading