/etc/bash_completion bad completion

Bug #82276 reported by Noah Slater
2
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: bash

My global /etc/bash.bashrc file is sourcing /etc/bash_completion which in turn exits with a error status of "2" with the following message:

/etc/bash_completion: 44: Syntax error: Bad substitution

You can reproduce by sourcing /etc/bash_completion your self in a test script such as this:

--------------------------------------
#!/bin/sh

. /etc/bash_completion
--------------------------------------

Because this exits with an error status 2 it causes any X session, be it GNOME or Ion3 (in my case), to crash.

This bug was originally filed at:

https://launchpad.net/ubuntu/+source/gdm/+bug/60079

Revision history for this message
Noah Slater (nslater) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

what do you have at /etc/bash_completion line 44?

Revision history for this message
Noah Slater (nslater) wrote :

Here is my bash completion, untouched by me since package installation.

IMHO it looks like this is a problem between bash and sh interpretations of the file. If you source it through bash it works but if it's sourced through sh it fails.

/etc/X11/Xsession sources the file through sh.

Revision history for this message
Noah Slater (nslater) wrote :
Revision history for this message
Noah Slater (nslater) wrote :
Revision history for this message
Noah Slater (nslater) wrote :

Please ignore the last comment which was reposted by mistake.

Revision history for this message
Noah Slater (nslater) wrote :

I suppose this really begs the question why GDM is sourcing bashrc at the beginning of a session?

Revision history for this message
Noah Slater (nslater) wrote :

Cross posted to: https://launchpad.net/ubuntu/+source/gdm/+bug/60079

I think I have figured it out...

My /etc/profile was sourcing /etc/bash.bashrc every time.

You must have made a change to /etc/X11/Xsession recently that means when you source /etc/profile under sh you end up sourcing /etc/bash.bashrc.

I assume I am in the wrong here so I have removed the line from /etc/profile that sources /etc/bash_bashrc and things seem to work.

Revision history for this message
Noah Slater (nslater) wrote :

Cross posted to: https://launchpad.net/ubuntu/+source/gdm/+bug/

Thinking about it a little more... this is happening because I have bash specific commands in one of my startup files. The gdm package is sourcing my startup files under sh.

I think therefore that the bug is with the gdm package.

Revision history for this message
Sebastien Bacher (seb128) wrote :

right, not a bash bug, bash_completion is not made to be loaded by dash

Changed in bash:
status: Unconfirmed → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.