From<nix::Error> uses invalid err as i32 cast - broken FUSE error mapping #7

Open
opened 2026-05-12 11:58:19 +00:00 by salmaelsoly · 1 comment
Member

At line 588 in error.rs:

impl From<nix::Error> for Error {
    fn from(err: nix::Error) -> Self {
        Error::Posix {
            message: err.to_string(),
            errno: Some(err as i32),  // INVALID: nix::Error is a struct, not an i32
        }
    }
}

With nix 0.31.2, nix::Error is a struct type. The as i32 cast is invalid - this is a compile error. If it ever compiled with an older version, it would produce the enum discriminant instead of the actual errno, silently corrupting FUSE error propagation.

Severity: high | Confidence: high

At line 588 in error.rs: ```rust impl From<nix::Error> for Error { fn from(err: nix::Error) -> Self { Error::Posix { message: err.to_string(), errno: Some(err as i32), // INVALID: nix::Error is a struct, not an i32 } } } ``` With nix 0.31.2, nix::Error is a struct type. The as i32 cast is invalid - this is a compile error. If it ever compiled with an older version, it would produce the enum discriminant instead of the actual errno, silently corrupting FUSE error propagation. Severity: high | Confidence: high
Author
Member

Classification: unclear -- referenced code does not exist in this repository

The described bug (Fromnix::Error using err as i32 cast, which would fail to compile with nix >=0.28 where nix::Error is a struct) is a real, well-documented issue, but the referenced file error.rs:588 does not contain this code in the geomind_code/geoip repository. The nix crate is not a dependency of this project (confirmed from Cargo.toml). The issue was likely filed against the wrong repository.

Severity: high | Confidence: high (bug is real in the correct codebase, but does not apply here)

> Classification: unclear -- referenced code does not exist in this repository The described bug (From<nix::Error> using err as i32 cast, which would fail to compile with nix >=0.28 where nix::Error is a struct) is a real, well-documented issue, but the referenced file error.rs:588 does not contain this code in the geomind_code/geoip repository. The nix crate is not a dependency of this project (confirmed from Cargo.toml). The issue was likely filed against the wrong repository. Severity: high | Confidence: high (bug is real in the correct codebase, but does not apply here)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/geoip#7
No description provided.