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

fs::set_permissions/chmod unsupported on Linux #4202

Open
barely-a-dev opened this issue Feb 23, 2025 · 1 comment · May be fixed by #4214
Open

fs::set_permissions/chmod unsupported on Linux #4202

barely-a-dev opened this issue Feb 23, 2025 · 1 comment · May be fixed by #4214
Labels
A-files Area: related to files, paths, sockets, file descriptors, or handles A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available

Comments

@barely-a-dev
Copy link

Hello, calling fs::set_permissions(path, Permissions::from_mode(0o700))?; fails with the below message.

--> ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/fs.rs:1815:50
     |
1815 |     run_path_with_cstr(p, &|p| cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }).map(|_| ()))
     |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function `chmod` on OS `linux`
...
 help: if this is a basic API commonly used on this target, please report an issue with Miri

Since I'm thinking that chmod is probably a pretty basic API commonly used on Linux, I made this issue.

@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement A-shims Area: This affects the external function shims A-files Area: related to files, paths, sockets, file descriptors, or handles labels Feb 23, 2025
@RalfJung
Copy link
Member

Permissions::from_mode is unix-only, so we'll not be able to easily support this on Windows hosts unfortunately, so the tests will have to use ignore-host. But other than that, shouldn't be very hard to add.

@RalfJung RalfJung added the E-good-first-issue A good way to start contributing, mentoring is available label Feb 23, 2025
@el-ev el-ev linked a pull request Feb 26, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-files Area: related to files, paths, sockets, file descriptors, or handles A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants