Re: [PATCH] specify encoding for sed command
- Date: Mon, 09 Apr 2018 08:17:51 +0900
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: [PATCH] specify encoding for sed command
Stephon Harris <theonestep4@xxxxxxxxx> writes:
> Fixes issue with seeing `sed: RE error: illegal byte sequence` when running git-completion.bash
> ---
> contrib/completion/git-completion.bash | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index b09c8a23626b4..52a4ab5e2165a 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -282,7 +282,7 @@ __gitcomp ()
>
> # Clear the variables caching builtins' options when (re-)sourcing
> # the completion script.
> -unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null
> +unset $(set |LANG=C sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null
Shouldn't LC_ALL and LANG both set and exported to C, as
(1) ancient systems understand only LANG but not LC_*; and
(2) modern ones that understand both give precedence to LC_ALL over
LANG?
If we were to set only one, it is probably more sensible to set
LC_ALL, I suspect, but it may be better to set both, which sends a
sign to the readers that we know what we are doing ;-)