Skip to content

mknod: test FIFO umask and existing-file handling - #16348

Open
mattsu2020 wants to merge 3 commits into
uutils:mainfrom
mattsu2020:mknod_fifo_tests
Open

mattsu2020 wants to merge 3 commits into
uutils:mainfrom
mattsu2020:mknod_fifo_tests

Conversation

@mattsu2020

Copy link
Copy Markdown
Contributor

Add FIFO tests for umask handling with and without -m, and check that a failed creation leaves an existing file unchanged.

Related to #8342. Split from #12321 following #12321 (comment).

Comment thread tests/by-util/test_mknod.rs Outdated
ts.ucmd()
.args(&["test_file", "p"])
.fails()
.stderr_contains("File exists");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason you cannot use .stderr_is? (I don't ask to fix at here.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like using libc::EEXIST could make the code cleaner.

@oech3 oech3 Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it contains (os error ... too. No?

@mattsu2020 mattsu2020 Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if let Some(err) = mknod_err {
let _ = writeln!(
io::stderr(),
"{}: {}",
uucore::execution_phrase(),
io::Error::from(err)
);
}

I think it's fine because the implementation uses io::Error::from(err).

@mattsu2020
mattsu2020 marked this pull request as ready for review November 12, 2026 10:49
@sylvestre
sylvestre force-pushed the mknod_fifo_tests branch 2 times, most recently from c79327f to d9aca1e Compare November 16, 2026 13:44
Comment thread tests/by-util/test_mknod.rs Outdated
}

#[test]
fn test_mknod_fifo_umask() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is already covered by test_mknod_fifo_with_umask and test_mknod_fifo_with_mode_and_umask, no?
please remove it or extend those

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it

Comment thread tests/by-util/test_mknod.rs Outdated
.args(&["test_file", "p"])
.fails()
.stderr_is(format!(
"{} mknod: {}\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this locks in a bad message: no file name and a trailing "(os error 17)"
GNU shows "mknod: test_file: File exists", could you please fix mknod and test that instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed mknod.

This branch has not been deployed

No deployments
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.

3 participants