Unsuitable behaviour when $HOME is not set

RESOLVED FIXED in mozilla1.9.3a5

Status

()

RESOLVED FIXED
12 years ago
8 years ago

People

(Reporter: glandium, Assigned: glandium)

Tracking

(Blocks: 1 bug)

1.8 Branch
mozilla1.9.3a5
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

12 years ago
(I've also heard of crashes, but I'm not quite sure about this)

When $HOME is not set, the application, whatever it may be, tries to find the profile in a /.$VENDOR/ directory, for example.

Basically, the main problem is that GetUnixHomeDir (http://lxr.mozilla.org/seamonkey/source/xpcom/io/SpecialSystemDirectory.cpp#222) just tries to get the HOME environment variable without a fallback. If HOME is not set, it should use getpwuid(getuid())->pw_dir (or the NSPR equivalent if there is any).

Speaking of this function, it's strange that VMS uses getenv while others use PR_GetEnv, probably something that should be corrected.

I also found several places that use the HOME environment variable, such as http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsAppFileLocationProvider.cpp#378 or http://lxr.mozilla.org/seamonkey/source/toolkit/xre/nsXREDirProvider.cpp#951, they probably should use the GetUnixHomeDir instead.
bug 291162 ?
(Assignee)

Comment 2

8 years ago
Created attachment 441799 [details] [diff] [review]
Set $HOME with data from getpwuid if $HOME is not set.

This makes sure that any code using $HOME will get a value.
Assignee: nobody → mh+mozilla
Attachment #441799 - Flags: review?(benjamin)

Updated

8 years ago
Blocks: 291162

Updated

8 years ago
Attachment #441799 - Flags: review?(benjamin) → review+
(Assignee)

Comment 3

8 years ago
http://hg.mozilla.org/mozilla-central/rev/162eea2a68e8
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in before you can comment on or make changes to this bug.