Improve resolution of file times as set/get by nsLocalFile on unix
Categories
(Core :: XPCOM, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox82 | --- | fixed |
People
(Reporter: mail, Assigned: mail)
Details
Attachments
(2 files)
The current Unix implementation of nsLocalFile::SetLastModifiedTime
sets file times with the legacy utime (2)
system call, which is limited to a resolution of 1 second. Similarly when accessing these values with nsLocalFile::GetLastModifiedTime
, the implementation uses the legacy stat.st_atime
and stat.st_mtime
members which represent file access/modification times in seconds since epoch.
The current implementation is problematic, since these APIs accept a PRTime
value specified in milliseconds since epoch. The caller will have its set/get values silently truncated to the closest second.
We can update the implementations of SetLastModifiedTime
and GetLastModifiedTime
to use the utimes (2)
family of system calls instead, which allow for up to 1 microsecond resolution with the timeval
struct.
This change will also bring the unix implementation of nsLocalFile in line with the windows implementation, which does not truncate the file modification times during get/set operations.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
This change updates the unix implementation of nsLocalFile
Set/GetLastModifiedTime methods to improve the precision of file modification
times from a 1 second resolution to a 1 millisecond resolution.
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/60059f7d5c46 Improve timestamp precision for nsLocalFileUnix r=froydnj,barret
Comment 3•4 years ago
|
||
Backed out for perma failures.
Log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=312636569&repo=autoland&lineNumber=3568
Backout: https://hg.mozilla.org/integration/autoland/rev/73e37f6a354cac4e8a522a10ebac59c2f14017c8
Assignee | ||
Comment 4•4 years ago
|
||
This changes fixes some failing extension tests on unixes. These failures were
caused by a mismatch in time precision used by nsIFile and OS.File's
implementations.
The fixes are as follows:
- Use IOUtils (the C++ port of OS.File) methods where possible.
- Update the OS.File.setDates implementation to use a higher time precision
when setDates is called. This is an intermediate measure until IOUtils
itself has the ability to update file times.
Depends on D86238
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f9c823fa14ba Improve timestamp precision for nsLocalFileUnix r=froydnj,barret https://hg.mozilla.org/integration/autoland/rev/e3dd5b6b4fbd Update OS.File.setDates precision and fix failing extension tests r=barret,mixedpuppy
Comment 6•4 years ago
|
||
Backed out for perma failures. See https://bugzilla.mozilla.org/show_bug.cgi?id=1660328#c5
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/724b9714bc47 Improve timestamp precision for nsLocalFileUnix r=froydnj,barret https://hg.mozilla.org/integration/autoland/rev/f8d98e224ebc Update OS.File.setDates precision and fix failing extension tests r=barret,mixedpuppy
Comment 8•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/724b9714bc47
https://hg.mozilla.org/mozilla-central/rev/f8d98e224ebc
Description
•