mknod: fix SELinux cleanup when context setting fails#10582
mknod: fix SELinux cleanup when context setting fails#10582ChrisDryden merged 3 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
|
It looks like CI failed in an unrelated Happy to rebase or rerun CI if needed. |
|
Can you make a regression test for this in test_mknod.rs? |
|
test_selinux_invalid in tests/by-util/test_mkdir.rs is almost identical You can use arg("p") for FIFO and at.file_exists() instead of at.dir_exists() |
|
GNU testsuite comparison: |
|
can you run cargo fmt? |
I ran cargo fmt and cargo fmt --check locally — both complete successfully with no changes. |
|
The error in the CI https://github.com/uutils/coreutils/actions/runs/21542607295/job/62082424264?pr=10582 is That is good feedback though, I think there should be a way that we can change the settings to make it so that no matter what platform you're on it can fix this errors. I'm assuming you're on a windows or mac? |
|
GNU testsuite comparison: |
I noticed other test files end with a newline, so I added one here as well. Yes, i am on mac |
|
Thanks for the contribution! |
Summary
Fixes SELinux cleanup logic in
mknodwhen setting the security context fails.Previously, uutils attempted to clean up a partially created device node using
std::fs::remove_dir, which does not work for device nodes or FIFOs. This could leave behind a mislabeled node on SELinux-enforcing systems.Changes
std::fs::remove_dirwithstd::fs::remove_filefor proper cleanupTest / Reproduction Steps