{"record":{"id":"b7e91afd407bec01","repo":"uutils/coreutils","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/uucore/src/lib/features/fsext.rs","lineNumber":821,"sourceCode":"                not(target_pointer_width = \"64\")\n            )\n        ))]\n        return self.f_type.into();\n        #[cfg(any(\n            target_env = \"musl\",\n            all(target_os = \"android\", target_pointer_width = \"64\"),\n        ))]\n        return self.f_type.try_into().unwrap();\n    }\n    #[cfg(not(any(\n        target_os = \"linux\",\n        target_os = \"android\",\n        target_vendor = \"apple\",\n        target_os = \"freebsd\"\n    )))]\n    fn fs_type(&self) -> i64 {\n        // FIXME: statvfs doesn't have an equivalent, so we need to do something else\n        unimplemented!()\n    }\n\n    #[cfg(any(target_os = \"linux\", target_os = \"android\"))]\n    #[allow(clippy::unnecessary_cast)]\n    fn io_size(&self) -> u64 {\n        self.f_frsize as u64\n    }\n    #[cfg(any(target_vendor = \"apple\", target_os = \"freebsd\", target_os = \"netbsd\"))]\n    #[allow(clippy::unnecessary_cast)]\n    fn io_size(&self) -> u64 {\n        #[cfg(target_os = \"freebsd\")]\n        return self.f_iosize;\n        #[cfg(not(target_os = \"freebsd\"))]\n        return self.f_iosize as u64;\n    }\n    // XXX: dunno if this is right\n    #[cfg(not(any(\n        target_vendor = \"apple\",","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/uutils/coreutils/blob/2c9a6666749473dc4bff876f5c4a9f25fde4c964/src/uucore/src/lib/features/fsext.rs#L803-L839","documentation":"uucore's unix `FsMeta` trait (src/uucore/src/lib/features/fsext.rs:677-689) reads the filesystem type from the `f_type` field, which exists in `statfs` but not in `statvfs`. On unix targets outside {linux, android, apple, freebsd} the `fs_type()` impl is a stub whose only body is `unimplemented!()` (fsext.rs:819-822, marked FIXME), so any caller panics at runtime. Consumers include `df`, which calls `stat_result.fs_type()` for every mount row (src/uu/df/src/filesystem.rs:235), and `stat -f` with the `%t`/`%T` directives (src/uu/stat/src/stat.rs:545-547).","triggerScenarios":"Build `df` or `stat` for a unix target not covered by the cfg list - NetBSD, OpenBSD, AIX, illumos/Solaris, Haiku - where StatFs is statvfs-backed, then run plain `df` (filesystem.rs:235 calls fs_type() unconditionally per row) or `stat --file-system --format=%T <path>`; the binary panics with 'not implemented' and exits 101.","commonSituations":"A BSD-other-than-FreeBSD user installing a Rust coreutils replacement (coreutils multi-call busybox style) and running the everyday `df` command; CI cross-compiling to x86_64-unknown-netbsd/openbsd where `cargo build` succeeds (the stub compiles fine) and only runtime smoke tests reveal the panic; downstream crates importing uucore::fsext directly on those platforms.","solutions":["Implement `fs_type()` for the statvfs path: return 0 (the conventional 'unknown' magic that pretty_fstype already renders as UNKNOWN-ish output) or map the platform's own type field, replacing the FIXME stub at fsext.rs:819-822, and add a unit test next to the existing test_fs_type at fsext.rs:1092.","If you maintain the binary build for that platform, patch a local fallback that skips/empties the 'Type' column in df instead of calling fs_type() - guard the call site with the same cfg list.","As a uucore library consumer, cfg-guard your own fs_type usage so it is only reached on linux/android/apple/freebsd, and substitute 0 or None elsewhere.","Track/patch upstream: this is a known FIXME ('statvfs doesn't have an equivalent, so we need to do something else') - a PR implementing it removes the panic for every affected unix."],"exampleFix":"// before (src/uucore/src/lib/features/fsext.rs:813-822)\n#[cfg(not(any(\n    target_os = \"linux\",\n    target_os = \"android\",\n    target_vendor = \"apple\",\n    target_os = \"freebsd\"\n)))]\nfn fs_type(&self) -> i64 {\n    // FIXME: statvfs doesn't have an equivalent, so we need to do something else\n    unimplemented!()\n}\n\n// after - 0 is the conventional 'unknown' filesystem magic; pretty_fstype(0)\n// already reports it as unknown instead of panicking\n#[cfg(not(any(\n    target_os = \"linux\",\n    target_os = \"android\",\n    target_vendor = \"apple\",\n    target_os = \"freebsd\"\n)))]\nfn fs_type(&self) -> i64 {\n    0\n}","handlingStrategy":"fallback","validationCode":"// Mirror the impl's cfg list before touching fs_type() (fsext.rs:813-818)\n#[cfg(any(\n    target_os = \"linux\",\n    target_os = \"android\",\n    target_vendor = \"apple\",\n    target_os = \"freebsd\"\n))]\nfn known_fs_type(statfs: &StatFs) -> i64 {\n    statfs.fs_type()\n}\n#[cfg(not(any(\n    target_os = \"linux\",\n    target_os = \"android\",\n    target_vendor = \"apple\",\n    target_os = \"freebsd\"\n)))]\nfn known_fs_type(_statfs: &StatFs) -> i64 {\n    0 // conventional 'unknown' magic; avoids the unimplemented!() panic\n}","typeGuard":"fn fs_type_available() -> bool {\n    cfg!(any(\n        target_os = \"linux\",\n        target_os = \"android\",\n        target_vendor = \"apple\",\n        target_os = \"freebsd\"\n    ))\n}","tryCatchPattern":"use std::panic;\n\nlet fs_type = panic::catch_unwind(|| stat_result.fs_type()).unwrap_or_else(|payload| {\n    let msg = payload\n        .downcast_ref::<String>()\n        .map(String::as_str)\n        .unwrap_or(\"\");\n    if msg.contains(\"not implemented\") {\n        0 // statvfs platform without f_type: report 'unknown' in df/stat output\n    } else {\n        std::panic::resume_unwind(payload)\n    }\n});","preventionTips":["Before porting df/stat/uucore to a new unix, enumerate every FsMeta method and check which cfg arms compile to unimplemented!() on your target.","Add runtime smoke tests (`df`, `stat -f`) per target in CI - cargo check/build cannot catch cfg-selected panics.","When embedding uucore::fsext, wrap every FsMeta accessor with the same cfg predicate used in fsext.rs rather than calling it blindly.","Upstream implementations for statvfs platforms (return 0 or map the native type field) instead of carrying local forks of the stub."],"tags":["rust","panic","statvfs","statfs","filesystem","df","stat","bsd","platform-support"],"backgroundTag":"statvfs-missing-fs-type","analyzedSha":"2c9a6666749473dc4bff876f5c4a9f25fde4c964","analyzedAt":"2026-08-16T22:33:48.260Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}