git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Conley Owens <cco3@android.com>, Jeff King <peff@peff.net>,
	git@vger.kernel.org
Subject: Re: [PATCH] Fallback on getpwuid if envar HOME is unset
Date: Tue, 21 Aug 2012 20:41:59 +0200	[thread overview]
Message-ID: <m2harwccjs.fsf@igel.home> (raw)
In-Reply-To: <7vzk5ocdg7.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 21 Aug 2012 11:22:32 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Where do shells (e.g. bash and dash) go when you say "cd" without
> parameter when $HOME is unset, for example?

$ bash -c 'unset HOME; cd'
bash: line 0: cd: HOME not set
$ dash -c 'unset HOME; cd'
[no output and cwd not changed]

POSIX says:

    If no directory operand is given and the HOME environment variable
    is empty or undefined, the default behavior is
    implementation-defined and no further steps shall be taken.

Another data point: bash falls back to getpwuid when expanding ~, dash
leaves it alone.  (POSIX makes it unspecified.)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  parent reply	other threads:[~2012-08-21 18:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21  1:28 [PATCH] Fallback on getpwuid if envar HOME is unset Conley Owens
2012-08-21  2:30 ` Jeff King
2012-08-21 17:18   ` Conley Owens
2012-08-21 18:22     ` Junio C Hamano
2012-08-21 18:33       ` Conley Owens
2012-08-21 19:22         ` Junio C Hamano
2012-08-21 19:40           ` Jeff King
2012-08-21 18:41       ` Andreas Schwab [this message]
2012-08-21  3:54 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2harwccjs.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=cco3@android.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).