Opened 13 days ago

Closed 9 days ago

#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:

Description

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 13 days ago by nielx

  • Component changed from rustc to libstd

comment:2 Changed 13 days ago by nielx

  • Milestone set to 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 9 days ago by nielx

  • Resolution set to fixed
  • Status changed from new to closed

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.