Skip to content

read_dir broken on FreeBSD #4587

@RalfJung

Description

@RalfJung

Some recent rustc changes broke read_dir on FreeBSD:

error: unsupported operation: can't call foreign function `readdir` on OS `freebsd`
    --> /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/fs/unix.rs:733:50
     |
  LL |                 let entry_ptr: *const dirent64 = readdir64(self.inner.dirp.0);
     |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported operation occurred here
     |
     = help: this means the program tried to do something Miri does not support; it does not indicate a bug in the program
     = note: BACKTRACE:
     = note: inside `<std::sys::fs::unix::ReadDir as std::iter::Iterator>::next` at /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/sys/fs/unix.rs:733:50: 733:78
     = note: inside `<std::fs::ReadDir as std::iter::Iterator>::next` at /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/std/src/fs.rs:2303:9: 2303:22
     = note: inside `<std::iter::Map<std::fs::ReadDir, {closure@tests/pass/shims/fs.rs:307:18: 307:21}> as std::iter::Iterator>::next` at /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:107:9: 107:25
     = note: inside `<std::iter::Map<std::fs::ReadDir, {closure@tests/pass/shims/fs.rs:307:18: 307:21}> as std::iter::Iterator>::collect::<std::vec::Vec<(std::ffi::OsString, bool)>>` at /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2027:9: 2027:38
     = note: inside `<std::collections::BTreeMap<std::ffi::OsString, bool> as std::iter::FromIterator<(std::ffi::OsString, bool)>>::from_iter::<std::iter::Map<std::fs::ReadDir, {closure@tests/pass/shims/fs.rs:307:18: 307:21}>>` at /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/alloc/src/collections/btree/map.rs:2347:34: 2347:60
     = note: inside `<std::iter::Map<std::fs::ReadDir, {closure@tests/pass/shims/fs.rs:307:18: 307:21}> as std::iter::Iterator>::collect::<std::collections::BTreeMap<std::ffi::OsString, bool>>` at /home/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2027:9: 2027:38
  note: inside `test_directory`
    --> tests/pass/shims/fs.rs:305:9
     |
  LL | /         read_dir(&dir_path)
  LL | |             .unwrap()
  LL | |             .map(|e| {
  LL | |                 let e = e.unwrap();
  LL | |                 (e.file_name(), e.metadata().unwrap().is_file())
  LL | |             })
  LL | |             .collect::<BTreeMap<_, _>>()
     | |________________________________________^

Cc @YohDeadfall @LorrensP-2158466

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions