Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Anders Kaseorg <andersk(at)mit(dot)edu>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, alvherre(at)alvh(dot)no-ip(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Date: 2022-01-09 23:11:59
Message-ID: Ydtrv7YnD+ac+eQV@elch.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

## Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us):

> Isn't that a flat out violation of POSIX 8.3 Other Environment Variables?
>
> HOME
> The system shall initialize this variable at the time of login to
> be a pathname of the user's home directory. See <pwd.h>.
>
> To claim it's not, you have to claim these programs aren't logged in,
> in which case where did they get any privileges from?

After poking around across some Linuxes, it looks like people silently
agreed that "services" are not logged-in users: among the daemons,
having HOME set (as observed in /proc/*/environ) is an exception,
not the norm. I'm not sure if that's a "new" thing with systemd,
I don't have a linux with pure SysV-init available (but I guess those
are rare animals anyways).

Regards,
Christoph

--
Spare Space

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-01-09 23:16:43 Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Previous Message Tom Lane 2022-01-09 22:40:08 Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory