Closed
Bug 945536
Opened 11 years ago
Closed 2 years ago
OS.File.open throws error when trying to open an existent file if no mode is specified
Categories
(Toolkit Graveyard :: OS.File, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: Margaret, Unassigned)
Details
I ran into this issue while working on bug 941685. I found that if I tried to open a file that didn't exist, without specifying any mode. This is the error I got: [JavaScript Error: "Error writing snippets stats: Unix error 2 during operation open (No such file or directory)" {file: "jar:jar:file:///data/app/org.mozilla.fennec_leibovic-1.apk!/assets/omni.ja!/components/Snippets.js" line: 220}] As a workaround, I had to specify { append: true, write: true } (only specifying append would not fix the error).
Comment 1•11 years ago
|
||
Well, unless I'm mistaken, OS.File.open opens for reading if there is no mode, so it needs to throw if the file doesn't exist.
Reporter | ||
Comment 2•11 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] <needinfo? me> from comment #1) > Well, unless I'm mistaken, OS.File.open opens for reading if there is no > mode, so it needs to throw if the file doesn't exist. I think I was confused about the problem when I filed this bug. I agree this is working as expected, and I am catching a `becauseNoSuchFile` error as expected in this case: https://hg.mozilla.org/mozilla-central/rev/ef0cf280dd12#l2.133 However, once the file *does* exist, if I remove the mode parameter, I'm getting this error: [JavaScript Error: "Error writing snippets stats: Unix error 9 during operation write (Bad file number)" {file: "jar:jar:file:///data/app/org.mozilla.fennec_leibovic-1.apk!/assets/omni.ja!/components/Snippets.js" line: 220}] Is this expected? If so, we can just close this bug as INVALID, since specifying the append/write modes works as expected. Otherwise, I can update the summary to make this bug about this issue.
Comment 3•11 years ago
|
||
Now that sounds like a bug.
Summary: OS.File.open throws error when trying to open a non-existent file if no mode is specified → OS.File.open throws error when trying to open an existent file if no mode is specified
Comment 4•2 years ago
|
||
OSFIle is being replaced with IOUtils and PathUtils.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
Updated•11 months ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•