Attributes not correctly copied (caused by fix to ticket #4015)
|Reported by:||someguy||Owned by:||stippi|
File attributes are not copied correctly when using cp from the terminal. The problem is caused by a bug introduced by ticket #4015 (hrev31000). A change was made to cp in order to copy empty attributes in files. The fix has a bug in it however.
Line 166 in haiku/trunk/src/bin/coreutils/src/copy.c currently reads:
if (bytesWritten != bytesRead bytesRead == 0)
It should read:
if (bytesWritten == bytesRead bytesRead == 0)
The way it currently is, it continues through the loop one more time which writes 0 bytes to the attribute which erases the bits written the first time through.
The bug can be reproduced simply by copying any file with attributes from the terminal using cp. You'll find the copied file has all the attributes of the original file, but they are empty. My privately built cp with the change fixes the problem.