Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: stat::st_mode and S_IFMT are of different type #3161

Open
cgzones opened this issue Mar 21, 2023 · 2 comments · May be fixed by #3625
Open

windows: stat::st_mode and S_IFMT are of different type #3161

cgzones opened this issue Mar 21, 2023 · 2 comments · May be fixed by #3625
Labels
breakage-candidate C-bug Category: bug E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@cgzones
Copy link

cgzones commented Mar 21, 2023

On windows stat::st_mode

pub st_mode: u16,
and S_IFMT (and other mode flags)
pub const S_IFMT: ::c_int = 61440;
are of different type, resulting in code like

fn is_regular(stat: &libc::stat) -> bool {
    stat.st_mode & libc::S_IFMT == libc::S_IFREG
}

to not be portable.

@cgzones cgzones added the C-bug Category: bug label Mar 21, 2023
@joshtriplett
Copy link
Member

We need to check if these are in fact different types in Windows headers, or if they're the same type and we have an error in the crate's types.

@ChrisDenton
Copy link
Member

Here's the ucrt header.

@tgross35 tgross35 added this to the 1.0 milestone Aug 12, 2024
@tgross35 tgross35 linked a pull request Aug 13, 2024 that will close this issue
@tgross35 tgross35 added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breakage-candidate C-bug Category: bug E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants