You are not logged in.

#1 2010-07-23 20:28:05

Cape
Member
From: Mogliano Veneto, Italy
Registered: 2008-11-15
Posts: 105

Bash completion syntax error - upon booting (default configs)

Hi all!
am I the only one experiencing this problem?
Basically after boot up i get this message on tty 1 (short version due to lack of copy/paste function):

/etc/bash_completion.d/git: line 123: syntax error near unexpected token "<".

Problem is i never touched that file in my life....

this is how it looks:

svn-remote.*.url)
            svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
            svn_url_pattern+="\\|$value"
            upstream=svn+git # default upstream is SVN if available, else git
            ;;
        esac

## !! The following is line 123
    done < <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')
    
        # parse configuration values
    for option in ${GIT_PS1_SHOWUPSTREAM}; do
        case "$option" in
        git|svn) upstream="$option" ;;
        verbose) verbose=1 ;;
        legacy)  legacy=1  ;;
        esac
    done

By the way, what does "<" do in bash?

Offline

#2 2010-07-23 20:40:09

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Bash completion syntax error - upon booting (default configs)

Cape,

I have git 1.7.1.1-1 installed and my /etc/bash_completion.d/git doesn't look at all like yours.

I don't have the message, either.

Try to reinstall git.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#3 2010-07-23 20:41:21

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Bash completion syntax error - upon booting (default configs)

this is the entire expression, and it looks like proper bash:

 107         # get some config options from git-config
 108         while read key value; do
 109                 case "$key" in
 110                 bash.showupstream)
 111                         GIT_PS1_SHOWUPSTREAM="$value"
 112                         if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
 113                                 p=""
 114                                 return
 115                         fi
 116                         ;;
 117                 svn-remote.*.url)
 118                         svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
 119                         svn_url_pattern+="\\|$value"
 120                         upstream=svn+git # default upstream is SVN if available, else git
 121                         ;;
 122                 esac
 123         done < <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')

while read var; do ... done < <(something) just tells bash to read var from the 'something' process in the <( ).

similarly, while read var; do ... done < ./file would read from the lines of the file.

BIG EDIT sorry guys, i had copy/pasted out of vim and cut off the second half of the pipe -- it looks like we all have the same expression and mine's not erroring... weird.

Last edited by brisbin33 (2010-07-26 13:58:40)

Offline

#4 2010-07-24 07:45:42

Cape
Member
From: Mogliano Veneto, Italy
Registered: 2008-11-15
Posts: 105

Re: Bash completion syntax error - upon booting (default configs)

mmm... I've noticed that this file belongs to "git" package. And reinstalling git solved the problem. Now that file looks like yours. But how could it happened that pacman didn't synced it properly?

Offline

#5 2010-07-25 17:34:55

Cape
Member
From: Mogliano Veneto, Italy
Registered: 2008-11-15
Posts: 105

Re: Bash completion syntax error - upon booting (default configs)

Oppss.. it's still giving me that message... Are we sure about the correctness of that line? Can it be an upstream problem?

Offline

#6 2010-07-26 04:57:42

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Bash completion syntax error - upon booting (default configs)

Same problem here. Here's the entire error message (hand-copied, may have mistakes):-

/etc/bash_completion.d/git: line 123: syntax error near unexpected token `<'
/etc/bash_completion.d/git: line 123: `     done < <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')'

Line 123 is

done < <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')

which is different from brisbin33's version...


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#7 2010-07-26 10:14:44

combuster
Member
From: Serbia
Registered: 2008-09-30
Posts: 711
Website

Re: Bash completion syntax error - upon booting (default configs)

http://bugs.archlinux.org/task/20264

Yep, I've noticed it right after git upgrade...

Offline

#8 2010-07-26 13:56:56

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Bash completion syntax error - upon booting (default configs)

edit -- removed, see my previous post

i know that done < <(process) is just as valid as done < $(process) and is much more efficient  (no call to exec) so the fix listed in the bug tracker may not be ideal.

Last edited by brisbin33 (2010-07-26 13:59:16)

Offline

#9 2010-07-26 16:35:47

Cape
Member
From: Mogliano Veneto, Italy
Registered: 2008-11-15
Posts: 105

Re: Bash completion syntax error - upon booting (default configs)

I tried to run "sh /etc/bash_completion.d/git" and the output is the same as in tty 1, while sourceing that same file with bash doesn't give any error...

Offline

#10 2010-08-04 10:25:59

tatsuno
Member
Registered: 2010-02-23
Posts: 14

Re: Bash completion syntax error - upon booting (default configs)

I found this thread:

http://www.spinics.net/lists/git/msg136187.html

Has anybody fixed this?

Offline

#11 2010-09-08 11:03:16

citral
Member
Registered: 2005-05-07
Posts: 87

Re: Bash completion syntax error - upon booting (default configs)

It's still broken here. It looks pretty complicated now to fix, while I thought it was merely a broken git update.


One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.

Offline

#12 2010-10-07 06:09:26

daasdingo
Member
Registered: 2010-09-03
Posts: 9

Re: Bash completion syntax error - upon booting (default configs)

also broken on my machine; same error:

[root@daasdingo-desktop /]# sh /etc/bash_completion.d/git 
/etc/bash_completion.d/git: line 123: syntax error near unexpected token `<'
/etc/bash_completion.d/git: line 123: `    done < <(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')'

as cape already reported, the problem probably is that this is bash-specific syntax; and the script is executed in sh.

[root@daasdingo-desktop daasdingo]# bash /etc/bash_completion.d/git 
[root@daasdingo-desktop daasdingo]# 

interesting link(reply to the previously posted mail):

it appears there is a bug in /etc/profile in archlinux that mis-detects
sh as bash and run bash specific script like bash_completion.

http://www.spinics.net/lists/git/msg136196.html

Last edited by daasdingo (2010-10-07 06:15:16)

Offline

#13 2010-11-17 20:05:05

cecilyen
Member
From: US Capital
Registered: 2009-10-18
Posts: 27

Re: Bash completion syntax error - upon booting (default configs)

Anyway to fix this error msg so far?


Arch Linux i686(kernel: 3.1.7-ck, xfce) running on Toshiba s100 (Pentium M 1.73GHz, 1.5GB RAM, 40GB HD, Nvidia 6600/6200 TE 64MB)

Offline

#14 2010-11-20 12:16:57

Evilandi666
Member
Registered: 2010-10-28
Posts: 105

Re: Bash completion syntax error - upon booting (default configs)

Installed Git few days ago and after throwing this error deleted it...

Nobody can/want fix it? Its 4 months old ...

Offline

#15 2010-11-20 15:47:10

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Bash completion syntax error - upon booting (default configs)

At what point are your systems (automatically) sourcing the bash_completion files?  I don't get this message at all. 

I purposely source these files myself from ~/.bashrc which parses them correctly as bash.  This means it doesn't error on the `< <( )` bashism.

If you really want to suppress the message, try putting #!/bin/bash at the top of bash_completion.d/git.  A hack, but it should work.

Personally, I'd like to know why some "default setups" are sourcing this file and my "default setup" is not.

Offline

Board footer

Powered by FluxBB