Closed Bug 1303693 Opened 8 years ago Closed 8 years ago

OS.File.remove(filename, { ignoreAbsent: true }) throws when the parent directory doesn't exist.

Categories

(Toolkit Graveyard :: OS.File, defect)

All
Windows
defect
Not set
normal

Tracking

(firefox51 fixed, firefox52 fixed)

RESOLVED FIXED
mozilla52
Tracking Status
firefox51 --- fixed
firefox52 --- fixed

People

(Reporter: markh, Assigned: markh)

References

Details

Attachments

(2 files)

Attached patch A failing testSplinter Review
OS.File.remove(absent_file_name, {ignoreAbsent: true}) correctly succeeds when absent_file_name doesn't exist but its parent does, but throws when the parent doesn't exist.

Attaching a test, which results in:

> 0:00.58 PROCESS_OUTPUT: Thread-1 (pid:19740) "OS Controller Posting message {"fun":"remove","args":[{"string":"absent_parent\\\\test_osfile_front_absent.tmp"},{"ignoreAbsent":true}],"id":6}"
> 0:00.58 PROCESS_OUTPUT: Thread-1 (pid:19740) "OS Controller Message posted"
> 0:00.58 PROCESS_OUTPUT: Thread-1 (pid:19740) "OS Controller Expecting reply"
> 0:00.58 PROCESS_OUTPUT: Thread-1 (pid:19740) "OS Controller Received message from worker {"fail":{"exn":"OS.File.Error","fileName":"(unknown module)","lineNumber":0,"stack":"","operation":"remove","winLastError":3,"path":"absent_parent\\\\test_osfile_front_absent.tmp"},"id":6}"
> 0:00.58 PROCESS_OUTPUT: Thread-1 (pid:19740) "OS Controller Got error {"data":{"exn":"OS.File.Error","fileName":"(unknown module)","lineNumber":0,"stack":"","operation":"remove","winLastError":3,"path":"absent_parent\\\\test_osfile_front_absent.tmp"}}"
> 0:00.58 TEST_STATUS: Thread-1 test_ignoreAbsent_directory_missing FAIL [test_ignoreAbsent_directory_missing : 55] OS.File.remove should not throw when not requested. - false == true
> ... 

(It's possible this is Windows only - ERROR_FILE_NOT_FOUND (2) != ERROR_PATH_NOT_FOUND (3), whereas IIRC, enoent is used for both situations elsewhere? I'll check later)

Yoric, can you please confirm the current behaviour isn't intended?
Flags: needinfo?(dteller)
Good catch, that's not the expected behavior.
Flags: needinfo?(dteller)
Assignee: nobody → markh
This is a windows only issue. Patch forthcoming.
OS: Unspecified → Windows
Hardware: Unspecified → All
Comment on attachment 8792721 [details]
Bug 1303693 - OS.File.remove(filename, { ignoreAbsent: true }) throws when the parent directory doesn't exist.

https://reviewboard.mozilla.org/r/79634/#review78334

Looks good to me, thanks for the patch.
Attachment #8792721 - Flags: review?(dteller) → review+
Pushed by mhammond@skippinet.com.au:
https://hg.mozilla.org/integration/autoland/rev/0dbdd9bae77e
OS.File.remove(filename, { ignoreAbsent: true }) throws when the parent directory doesn't exist. r=Yoric
https://hg.mozilla.org/mozilla-central/rev/0dbdd9bae77e
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Comment on attachment 8792721 [details]
Bug 1303693 - OS.File.remove(filename, { ignoreAbsent: true }) throws when the parent directory doesn't exist.

Approval Request Comment
[Feature/regressing bug #]: N/A
[User impact if declined]: Unexpected behaviour in some cases, which results in Sync writing an error logfile when there was no error (bug  1303677)
[Describe test coverage new/current, TreeHerder]: new tests
[Risks and why]: Low risk this early in the cycle
[String/UUID change made/needed]: None
Attachment #8792721 - Flags: approval-mozilla-aurora?
Comment on attachment 8792721 [details]
Bug 1303693 - OS.File.remove(filename, { ignoreAbsent: true }) throws when the parent directory doesn't exist.

This patch fixes a test and sync writing an error logfile issue. Take it in 51 aurora.
Attachment #8792721 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
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: