Skip to content

fs::metadata() crashes on FreeBSD 12 due to layout change in stat.h #42681

Closed
rust-lang/libc
#937
@lukaslueg

Description

@lukaslueg

The layout of struct stat used to be this in FreeBSD 11, in FreeBSD 12 it's now this. This causes the FreeBSD-specific implementation of std::fs::metadata() to crash for 1.18 and nightly as of 17/06/15, as it's stack frame get's boiled up.

Can be reproduced via

use std::fs;
fn main() {
    println!("{:?}", fs::metadata("Cargo.toml"));
}

Downstream this appeared in alacritty/alacritty#618

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-freebsdOperating system: FreeBSDP-highHigh priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions