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

do not attempt to open files in Miri #121

Merged
merged 1 commit into from
Sep 26, 2022
Merged

Conversation

RalfJung
Copy link
Contributor

Using this from Miri leads to the following error:

error: unsupported operation: `open` not available when isolation is enabled
   --> /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:887:36
    |
887 |         let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?;
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `open` not available when isolation is enabled
    |
    = help: pass the flag `-Zmiri-disable-isolation` to disable isolation;
    = help: or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning
            
    = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:887:36
    = note: inside `std::sys::unix::cvt_r::<i32, [closure@std::sys::unix::fs::File::open_c::{closure#0}]>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/mod.rs:244:19
    = note: inside `std::sys::unix::fs::File::open_c` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:887:18
    = note: inside `std::sys::unix::fs::File::open` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/unix/fs.rs:875:9
    = note: inside `std::fs::OpenOptions::_open` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:968:9
    = note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:964:9
    = note: inside `std::fs::File::open::<&str>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:344:9
    = note: inside `num_cpus::linux::Subsys::load_cpu::<&str>` at /home/r/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num_cpus-1.13.1/src/linux.rs:271:26
    = note: inside `num_cpus::linux::load_cgroups::<&str, &str>` at /home/r/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num_cpus-1.13.1/src/linux.rs:146:24
    = note: inside `num_cpus::linux::init_cgroups` at /home/r/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num_cpus-1.13.1/src/linux.rs:129:26
    = note: inside `<fn() {num_cpus::linux::init_cgroups} as std::ops::FnOnce<()>>::call_once - shim(fn() {num_cpus::linux::init_cgroups})` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ops/function.rs:248:5
    = note: inside closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sync/once.rs:276:41
    = note: inside `std::sync::Once::call_inner` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sync/once.rs:434:21
    = note: inside `std::sync::Once::call_once::<fn() {num_cpus::linux::init_cgroups}>` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sync/once.rs:276:9
    = note: inside `num_cpus::linux::cgroups_num_cpus` at /home/r/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num_cpus-1.13.1/src/linux.rs:114:5
    = note: inside `num_cpus::linux::get_num_cpus` at /home/r/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/num_cpus-1.13.1/src/linux.rs:33:11

As the error indicates, we could use -Zmiri-disable-isolation or -Zmiri-isolation-error=warn to make things work, but given that Miri anyway has no parallelism, IMO it makes more sense to skip the file opening part entirely in Miri.

@seanmonstar seanmonstar merged commit 354348c into seanmonstar:master Sep 26, 2022
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Jun 30, 2023
Bumps num_cpus from 1.13.1 to 1.16.0.

Release notes
Sourced from num_cpus's releases.

v1.16.0
Features

add support for AIX operating system

Fixes

update hermit-abi to 0.3.0

New Contributors

@​mkroening made their first contribution in seanmonstar/num_cpus#128
@​ecnelises made their first contribution in seanmonstar/num_cpus#123

v1.15.0
Fixes

update hermit-abi

New Contributors

@​striezel made their first contribution in seanmonstar/num_cpus#126
@​buffet made their first contribution in seanmonstar/num_cpus#127

v1.14.0
Features

Support cgroups v2 by @​OrionNebula in seanmonstar/num_cpus#125
Do not attempt to open files in Miri by @​RalfJung in seanmonstar/num_cpus#121

New Contributors

@​RalfJung made their first contribution in seanmonstar/num_cpus#121
@​OrionNebula made their first contribution in seanmonstar/num_cpus#125




Changelog
Sourced from num_cpus's changelog.

v1.16.0
Features

add support for AIX operating system

Fixes

update hermit-abi to 0.3.0

v1.15.0
Fixes

update hermit-abi

v1.14.0
Features

add support for cgroups v2
Skip reading files in Miri




Commits

7c03fc9 v1.16.0
cd76834 add funding file
f3e7081 Support AIX operating system (#123)
edf035c Update CI badges (#132)
3b6e5f0 Bump hermit-abi to 0.3.0 and don't restrict hermit-abi architectures (#128)
5bea3c7 v1.15.0
ccb5a67 chore: update hermit-abi to 0.2.6 (#127)
e437b9d ci: update actions/checkout in GitHub Actions workflows to v3 (#126)
90373f3 v1.14.0
4f0f2a4 Support reading cpu.max from cgroups v2 (#125)
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants