Bug 358701 - /bin/cp can cause data loss on filesystems that are not SELinux aware
/bin/cp can cause data loss on filesystems that are not SELinux aware
Status: CLOSED DUPLICATE of bug 219900
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
low Severity urgent
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-30 13:48 EDT by Elliot Lee
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-30 14:05:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to fix this problem (457 bytes, text/x-patch)
2007-10-30 13:48 EDT, Elliot Lee
no flags Details

  None (edit)
Description Elliot Lee 2007-10-30 13:48:11 EDT
Description of problem:

On a filesystem such as NFS that doesn't know how to store SELinux metadata,
/bin/cp can create empty target files due to incorrect error handling.

Version-Release number of selected component (if applicable):
coreutils-6.9-6.fc8

How reproducible:
100%

Steps to Reproduce:
1. Go to an NFS-mounted directory that has a non-empty file named 'file1'.
2. Run 'cp -av file1 file2'.
3. Run 'cp -av file1 file2' again.
  
Actual results:
file2 is empty

Expected results:
file2 has same contents as file1

Additional info:

Patch is attached that fixes this particular case. However, I would almost argue
that all errors generated by fsetfilecon() should be ignored (and not just
EOPNOTSUPP), simply because they're not fatal, and because truncating the user's
files to zero-length is a really bad outcome for a basic utility like /bin/cp.
Comment 1 Elliot Lee 2007-10-30 13:48:12 EDT
Created attachment 243681 [details]
Patch to fix this problem
Comment 2 Ondrej Vasik 2007-10-30 14:05:59 EDT
That is more workaround than patch. Anyway - I have a fix for that - so this bug
is duplicate of #219900 (patch will hopefully make it into F8 final)

*** This bug has been marked as a duplicate of 219900 ***

Note You need to log in before you can comment on or make changes to this bug.