git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
ASAndrew Sayers <andrew-git@pileofstuff.org>
Date
Jul 26, 2010, 21:39 UTC
Message-ID
<4C4E00AE.7010904@pileofstuff.org>
In-Reply-To
<1280096368.7211.2.camel@soho.example.org>

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
Previous: solsTiCe d'HiverNext: solsTiCe d'Hiver
Message 5 of 7 in “[bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git”
  1. solsTiCe d'HiverJul 25, 2010
  2. Ævar Arnfjörð BjarmasonJul 25, 2010
  3. Andrew SayersJul 25, 2010
  4. solsTiCe d'HiverJul 25, 2010
  5. Andrew SayersJul 26, 2010
  6. solsTiCe d'HiverJul 27, 2010
  7. solsTiCe d'HiverJul 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.