After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 634320 - file copy doesn't preserve nanosecond timestamps
file copy doesn't preserve nanosecond timestamps
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
2.38.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-11-08 14:33 UTC by Pedro Villavicencio
Modified: 2018-05-24 12:51 UTC
See Also:
GNOME target: ---
GNOME version: 2.31/2.32



Description Pedro Villavicencio 2010-11-08 14:33:53 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."
Comment 1 Ross Lagerwall 2014-03-31 07:13:30 UTC
This is a glib/gio issue. The same thing can be observed by using gvfs-copy at the command-line.
Comment 2 Paul 2018-02-21 10:42:01 UTC
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
Comment 3 GNOME Infrastructure Team 2018-05-24 12:51:34 UTC
-- 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.