[PATCH]: cp: make -a option preserve SELinux context and xattrs with red
From:
Ondřej Vašík
Subject:
[PATCH]: cp: make -a option preserve SELinux context and xattrs with reduced diagnostics
Date:
Mon, 09 Feb 2009 16:10:33 +0100
Hello,
I sent patch about cp -a and it's failure to preserve SELinux context in
October 08. Meanwhile xattr support was added to cp. As described in
info pages -a option means "Preserve as much as possible of the
structure and attributes of the original files". Therefore it should
preserve xattr if possible as well. This would mean additional possible
failure reports, which are not acceptable for cp -a option. Therefore I
had to remove displaying them for it.
After patch it should work like:
1) cp -a tries to preserve SELinux context and xattr, but doesn't inform
about possible failures
2) cp --preserve=all tries to preserve SELinux context and xattr, but
does inform about failures and doesn't fail if xattr/SELinux context are
not preserved
3) cp --preserve=context,xattr obviously tries to preserve attributes,
inform about failures and does fail if xattr/SELinux context is not
preserved
NOTE: Added documentation of --preserve=context, description of current
behaviour to cp --preserve=all and cp -a documentation. Added tests to
ensure that cp -a actually works with SELinux (until now it was checking
just failures.
Greetings,
Ondřej Vašík