-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
mknod: fix SELinux cleanup when context setting fails #10582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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. |
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