#7 closed defect (fixed)

[libstd] std::fs::read_dir does not iterate

Reported by: nielx Owned by: nielx
Priority: major Milestone: 1.0.0-beta
Component: libstd Version: 1.17.0
Keywords: Cc:


Tested on both x86 and x86_64 with Rust 1.17.0 and 1.18.0.

The build.rs script of the backtrace-sys package uses this function to call objcopy. In the console output it seems that objcopy is called endlessly on the first entry of the directory.

This indicates something is wrong with the function.

Change History (5)

comment:1 Changed 16 months ago by nielx

Component: rustclibstd

comment:2 Changed 16 months ago by nielx

Milestone: 1.0.0-beta

I have tested the working of the function in a separate test, and then it works fine.

My hypothesis is that Haiku rewinds the iterator when the underlying file is removed and re-added. The underlying call is opendir.

See: https://stackoverflow.com/questions/1676522/delete-files-while-reading-directory-with-readdir

If the hypothesis is correct, the question is what the right behavior should be. Should Haiku be 'fixed' or does the backtrace-sys package rely on undocumented behavior.

comment:5 Changed 16 months ago by nielx

Resolution: fixed
Status: newclosed

Fixed upstream; turned out to be a bug of the build.rs script of backtrace-sys, which relied on undefined behavior.

Note: See TracTickets for help on using tickets.