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

Re: [PATCH] Fallback on getpwuid if envar HOME is unset

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 21, 2012, 03:54 UTC
Message-ID
<7vipccgase.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAFFUb6WiXJ0n4NkhOQ=+mcfs+uaAo2_G6TOs7L=AuPwPVfxyMg@mail.gmail.com>
Conley Owens <cco3@android.com> writes:
Show 7 quoted lines
> From f64ba3c908b33a2ea5a5ad1f0e5800af76b82ce9 Mon Sep 17 00:00:00 2001
> From: Conley Owens <cco3@android.com>
> Date: Mon, 20 Aug 2012 18:23:40 -0700
> Subject: [PATCH] Fallback on getpwuid if envar HOME is unset
>
> Signed-off-by: Conley Owens <cco3@android.com>
> ---

We can see you are doing what you claim on the title (modulo "envar" typo) to be doing, but it is unclear why this patch wants to exist in the first place.

If the user for whatever reason "unset HOME", why is it a good idea to read from a place that is found by getpwuid()? What problem does it want to fix? Why does a user want this updated behaviour?

Show 14 quoted lines
>  path.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/path.c b/path.c
> index 66acd24..60affab 100644
> --- a/path.c
> +++ b/path.c
> @@ -144,6 +144,11 @@ void home_config_paths(char **global, char **xdg,
> char *file)
>         char *to_free = NULL;
>
>         if (!home) {
> +         struct passwd *pw = xgetpwuid_self();
> +         home = pw->pw_dir;
One level of indent is a HT, not two spaces.
Show 6 quoted lines
> +       }
> +
> +       if (!home) {
>                 if (global)
>                         *global = NULL;
>         } else {
Previous: Andreas Schwab
Message 9 of 9 in “Fallback on getpwuid if envar HOME is unset”
  1. Fallback on getpwuid if envar HOME is unsetConley Owens, Aug 21, 2012
  2. Jeff KingAug 21, 2012
  3. Conley OwensAug 21, 2012
  4. Junio C HamanoAug 21, 2012
  5. Conley OwensAug 21, 2012
  6. Junio C HamanoAug 21, 2012
  7. Jeff KingAug 21, 2012
  8. Andreas SchwabAug 21, 2012
  9. Junio C HamanoAug 21, 2012

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.