Skip to content

Don't delete output file if it's a character device #546

@davidlattimore

Description

@davidlattimore

In PR #541, I observed a test fail on opensuse.

Caused by:
  process didn't exit successfully: `/__w/wild/wild/target/ci/deps/integration_tests-deec41fcb682a572` (signal: 7, SIGBUS: access to undefined memory)

I was then able to intermittently observe the same failure when running the tests in an OpenSUSE docker image. I eventually figured out the problem. One of the integration tests outputs to /dev/null. Wild renames the output file, creates a new file in its place, then deletes the old file. This is fine when the output is a regular file. It's also fine when the output is /dev/null provided we don't have permission to rename it. In that case we open it, find that we can't mmap it, build the output file in memory, then write the output to that file. However, in the docker image, we have root, which means we have write access to /dev, so we can rename and later delete /dev/null. After doing that, we create a regular file in its place. The SIGBUS was happening because some other thread was also writing to /dev/null, which was causing our output file to be truncated.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions