You are not logged in.

#1 2010-09-24 05:07:00

goduck777
Member
Registered: 2010-09-24
Posts: 2

Some ideas about git bash_completion error during boot

Although I know it has been posted before (https://bbs.archlinux.org/viewtopic.php?id=101586), I have some ideas about how to fix it.

In my opinion, this problem is due to Arch's shell setting, which links /bin/sh to /bin/bash. So that any process which start a sh shell, it actually starts a bash shell. However, in /etc/profile, there is a bash script used to detect shell:

shell="sh"
if test -f /proc/mounts; then
   case $(/bin/ls -l /proc/$$/exe) in
        *bash) shell=bash ;;
        *dash) shell=dash ;;
        *ash)  shell=ash ;;
        *ksh)  shell=ksh ;;
        *zsh)  shell=zsh ;;
    esac
fi

It use /proc/$$/exe to determine the shell name. The problem is, if you start a sh shell, /proc/$$/exe will also show "bash"

$ sh
$ ls -l /proc/$$/exe
lrwxrwxrwx 1 elf hal 0 Sep 24 12:53 /proc/4646/exe -> /bin/bash

So if you start a sh, and run /etc/profile, it will also try to run bash_completion, which will lead to an error:

$ sh /etc/profile
/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 ')'

In my opinion, the detecting method in /etc/profile is not correct. It should distinguish sh and bash. When the process start a sh (for example, gdm at booting), /etc/profile should not try to run /etc/profile.bash and /etc/bash.bashrc. It should try to find /etc/profile.sh, as written in the script.

By the way, the line

[ -r /etc/bash_completion   ] && . /etc/bash_completion

in bash.bashrc is not necessary now, because bash_completion package has already contained a script in /etc/profile.d. So it is proper remove this line in bash package. However, this is another problem.

Offline

#2 2010-11-02 01:44:02

emphire
Member
From: Canada
Registered: 2007-03-21
Posts: 203

Re: Some ideas about git bash_completion error during boot

You should file a bug report... I don't think it will get noticed by the developers in here.

Offline

#3 2010-11-02 01:56:41

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: Some ideas about git bash_completion error during boot

+1 bug report, they will see it for sure.

Offline

#4 2010-11-02 15:04:49

goduck777
Member
Registered: 2010-09-24
Posts: 2

Re: Some ideas about git bash_completion error during boot

OK, I have posted a bug report at https://bugs.archlinux.org/task/21573. Hope it can be solved soon.

Offline

Board footer

Powered by FluxBB