Subject: Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git

From: Andrew Sayers <[email-masked]>
Date: Mon, 26 Jul 2010 22:39:58 +0100

On 25/07/10 23:19, solsTiCe d'Hiver wrote:
<snip>
> When I add the above command at line 98, it shows it is really bash
> running:
> 4.1.7(2)-release
> cmdhist:expand_aliases:extglob:extquote:force_fignore:interactive_comments:progcomp:promptvars:sourcepath 

Hmm, that's interesting.  It's certainly bash, but I don't see
"login_shell" in the list, which suggests that something is loading bash
completion stuff in a non-interactive shell that has no need for it.
That might increase your your boot time a bit, so you may want to take
it up with Arch Linux when we've got to the bottom of this.

One way I've found to replicate your behaviour is to call bash as sh:

$ ln -s /bin/bash sh
$ ./sh -c 'echo $BASH_VERSION'
4.1.5(1)-release
$ ./sh contrib/completion/git-completion.bash
contrib/completion/git-completion.bash: line 123: ...

Again, this fits with the theory that some non-interactive shell is
wrongly loading this stuff.

This time, could you tell me what the following debug messages print:

echo $BASHOPTS -- $SHELLOPTS -- $POSIXLY_CORRECT
tr '\0' ' ' < /proc/$$/cmdline ; echo

Could you also have a look at /bin/sh and any other files that might be
(incorrectly?) symlinked to bash?

On a wider point, I consider the bash/sh behaviour above to be a bug,
whether or not it's the cause of this specific problem.  Unless someone
wants to tell me about git's long-standing policy against it, I'll try
and find some time to send in a patch warning usefully in this case.

	- Andrew