Comment 7 for bug 2007055

Revision history for this message
Andy (andyman1) wrote :

so I'll summarize first and then give some examples below.

In short, I'm pretty sure the issue is not rsync itself?

1. I tried rsyncing locally to /tmp instead of to the share, that works fine.
2. I used stat and ls to confirm that the modified file times were actually incorrect. Not just rsync messing up its interpretation.
3. I may have not explained this well earlier. from the 22.04 problem laptop if I change the mount option from "-o vers=3.0" to "-o vers=2.0" (i.e. change SMB protocol from v3 to v2), then rsync DOES succeed and behaves on resync. But only with exactly "2.0", not 2.1 or anything else. On the behaving 20.04 desktop, changing versions does not matter, it works regardless with any valid version.
4. looks like the linked bug is fixed with 3.2.3-8ubuntu3.1, and that's exactly what I have on the laptop. The desktop is a few version older.

I tried touch with -m and -d (I think that's what you meant? specify an alternate timestamp?) and that _does_ work when sent to the share.

Another interesting data point is that "cp -p" does _not_ work for _either_ client.

Between touch and cp's behavior that's...confusing?

some output examples:

rsync versions
---
20.04 good desktop:

$ apt list rsync
Listing... Done
rsync/focal-updates,focal-security,now 3.1.3-8ubuntu0.4 amd64 [installed]
rsync/focal-updates,focal-security 3.1.3-8ubuntu0.4 i386

22.04 bad laptop:

$ apt list rsync
Listing... Done
rsync/jammy-updates,now 3.2.3-8ubuntu3.1 amd64 [installed,automatic]
rsync/jammy-updates 3.2.3-8ubuntu3.1 i386

local rsync to /tmp attempt on 22.04 laptop:
----

$ rsync -avh test2.txt /tmp/
sending incremental file list
test2.txt

sent 1.05M bytes received 35 bytes 2.10M bytes/sec
total size is 1.05M speedup is 1.00
$ rsync -avh test2.txt /tmp/
sending incremental file list

sent 65 bytes received 12 bytes 154.00 bytes/sec
total size is 1.05M speedup is 13,617.87
$ stat /tmp/test2.txt
  File: /tmp/test2.txt
  Size: 1048576 Blocks: 2048 IO Block: 4096 regular file
Device: 28h/40d Inode: 3519 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ laptop_user) Gid: ( 1000/ laptop_user)
Access: 2023-02-23 16:55:53.792631806 -0700
Modify: 2023-02-12 18:42:55.467521856 -0700
Change: 2023-02-23 16:55:53.796631723 -0700
 Birth: -

using touch. Both cases with "-o vers=3.0" in mount options. I first touch a brand new file with an old date, then touch -m again to the existing file.
---

20.04 desktop

$ touch -d "2001-01-01" /media/scratch/test1.txt
$ stat /media/scratch/test1.txt
  File: /media/scratch/test1.txt
  Size: 0 Blocks: 16 IO Block: 1048576 regular empty file
Device: 52h/82d Inode: 2854778 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/desktop_user) Gid: ( 1000/desktop_user)
Access: 2001-01-01 00:00:00.000000000 -0700
Modify: 2001-01-01 00:00:00.000000000 -0700
Change: 2001-01-01 00:00:00.000000000 -0700
 Birth: -
$ touch -m /media/scratch/test1.txt
$ stat /media/scratch/test1.txt
  File: /media/scratch/test1.txt
  Size: 0 Blocks: 16 IO Block: 1048576 regular empty file
Device: 52h/82d Inode: 2854778 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/desktop_user) Gid: ( 1000/desktop_user)
Access: 2023-02-23 17:22:21.959479500 -0700
Modify: 2023-02-23 17:22:21.959479500 -0700
Change: 2023-02-23 17:22:21.959479500 -0700
 Birth: -

22.04 laptop

$ touch -d "2001-01-01" /media/scratch/test2.txt
$ stat /media/scratch/test2.txt
  File: /media/scratch/test2.txt
  Size: 0 Blocks: 16 IO Block: 1048576 regular empty file
Device: 66h/102d Inode: 170 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ laptop_user) Gid: ( 1000/ laptop_user)
Access: 2001-01-01 00:00:00.000000000 -0700
Modify: 2001-01-01 00:00:00.000000000 -0700
Change: 2001-01-01 00:00:00.000000000 -0700
 Birth: 2023-02-23 17:24:01.985975100 -0700
$ touch -m /media/scratch/test2.txt
$ stat /media/scratch/test2.txt
  File: /media/scratch/test2.txt
  Size: 0 Blocks: 16 IO Block: 1048576 regular empty file
Device: 66h/102d Inode: 170 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ laptop_user) Gid: ( 1000/ laptop_user)
Access: 2001-01-01 00:00:00.000000000 -0700
Modify: 2023-02-23 17:24:40.114434900 -0700
Change: 2023-02-23 17:24:40.114434900 -0700
 Birth: 2023-02-23 17:24:01.985975100 -0700

and finally, trying cp -p. again same mount command on both devices. new file being created. Note that both devices fail to copy the timestamp correctly (should be 2023-02-12). Both work sending to /tmp

20.04 desktop

$ cp -p test1.txt /media/scratch/.
$ stat /media/scratch/test1.txt
  File: /media/scratch/test1.txt
  Size: 1048576 Blocks: 2064 IO Block: 1048576 regular file
Device: 52h/82d Inode: 2854816 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/desktop_user) Gid: ( 1000/desktop_user)
Access: 2023-02-23 17:26:34.571096500 -0700
Modify: 2023-02-23 17:26:34.571096500 -0700
Change: 2023-02-23 17:26:34.571096500 -0700
 Birth: -

22.04 laptop

$ cp -p test2.txt /media/scratch/.
$ stat /media/scratch/test2.txt
  File: /media/scratch/test2.txt
  Size: 1048576 Blocks: 2064 IO Block: 1048576 regular file
Device: 66h/102d Inode: 187 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ laptop_user) Gid: ( 1000/ laptop_user)
Access: 2023-02-23 17:28:57.792628300 -0700
Modify: 2023-02-23 17:28:57.792628300 -0700
Change: 2023-02-23 17:28:57.792628300 -0700
 Birth: 2023-02-23 17:28:56.773198600 -0700

I hope that helps, and doesn't make things more confusing?