{"thread":{"id":"24509","subject":"[bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","startedAt":"2010-07-25T11:12:00Z","lastAt":"2010-07-27T10:43:48Z","messageCount":7,"participants":["solsTiCe d'Hiver","Ævar Arnfjörð Bjarmason","Andrew Sayers"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"146260","messageId":"1280056320.7883.9.camel@soho.example.org","threadId":"24509","inReplyTo":null,"subject":"[bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"solsTiCe d'Hiver","fromEmail":"solstice.dhiver@gmail.com","sentAt":"2010-07-25T11:12:00Z","receivedAt":"2010-07-25T11:12:00Z","isPatch":false,"sender":{"key":"solstice.dhiver@gmail.com","avatar":"https://gravatar.com/avatar/8f39aac7a4171412da9071838ca49808ba46c5da4b7cb51d0293f5289e8b4cec?d=mp&s=160"},"body":"hello,\nI want to report a tiny \"bug\" (?) and I couldn't find a bug tracker so\nhere I am\n\nWhen I boot my pc, I got an error on my console before gdm kick in to\nlaunch gnome.\n\nThis is an error in /etc/bash_completion.d/git; it says\nsyntax error near unexpected token '<' on line 123\n\nI use git 1.7.2 and bash 4.1.007 and the line 123\nof /etc/bash_completion.d/git looks like this\n\n\tdone < <(git config -z --get-regexp '^(svn-remote\\..*\\.url|bash\n\\.showupstream)$' 2>/dev/null | tr '\\0\\n' '\\n ')\n\nI think that may be there is too much < there.\n\nbut strangely if I source manually that file in a bash it works without\nerror.\n\noriginally reported there: http://bugs.archlinux.org/task/20264\n\nP.S.: I have not subscribed to the ML.\n"},{"id":"146264","messageId":"AANLkTimYo9itgVrL100mD8sU52h7f2F84PuJtCO3yKsJ@mail.gmail.com","threadId":"24509","inReplyTo":"1280056320.7883.9.camel@soho.example.org","subject":"Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-25T11:49:19Z","receivedAt":"2010-07-25T11:49:19Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Jul 25, 2010 at 11:12, solsTiCe d'Hiver\n<solstice.dhiver@gmail.com> wrote:\n\n>        done < <(git config -z --get-regexp '^(svn-remote\\..*\\.url|bash\n> \\.showupstream)$' 2>/dev/null | tr '\\0\\n' '\\n ')\n>\n> I think that may be there is too much < there.\n\nThat's not a syntax error.\n\nCC-ing Andrew Sayers who added this feature.\n"},{"id":"146330","messageId":"4C4C982C.20904@pileofstuff.org","threadId":"24509","inReplyTo":"1280056320.7883.9.camel@soho.example.org","subject":"Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"Andrew Sayers","fromEmail":"andrew-git@pileofstuff.org","sentAt":"2010-07-25T20:01:48Z","receivedAt":"2010-07-25T20:01:48Z","isPatch":false,"sender":{"key":"andrew-git@pileofstuff.org","avatar":null},"body":"\"< <()\" is indeed correct here: the first \"<\" is a normal shell\nredirect, and the \"<()\" creates a sub-shell to read input from.  This\nwas the least messy way I could find to read variables into a shell.  \"<\n$()\" won't do the job, and a normal pipe won't either:\n\n$ FOO=parent ; echo child | { read ; FOO=\"$REPLY\" ; } ; echo $FOO\nparent\n$ FOO=parent ; { read ; FOO=\"$REPLY\" ; } < $( echo child ) ; echo $FOO\nbash: child: No such file or directory\nparent\n$ FOO=parent ; { read ; FOO=\"$REPLY\" ; } < <( echo child ) ; echo $FOO\nchild\n\n\nIs \"syntax error near unexpected token '<' on line 123\" the complete\ntext of the error message you get?  bash 4.1.5 always prepends \"bash: \"\nto such errors for me:\n\n$ while false ; do echo foo ; done < ;\nbash: syntax error near unexpected token `;'\n\nIf this is the complete error text, then I suspect you may have somehow\ngot bash completion in a non-bash shell.  Could you add this on line 98\nand let me know what it says:\n\necho $BASH_VERSION $BASHOPTS\n\nIf it really is bash, $BASHOPTS might help me to replicate this problem\n(or I might have to read the man page some more).\n\n\t- Andrew\n"},{"id":"146333","messageId":"1280096368.7211.2.camel@soho.example.org","threadId":"24509","inReplyTo":"4C4C982C.20904@pileofstuff.org","subject":"Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"solsTiCe d'Hiver","fromEmail":"solstice.dhiver@gmail.com","sentAt":"2010-07-25T22:19:28Z","receivedAt":"2010-07-25T22:19:28Z","isPatch":false,"sender":{"key":"solstice.dhiver@gmail.com","avatar":"https://gravatar.com/avatar/8f39aac7a4171412da9071838ca49808ba46c5da4b7cb51d0293f5289e8b4cec?d=mp&s=160"},"body":"Le dimanche 25 juillet 2010 à 21:01 +0100, Andrew Sayers a écrit : \n> bash 4.1.5 always prepends \"bash: \"\n> to such errors for me:\n> \n> $ while false ; do echo foo ; done < ;\n> bash: syntax error near unexpected token `;'\n> \nbash 4.1.7 does that too here.\n\n> If this is the complete error text, then I suspect you may have somehow\n> got bash completion in a non-bash shell.\n> \nthe complete message is:\n/etc/bash_completion.d/git: line 123: syntax error near unexpected token\n'<'\n/etc/bash_completion.d/git: line 123: done < <(git config -z\n--get-regexp '^(svn-remote\\..*\\.url|bash > \\.showupstream)$' 2>/dev/null\n| tr '\\0\\n' '\\n ')\n\n> Could you add this on line 98 and let me know what it says:\n> echo $BASH_VERSION $BASHOPTS\n\nWhen I add the above command at line 98, it shows it is really bash\nrunning:\n4.1.7(2)-release\ncmdhist:expand_aliases:extglob:extquote:force_fignore:interactive_comments:progcomp:promptvars:sourcepath \n"},{"id":"146434","messageId":"4C4E00AE.7010904@pileofstuff.org","threadId":"24509","inReplyTo":"1280096368.7211.2.camel@soho.example.org","subject":"Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"Andrew Sayers","fromEmail":"andrew-git@pileofstuff.org","sentAt":"2010-07-26T21:39:58Z","receivedAt":"2010-07-26T21:39:58Z","isPatch":false,"sender":{"key":"andrew-git@pileofstuff.org","avatar":null},"body":"On 25/07/10 23:19, solsTiCe d'Hiver wrote:\n<snip>\n> When I add the above command at line 98, it shows it is really bash\n> running:\n> 4.1.7(2)-release\n> cmdhist:expand_aliases:extglob:extquote:force_fignore:interactive_comments:progcomp:promptvars:sourcepath \n\nHmm, that's interesting.  It's certainly bash, but I don't see\n\"login_shell\" in the list, which suggests that something is loading bash\ncompletion stuff in a non-interactive shell that has no need for it.\nThat might increase your your boot time a bit, so you may want to take\nit up with Arch Linux when we've got to the bottom of this.\n\nOne way I've found to replicate your behaviour is to call bash as sh:\n\n$ ln -s /bin/bash sh\n$ ./sh -c 'echo $BASH_VERSION'\n4.1.5(1)-release\n$ ./sh contrib/completion/git-completion.bash\ncontrib/completion/git-completion.bash: line 123: ...\n\nAgain, this fits with the theory that some non-interactive shell is\nwrongly loading this stuff.\n\nThis time, could you tell me what the following debug messages print:\n\necho $BASHOPTS -- $SHELLOPTS -- $POSIXLY_CORRECT\ntr '\\0' ' ' < /proc/$$/cmdline ; echo\n\nCould you also have a look at /bin/sh and any other files that might be\n(incorrectly?) symlinked to bash?\n\nOn a wider point, I consider the bash/sh behaviour above to be a bug,\nwhether or not it's the cause of this specific problem.  Unless someone\nwants to tell me about git's long-standing policy against it, I'll try\nand find some time to send in a patch warning usefully in this case.\n\n\t- Andrew\n"},{"id":"146459","messageId":"1280222655.9955.32.camel@soho.example.org","threadId":"24509","inReplyTo":"4C4E00AE.7010904@pileofstuff.org","subject":"Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"solsTiCe d'Hiver","fromEmail":"solstice.dhiver@gmail.com","sentAt":"2010-07-27T09:24:15Z","receivedAt":"2010-07-27T09:24:15Z","isPatch":false,"sender":{"key":"solstice.dhiver@gmail.com","avatar":"https://gravatar.com/avatar/8f39aac7a4171412da9071838ca49808ba46c5da4b7cb51d0293f5289e8b4cec?d=mp&s=160"},"body":"Le lundi 26 juillet 2010 à 22:39 +0100, Andrew Sayers a écrit : \n> This time, could you tell me what the following debug messages print:\n> \n> echo $BASHOPTS -- $SHELLOPTS -- $POSIXLY_CORRECT\n> tr '\\0' ' ' < /proc/$$/cmdline ; echo\n> \ncmdhist:expand_aliases:extglob:extquote:force_fignore:interactive_comments:progcomp:promptvars:sourcepath -- braceexpand:hashshell:interactive-comments:posix -- y\n/bin/sh /usr/sbin/gdm\n\n> Could you also have a look at /bin/sh and any other files that might be\n> (incorrectly?) symlinked to bash?\n> \nI have included gdm in the DAEMON list in my /etc/rc.conf. I tried to\nrun it from inittab in a more usual way and get the same ?!\n\nWhen I looked at /usr/sbin/gdm, I found the cause of this problem, look\nat that\n\n#!/bin/sh\n#\n# A script so that\n#    1) we read the standard system env vars\n#    2) syadmins/integrators can add their own private options etc...\n\ntest -f /etc/profile && . /etc/profile\n\n# Make sure LANG is set\n#\nif [ -z \"$LANG\" ]\nthen\n  if [ -f /etc/sysconfig/language ]\n  then\n    LANG=`. /etc/sysconfig/language; echo $RC_LANG`\n    export LANG\n  fi\nfi\n\nexec /usr/sbin/gdm-binary \"$@\"\n\nNote: it's not a custom archlinux script. This is straight from gdm\nrelease 2.30.4\n\nso it's a non-login shell (sh) script that source /etc/profile and\nbreaks standard behavior. no wonder that bash_completion stuff is run\nthere\n"},{"id":"146468","messageId":"1280227428.7654.5.camel@soho.example.org","threadId":"24509","inReplyTo":"4C4E00AE.7010904@pileofstuff.org","subject":"Re: [bash-completion] syntax error near unexpected token '<' on line 123 in bash_completion.d/git","fromName":"solsTiCe d'Hiver","fromEmail":"solstice.dhiver@gmail.com","sentAt":"2010-07-27T10:43:48Z","receivedAt":"2010-07-27T10:43:48Z","isPatch":false,"sender":{"key":"solstice.dhiver@gmail.com","avatar":"https://gravatar.com/avatar/8f39aac7a4171412da9071838ca49808ba46c5da4b7cb51d0293f5289e8b4cec?d=mp&s=160"},"body":"it appears there is a bug in /etc/profile in archlinux that mis-detects\nsh as bash and run bash specific script like bash_completion.\n"}]}