cp
: Properly preserves fifos and symlink attributes
#8416
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8402,
misc/selinux
will pass with this -- I just added test for 2 non-SELinux set of attributes in fifo and symlinks, it's really verbose to test everything.cp: Also copy attributes in copy_symlink
Most attributes can actually be applied to symlinks (mode and
xattr are exceptions), so try to copy them, if possible.
Fort those 2 exceptions, we don't need any special handling as:
attribute is attempted to be set on the destination.
cp: File logic error when preserving attributes for fifos
There was a mismatch between the test, the comment, and the code.
The intention was to preserve attributes if the source of a
fifo/pipe still exists. Perhaps the clearest way is to modify
the test (as that avoids code duplication).
Also add a basic test for that, if permissions are preserved, the
rest should also be preserved correctly.
Fixes the first part of #8402.