bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9513: improvement remark for "cp"


From: Charles ELSAESSER WebmailOrange
Subject: bug#9513: improvement remark for "cp"
Date: Thu, 15 Sep 2011 14:23:23 +0200 (CEST)

Bonjour,

Here is bug report.
Thank you for what can be done.

symptom
-------

cp -p file1 file2

does not preserve timestamp.

ls -l file1 file2
-rwxr-xr-x. 1 joe joe 11626 9 sept. 23:20 file2
-rwxr-xr-x. 1 joe joe 11626 9 sept. 23:20 file1

ls --full-time $f1 $f2
-rwxr-xr-x. 1 joe joe 11626 2011-09-09 19:20:27.000000000 +0200 file2
-rwxr-xr-x. 1 joe joe 11626 2011-09-09 19:20:26.000000000 +0200 file1

cmp $f1 $f2
echo $?
0


comment
-------

French man page says that timestamp will be slightly different between original 
and copy
because copy operation needs a read access to source file.

On the documentation point of view, this seems to be a wrong expression because 
reading timestamp original file
needs a read access to structures of directory containing original file,
which helds the last access time actime and the last modification time mtime
but not to file itself.

But after processing of "cp -p file1 file2" , the different timestamps between 
the two files seems to be not conform to the "cp -p " functionality.

Actually, if copy process of "file1" on "file2" is long ( minutes, hours, ...)
when destination hardwares are slow,
then timestamps can be very different.

Am I wrong?

As a consequence when processing after this a
cp -u file1 file2
update is not processed because destination file is newer than original file.

Other consequences may happen on files management applications.

action
------

At least user should be warned by a mention in man page of "cp" of existence of 
function "touch" which seems to execute the timestamp setting, if requested.

When user requires "cp -p" he cannot suspect that his requirement will not be 
executed.

Can anything be done to correct GNU "cp" function, for example processing a 
"touch" like function ?

system technical level
----------------------
SLinux localhost 2.6.32-131.12.1.el6.i686 #1 SMP Tue Aug 23 11:12:55 CDT 2011 
i686 i686 i386 GNU/Linux

software technical level
------------------------
cp (GNU coreutils) 8.4
GNU coreutils 8.4 November 2010 CP(1)

man documentation level ( french)
---------------------------------

TRADUCTION
Ce document est une traduction réalisée par Christophe Blaess
le 5 décembre 1996, mise à jour par Alain
Portal  le 8 juillet 2005 et révisée le
19 novembre 2007.
i.e.

TRANSLATION
This document is a translation processed by Christophe Blaess
on 5 december 1996, updated by Alain
Portal  on 8 july 2005 and revised on
19 novembre 2007.

comments in man documentation ( french)
---------------------------------------

OPTIONS POSIX
Posix définit quatre options et demi :
...
-p Conserver le propriétaire, le groupe, les permissions d’accès et les
horodatages du fichier original. Si la conservation du propriétaire ou
du groupe est impossible, les bits Set-UID et Set-GID sont effacés.
L’horodatage sera quand même légèrement différent entre l’original et
la copie car l’opération de copie nécessite un accès en lecture au
fichier source.
...
OPTIONS GNU
...
-p, --preserve
Conserver le propriétaire, le groupe, les permissions d’accès et les
horodatages du fichier original.
...
i.e. ( french comments translated to english)

OPTIONS POSIX
Posix defines four options and a half :
...
-p Keep owner,group, access rights and timestamps of original file.
If owner or group cannot be kept, then bits Set-UID and Set-GID are erased.
Timestamp may be slightly different between original and copy
because copy operation needs a read access to source file.
...
OPTIONS GNU
...
-p, --preserve
Keep owner, group, access rights and timestamp of original file.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]