uutils/coreutils · critical

not implemented

Error message

not implemented

What it means

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).

Source

Thrown at src/uucore/src/lib/features/fsext.rs:821

                not(target_pointer_width = "64")
            )
        ))]
        return self.f_type.into();
        #[cfg(any(
            target_env = "musl",
            all(target_os = "android", target_pointer_width = "64"),
        ))]
        return self.f_type.try_into().unwrap();
    }
    #[cfg(not(any(
        target_os = "linux",
        target_os = "android",
        target_vendor = "apple",
        target_os = "freebsd"
    )))]
    fn fs_type(&self) -> i64 {
        // FIXME: statvfs doesn't have an equivalent, so we need to do something else
        unimplemented!()
    }

    #[cfg(any(target_os = "linux", target_os = "android"))]
    #[allow(clippy::unnecessary_cast)]
    fn io_size(&self) -> u64 {
        self.f_frsize as u64
    }
    #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "netbsd"))]
    #[allow(clippy::unnecessary_cast)]
    fn io_size(&self) -> u64 {
        #[cfg(target_os = "freebsd")]
        return self.f_iosize;
        #[cfg(not(target_os = "freebsd"))]
        return self.f_iosize as u64;
    }
    // XXX: dunno if this is right
    #[cfg(not(any(
        target_vendor = "apple",

View on GitHub (pinned to 2c9a666674)

Solutions

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Example fix

// before (src/uucore/src/lib/features/fsext.rs:813-822)
#[cfg(not(any(
    target_os = "linux",
    target_os = "android",
    target_vendor = "apple",
    target_os = "freebsd"
)))]
fn fs_type(&self) -> i64 {
    // FIXME: statvfs doesn't have an equivalent, so we need to do something else
    unimplemented!()
}

// after - 0 is the conventional 'unknown' filesystem magic; pretty_fstype(0)
// already reports it as unknown instead of panicking
#[cfg(not(any(
    target_os = "linux",
    target_os = "android",
    target_vendor = "apple",
    target_os = "freebsd"
)))]
fn fs_type(&self) -> i64 {
    0
}
Defensive patterns

Strategy: fallback

Validate before calling

// Mirror the impl's cfg list before touching fs_type() (fsext.rs:813-818)
#[cfg(any(
    target_os = "linux",
    target_os = "android",
    target_vendor = "apple",
    target_os = "freebsd"
))]
fn known_fs_type(statfs: &StatFs) -> i64 {
    statfs.fs_type()
}
#[cfg(not(any(
    target_os = "linux",
    target_os = "android",
    target_vendor = "apple",
    target_os = "freebsd"
)))]
fn known_fs_type(_statfs: &StatFs) -> i64 {
    0 // conventional 'unknown' magic; avoids the unimplemented!() panic
}

Type guard

fn fs_type_available() -> bool {
    cfg!(any(
        target_os = "linux",
        target_os = "android",
        target_vendor = "apple",
        target_os = "freebsd"
    ))
}

Try / catch

use std::panic;

let fs_type = panic::catch_unwind(|| stat_result.fs_type()).unwrap_or_else(|payload| {
    let msg = payload
        .downcast_ref::<String>()
        .map(String::as_str)
        .unwrap_or("");
    if msg.contains("not implemented") {
        0 // statvfs platform without f_type: report 'unknown' in df/stat output
    } else {
        std::panic::resume_unwind(payload)
    }
});

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of uutils/coreutils@2c9a666674 (2026-08-16). Data as JSON: /api/errors/b7e91afd407bec01. Report an issue: GitHub.