cp -u

2008-06-14 Thread Markku A. Mähönen
Hi!

I'm using Ubuntu version 8.04, kernel 2.6.24-19-generic. I have done some
simple backups of directories using 'cp -u' that updates the files, if
source is newer than the destination (or if destination file is missing).

I noticed that if, for some reason, the copy of a file is interrupted (and
so the destination file is not the same size as the source) and after that
you do 'cp -u' again it does not update the interrupted file. So the 'cp -u'
does not care about the file size mismatch and cares only about the
timestamps.

So I would like to suggest that 'cp -u' should also check the size of the
files and do a copy if source is newer, or if destination is missing, or if
file sizes are different.

Regards,

Markku A. Mähönen
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: cp -u

2008-06-14 Thread Markku A. Mähönen
2008/6/14 Philip Rowlands [EMAIL PROTECTED]:


 You might find rsync to be a better tool for this task. It's more robust
 against partial-copy failures, and has the nice property that copied files
 will all carry the same mtime, whereas cp -u will not attempt to replicate
 timestamps (from a cursory check).


Ok, rsync might be better for this task (it seems to be quite a cpu hog
though). But if you forget that, imho the 'cp -u' does not work as it
should, so it is a bug.

Cheers,

Markku
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: cp -u

2008-06-14 Thread Markku A. Mähönen
2008/6/14 Bob Proulx [EMAIL PROTECTED]:


 Therefore the caller *must* check the exit code and handle errors
 appropriately if it cares about them.  I suspect that your backup
 script is not checking the exit code from cp and therefore not
 handling the original interrupt condition.


You don't get the exit code, if the system boots while 'cp -u'

/M
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: cp -u

2008-06-14 Thread Markku A. Mähönen
2008/6/14 Bob Proulx [EMAIL PROTECTED]:

 Markku A. Mähönen wrote:
  You don't get the exit code, if the system boots while 'cp -u'

 At that point the computational model of the machine is broken and
 there isn't anything that will protect you against file corruption.
 But you mentioned interrupted and therefore normal SIGINT came to
 mind.


There is a way to protect against file corruption: check the file sizes, as
I was suggesting previously.

rsync is not an answer to failing  'cp -u'

Cheers,

Markku
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils