GNOME Bugzilla – Bug 634320
file copy doesn't preserve nanosecond timestamps
Last modified: 2018-05-24 12:51:34 UTC
this report has been filed here: https://bugs.edge.launchpad.net/ubuntu/+source/nautilus/+bug/642596 "When copying files in Nautilus, the low 3 decimal digits in the copy are set to zero. In other words, it only preserves 2-microsecond resolution. Steps to reproduce: 1. Create a file (on a filesystem supporting nanosecond timestamps) and view its timestamp: username@host:/dev/shm$ touch original-file username@host:/dev/shm$ ls --full-time original-file -rw-r--r-- 1 username username 0 2010-09-19 07:27:56.463178584 +0000 original-file 2. Copy file in Nautilus to the same or another filesystem, and view new file's timestamp # original-file copied to file-nautilus username@host:/dev/shm$ ls --full-time file-nautilus -rw-r--r-- 1 username username 0 2010-09-19 07:27:56.463178000 +0000 file-nautilus Expected result: New file has exactly the same timestamp. For example, cp --preserve=all works properly: username@host:/dev/shm$ cp --preserve=all original-file file-cp username@host:/dev/shm$ ls --full-time file-cp -rw-r--r-- 1 username username 0 2010-09-19 07:27:56.463178584 +0000 file-cp Actual result: last 3 digits of copy are 000."
This is a glib/gio issue. The same thing can be observed by using gvfs-copy at the command-line.
Still affects Gnome 3.26 and probably newer. Since gio presumably doesn't leverage GNU cp(1) but rather attempts to re-implement the copy functionality, the easiest solution is to extend the internal data representation to nanoseconds to match GNU coreutils and the Linux kernel. See timespec.h in coreutils (any version) for what this should look like. Note that Linux *never* had microsecond timestamps: we went from seconds straight to nanoseconds circa 2002. So you are about to gain the glory of fixing a 15 year old bug. Related bug report in Nautilus: https://gitlab.gnome.org/GNOME/nautilus/issues/268
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/369.