Closed Bug 1666221 Opened 4 years ago Closed 4 years ago

Firefox fails to start when the current working directory has been deleted

Categories

(Toolkit :: Startup and Profile System, defect)

defect

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: robwu, Assigned: Gijs)

References

Details

Attachments

(1 file)

When the current working directory (cwd) has been deleted, Firefox refuses to start due to an early exit. This is unexpected, as the successful startup of Firefox should be independent of the cwd. E.g. Chrome starts just fine.

This is not a recent regression, the logic was introduced 15 years ago in bug 276588.

There is similarly error-prone logic in the updater: https://searchfox.org/mozilla-central/rev/b58ca45005fe02077c92779483d1b60e9a49687c/toolkit/xre/nsUpdateDriver.cpp#401-404

STR:

$ mkdir /tmp/profdir
$ mkdir /tmp/delme
$ cd /tmp/delme
$ rmdir /tmp/delme
$ firefox --no-remote -profile /tmp/profdir

Expected:

  • Firefox starts up

Actual:

  • Firefox does not start but exits immediately.

( I experienced this issue before, but looked deeper this time because it was a reliable way to reproduce a shutdown crash according to https://bugzilla.mozilla.org/show_bug.cgi?id=1601678#c11 )

Rob, are you intending to pursue fixing this?

Flags: needinfo?(rob)

I wasn't planning to patch this myself, at least not before bug 1601678 (since this bug makes it easier to test the other bug) .

If anyone is interested in fixing this: Check the callers of nsCommandLine::Init and remove the early return when the working dir cannot be determined. Passing nullptr is fine (there are already some callers that do this). To fix the specific issue that I reported, at least the one in nsAppRunner.cpp that I referenced above should be changed.

Flags: needinfo?(rob)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Attachment #9177521 - Attachment description: Bug 1666221 - cope with not having a working directory, r?sg!,robwu! → Bug 1666221 - cope with not having a working directory, r?Mossop!,robwu!
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/53b38c458144
cope with not having a working directory, r=robwu,mossop
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: