Closed
Bug 827148
Opened 12 years ago
Closed 12 years ago
More creation time woes
Categories
(Toolkit Graveyard :: OS.File, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: rnewman, Assigned: Yoric)
References
Details
Things I've found:
* There is no longer any creation time exposed through OS.File on Linux.
https://tbpl.mozilla.org/?tree=Try&rev=868deba6a819
-- creationDate quietly returns 0.
Instead, I have to try something like this:
date = info.creationDate || info.s_st_ctime || info.s_st_mtime;
and hope nothing breaks.
* macBirthDate doesn't seem to work at all. I'm running on 10.8.2 with HFS+:
self._log.debug("INFO: " + JSON.stringify(info));
self._log.debug("CREATION: " + info.creationDate);
self._log.debug("BIRTH: " + info.macBirthDate);
0:00.40 INFO: {"isDir":false,"isSymLink":false,"size":0,"creationDate":"2013-01-06T19:08:14.000Z","lastAccessDate":"2013-01-06T19:08:14.000Z","lastModificationDate":"2013-01-06T19:08:14.000Z","unixLastStatusChangeDate":"2013-01-06T19:08:14.000Z","unixOwner":501,"unixGroup":501,"unixMode":420}
0:00.40 CREATION: Sun Jan 06 2013 11:08:14 GMT-0800 (PST)
0:00.40 BIRTH: undefined
This doesn't make any sense at all:
// Deprecated, use macBirthDate/winBirthDate instead
get creationDate() {
// On the Macintosh, returns the birth date if available.
// On other Unix, as the birth date is not available,
// returns the epoch.
return this.macBirthDate || new Date(0);
},
implies that if I'm getting `undefined` there, I should be getting epoch for creationDate. What's going on?
Reporter | ||
Comment 1•12 years ago
|
||
Further:
self._log.debug("macBirthDate present? " + ("macBirthDate" in info));
> 0:00.58 macBirthDate present? false
Assignee | ||
Comment 2•12 years ago
|
||
> * There is no longer any creation time exposed through OS.File on Linux.
That's by design. The information is simply not available at system level (see e.g. http://linux.die.net/man/2/fstat)
So WONTFIX for this part of the bug.
> * macBirthDate doesn't seem to work at all. I'm running on 10.8.2 with HFS+:
[...]
Mhhh... Sounds like there is a problem with _DARWIN_FEATURE_64_BIT_INODE. I'll take a look. How urgent is that for you?
Assignee: nobody → dteller
Reporter | ||
Comment 3•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] <away until Jan 7th> from comment #2)
> > * There is no longer any creation time exposed through OS.File on Linux.
>
> That's by design. The information is simply not available at system level
> (see e.g. http://linux.die.net/man/2/fstat)
>
> So WONTFIX for this part of the bug.
So this is the best course of action?
function onStatSuccess(info) {
// OS.File doesn't seem to be behaving. See Bug 827148.
// Let's do the best we can. This whole function is defensive.
let date;
if ("winBirthDate" in info) {
date = info.winBirthDate;
} else if ("macBirthDate" in info) {
date = info.macBirthDate;
}
if (!date || !date.getTime()) {
self._log.debug("No birth date: using ctime/mtime.");
try {
date = info.creationDate ||
info.lastModificationDate ||
info.unixLastStatusChangeDate;
} catch (ex) {
self._log.debug("Exception fetching creation date: " + ex);
}
}
if (date) {
let timestamp = date.getTime();
self._log.debug("Using date: " + entry.path + " = " + date);
if (timestamp < oldest) {
oldest = timestamp;
}
}
> Mhhh... Sounds like there is a problem with _DARWIN_FEATURE_64_BIT_INODE.
> I'll take a look. How urgent is that for you?
If it affects the accuracy of the returned value, we will need a fix landed in Aurora for FHR.
Assignee | ||
Comment 4•12 years ago
|
||
(In reply to Richard Newman [:rnewman] from comment #3)
> (In reply to David Rajchenbach Teller [:Yoric] <away until Jan 7th> from
> comment #2)
> > > * There is no longer any creation time exposed through OS.File on Linux.
> >
> > That's by design. The information is simply not available at system level
> > (see e.g. http://linux.die.net/man/2/fstat)
> >
> > So WONTFIX for this part of the bug.
>
> So this is the best course of action?
Something along the lines of:
date = info.winBirthDate || info.macBirthDate || info.lastModificationDate
> > Mhhh... Sounds like there is a problem with _DARWIN_FEATURE_64_BIT_INODE.
> > I'll take a look. How urgent is that for you?
>
> If it affects the accuracy of the returned value, we will need a fix landed
> in Aurora for FHR.
I will work on it this week.
Assignee | ||
Comment 5•12 years ago
|
||
Ok, this should be fixed by bug 802534.
Assignee | ||
Comment 6•12 years ago
|
||
Richard, can you confirm that the new behavior works for you?
Flags: needinfo?(rnewman)
Reporter | ||
Comment 7•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #6)
> Richard, can you confirm that the new behavior works for you?
I don't see a concise summary of what the new behavior is, beyond Comment 4, so my only answer is "I think so"!
We do this:
function onEntry(entry) {
function onStatSuccess(info) {
let date = info.winBirthDate || info.macBirthDate;
if (!date || !date.getTime()) {
self._log.debug("No birth date. Using mtime.");
date = info.lastModificationDate;
}
if (date) {
let timestamp = date.getTime();
self._log.debug("Using date: " + entry.path + " = " + date);
if (timestamp < oldest) {
oldest = timestamp;
}
}
}
and our basic tests pass.
Flags: needinfo?(rnewman)
Assignee | ||
Comment 8•12 years ago
|
||
Closing the test, then.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•2 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•