git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] config --get --path: check for unset $HOME

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 26, 2010, 17:48 UTC
Message-ID
<AANLkTin6RxdVWW6qYVAyydtncGSxLK_Aoy2aWVIuoptQ@mail.gmail.com>
In-Reply-To
<20100726170837.GC4399@burratino>
On Mon, Jul 26, 2010 at 17:08, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 7 quoted lines
> Ęvar Arnfjörš Bjarmason wrote:
>
>> Should we maybe fall back on checking pw_dir in getpwuid() if $HOME isn't set?
>
> Maybe.  Why?  On Unix I suspect it is such a rare case as to not
> justify complicating the rules, but I do not know if it would help on
> other platforms.

I don't know if this is worth it, but in the Perl world this is a fairly common idiom:

    my $home = $ENV{HOME} || (getpwuid($<))[7];

Sometimes you're executing under some buggy wrapper that's scrubbing your environment. I recall running into this issue e.g. on some odd Solaris webserver, which was executing CGI scripts under my user, but $HOME wasn't set.

Previous: Jonathan Nieder
Message 5 of 5 in “config --get --path: check for unset $HOME”
  1. config --get --path: check for unset $HOMEJonathan Nieder, Jul 26, 2010
  2. Julien CristauJul 26, 2010
  3. Ævar Arnfjörð BjarmasonJul 26, 2010
  4. Jonathan NiederJul 26, 2010
  5. Ævar Arnfjörð BjarmasonJul 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.