Subject: bug#7612: cp -pu NTFS problem

From: Garry Trethewey <[email-masked]>
Date: Sat, 11 Dec 2010 10:59:38 +1030

Hello

The attachment has this same text but might be easier to read than an email.

I don't know if this is a NTFS-3g bug, or a coreutils cp bug, or 
neither, or both.

I've asked the <[email-masked]> list, which hasn't been able to 
help apart from confirming that someone else has the same problem.

Problem
Trying to cp -pu  from an NTFS partition to an ext3 partition, the 
timestamps look OK, both with terminal ls -l and in nautilus (Date 
Modified and Date Accessed).

The -u option says that the same file should not get copied again unless 
it's changed.

But it does get copied again, and again

Just to remind,
-p     same as --preserve=mode,ownership,timestamps
-u, --update copy only when the SOURCE file is newer than the
destination file or when the destination file is missing

So here's the longer version with too many details.

For a couple of years I've been doing
cp -puv -t $dest $source
from one ext3 partition to another, no problem.

But now I've copied my whole data disk to an NTFS partition on a USB
portable hard drive. NTFS so I can use it at work.

I want to copy files from this NTFS partition to an ext3 destination
with timestamps intact, so that next week when I do the same thing, I
only copy new or changed files.

Demo* code is
source=/media/data/aaa_S500_data/*    # the NTFS partition
dest='/home/garry/Desktop/junk'       # a ext3 partition
cp -puv -t $dest $source
Demo*   Really I look at 30GB and 20,000 files, that's why I don't want 
to be copying the same thing repeatedly.

Here is a demo source directory
garry@S500-lucid:~$ ls -l /media/data/aaa_S500_data/
total 64
-rwxrwxrwx 1 garry garry 38254 2010-12-02 06:20 elephantGreen.ico
-rwxrwxrwx 1 garry garry  5978 2010-10-25 17:27 elephant.ico
-rwxrwxrwx 1 garry garry    69 2010-11-30 05:55 readme.txt
-rwxrwxrwx 1 garry garry   766 2002-10-14 04:27 wdlogo.ico
-rwxrwxrwx 1 garry garry  5978 2010-10-25 17:27 wooly-mammoth.ico
garry@S500-lucid:~$

So into an empty directory, '/home/garry/Desktop/junk'  I copy
garry@S500-lucid:~$ cp -puv  -t '/home/garry/Desktop/junk'
/media/data/aaa_S500_data/*
`/media/data/aaa_S500_data/elephantGreen.ico' -> 
`/home/garry/Desktop/junk/elephantGreen.ico'
`/media/data/aaa_S500_data/elephant.ico' -> 
`/home/garry/Desktop/junk/elephant.ico'
`/media/data/aaa_S500_data/readme.txt' -> 
`/home/garry/Desktop/junk/readme.txt'
`/media/data/aaa_S500_data/wdlogo.ico' -> 
`/home/garry/Desktop/junk/wdlogo.ico'
`/media/data/aaa_S500_data/wooly-mammoth.ico' -> 
`/home/garry/Desktop/junk/wooly-mammoth.ico'
garry@S500-lucid:~$

Then without changing any files in $source, and if I do
cp -puv  -t '/home/garry/Desktop/junk' /media/data/aaa_S500_data/*
again, nothing should be copied.

But the two files that were created / altered on the NTFS partition
_AFTER_ it got created with gparted & partimage get copied again.

garry@S500-lucid:~$ cp -puv  -t '/home/garry/Desktop/junk' 
/media/data/aaa_S500_data/*
`/media/data/aaa_S500_data/elephantGreen.ico' -> 
`/home/garry/Desktop/junk/elephantGreen.ico'
`/media/data/aaa_S500_data/readme.txt' -> 
`/home/garry/Desktop/junk/readme.txt'
garry@S500-lucid:~$

and again

garry@S500-lucid:~$ cp -puv -t $dest $source
`/media/data/aaa_S500_data/elephantGreen.ico' -> 
`/home/garry/Desktop/junk/elephantGreen.ico'
`/media/data/aaa_S500_data/readme.txt' -> 
`/home/garry/Desktop/junk/readme.txt'

here is my /etc/fstab
proc            /proc           proc    nodev,noexec,nosuid 0       0
UUID=a49e1eb6-72bc-465d-9852-ce99403d303f /               ext3 
errors=remount-ro 0       1
UUID=f13a83d6-fdfd-4dc7-b67c-a3d47c9fd727 none            swap    sw 
        0       0
UUID=07B3B28C580F4BEA /media/data     ntfs-3g 
defaults,umask=000,uid=1000,gid=1000 0       1
#UUID=07B3B28C580F4BEA /media/data     ntfs-3g 
defaults,relatime,umask=000,uid=1000,gid=1000 0       1
#UUID=07B3B28C580F4BEA /media/data     ntfs    defaults  0       1
UUID=c1841d07-7991-4e9c-8d35-969cb49ccf28  /media/toybox_data  ext3 
defaults   0   2

I tried
touch --reference '/media/data/aaa_S500_data/newfile' 
'/home/garry/Desktop/junk/newfile'
but that made no difference.

What I'm using:-
ubuntu 10.04
ntfs-3g 2010.3.6       	#came with ubuntu
ntfs-3g 2010.10.2	#installed today
GNU Bash-4.1
cp in GNU coreutils 7.4

So is this a proper bug that I should put on launchpad? Looks like it to 
me, but I'm amazed if nobody else found it first.

regards

------------------------------------
Garry Trethewey
------------------------------------