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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> 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@xxxxxxxxxxxxxx
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]