Re: [PATCH 1/2] git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION, $short_sha

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

 



On Mon, Jun 6, 2016 at 11:08 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Ville Skyttä <ville.skytta@xxxxxx> writes:
>
>> When the shell is in "nounset" or "set -u" mode, referencing unset or
>> null variables results in an error. Protect $ZSH_VERSION and
>> $BASH_VERSION against that, and initialize $short_sha before use.
>>
>> Signed-off-by: Ville Skyttä <ville.skytta@xxxxxx>
>> ---
>
> Thanks for following up.  I do not run my interactive shells with
> "set -u", so I never noticed these, but apparently you do (or you
> know who does)

I don't personally, but some do. The issue pops up every now and then
with bash-completion, e.g.
https://github.com/scop/bash-completion/issues/44

> does this patch cover everything that is not "-u" safe?

I don't know. These were the low hanging fruits I've come across. Null
$ZSH_VERSION in git-prompt.sh was the thing I ran into immediately
when enabling "nounset" mode to start looking into the above
bash-completion issue. Quick testing with zsh revealed the same issue
with null $BASH_VERSION, and you found the $short_sha one.
--
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]