Closed Bug 858723 Opened 12 years ago Closed 12 years ago

[OS.File] File 0 will not work

Categories

(Toolkit Graveyard :: OS.File, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
mozilla23

People

(Reporter: Yoric, Assigned: Yoric)

References

Details

Attachments

(1 file, 5 obsolete files)

In the async version of OS.File, osfile_async_worker.js gives a unique number to each file, used to communicate with osfile_async_front.jsm. In osfile_async_front.jsm, however, we consistently check |if (filenum)| or |if (!filenum)| to ensure that |filenum != null|. This doesn't work if |filenum == 0|. I have no idea why no test ever caught his, but we need to fix this quickly.
Actually, this seems a little less widespread than I thought. The first file we open (and only the first file): - cannot be closed; - cannot be stat()-ed. Still, we need to fix this.
Attached patch Fixing File 0 (obsolete) — Splinter Review
Assignee: nobody → dteller
Attachment #734024 - Flags: review?(nfroyd)
Comment on attachment 734024 [details] [diff] [review] Fixing File 0 Review of attachment 734024 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/osfile/tests/xpcshell/xpcshell.ini @@ +1,5 @@ > [DEFAULT] > head = > tail = > > +[test_osfile_closed.js] |hg add| is your friend.
Attachment #734024 - Flags: review?(nfroyd) → review-
Attached patch Fixing File 0, v2 (obsolete) — Splinter Review
Oops
Attachment #734024 - Attachment is obsolete: true
Attachment #735122 - Flags: review?(nfroyd)
Comment on attachment 735122 [details] [diff] [review] Fixing File 0, v2 Review of attachment 735122 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/osfile/osfile_async_worker.js @@ +42,5 @@ > options = data.args[data.args.length - 1]; > } > // If |outExecutionDuration| option was supplied, start measuring the > // duration of the operation. > + if (options && typeof options === "object" && "outExecutionDuration" in options) { Is this hunk supposed to be here?
Attachment #735122 - Flags: review?(nfroyd) → review+
I confess that it is a drive-by fix. I can split this 1-liner fix into another patch, if you prefer.
(In reply to David Rajchenbach Teller [:Yoric] from comment #6) > I confess that it is a drive-by fix. I can split this 1-liner fix into > another patch, if you prefer. Sneaky! I think it would be better to split it out into another patch (another bug, even).
Attached patch Fixing File 0, v3 (obsolete) — Splinter Review
Same patch, without the drive-by fix.
Attachment #735122 - Attachment is obsolete: true
Attachment #735778 - Flags: review+
This doesn't apply cleanly to inbound. Please post an updated patch.
Keywords: checkin-needed
Attached patch Fixing File 0, v4 (obsolete) — Splinter Review
I haven't experienced any bitrot on inbound. Re-attaching the patch in case I had solved the issue already for some reason.
Attachment #735778 - Attachment is obsolete: true
Attachment #738465 - Flags: review+
Backed out for mochitest-other failures. https://hg.mozilla.org/integration/mozilla-inbound/rev/4bce3c7a0f9b https://tbpl.mozilla.org/php/getParsedLog.php?id=21913722&tree=Mozilla-Inbound 07:38:37 INFO - 14827 INFO TEST-PASS | chrome://mochitests/content/chrome/toolkit/components/osfile/tests/mochi/test_osfile_async.xul | system_shutdown: File descriptors leaks are logged correctly. 07:38:37 INFO - 14828 ERROR TEST-UNEXPECTED-FAIL | chrome://mochitests/content/chrome/toolkit/components/osfile/tests/mochi/test_osfile_async.xul | system_shutdown: Leaked resource is correctly listed in the log.
Attached patch Fixing File 0, v5 (obsolete) — Splinter Review
Ok, I believe that I have fixed the issue, which was actually due to another patch that landed in the meantime. Try: https://tbpl.mozilla.org/?tree=Try&rev=cbf6e1f8bc10
Attachment #738465 - Attachment is obsolete: true
Attachment #739250 - Flags: review+
Same one, more testsuite fix. Try: https://tbpl.mozilla.org/?tree=Try&rev=544c59b0d028
Attachment #739250 - Attachment is obsolete: true
Attachment #739943 - Flags: review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: