FS#21573 - bash_completion error due to /etc/profile file
Attached to Project:
Arch Linux
Opened by Liu Chang (goduck777) - Tuesday, 02 November 2010, 15:03 GMT
Last edited by Ionut Biru (wonder) - Tuesday, 02 November 2010, 15:33 GMT
Opened by Liu Chang (goduck777) - Tuesday, 02 November 2010, 15:03 GMT
Last edited by Ionut Biru (wonder) - Tuesday, 02 November 2010, 15:33 GMT
|
Details
When booting, there is an error message like
/etc/bash_completion.d/git: line 123: syntax error near unexpected token "<". 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. |
This task depends upon
Closed by Ionut Biru (wonder)
Tuesday, 02 November 2010, 15:33 GMT
Reason for closing: Duplicate
Additional comments about closing: FS#20288
submit your comments there
Tuesday, 02 November 2010, 15:33 GMT
Reason for closing: Duplicate
Additional comments about closing: