[Maverick A1]bash errors in /etc/bash_completion.d/apt displayed when opening a terminal

Bug #588811 reported by Jeff Lane 
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Fix Released
High
Canonical Foundations Team

Bug Description

Installed 64bit Studio in a vm. After installing and logging in, I opened a terminal and immediately got the following bash errors (appear in every terminal I open via menu/accessories/terminal)

bash: /etc/bash_completion.d/apt: line 32: syntax error near unexpected token ';'
bash: /etc/bash_completion.d/apt: line 32: ' 2> /dev/null ); $( apt-cache --no-generate pkgnames "lib$cur" \'
bash: /etc/bash_completion.d/apt: line 33: syntax error near unexpected token ')'
bash: /etc/bash_completion.d/apt: line 33: ' 2> /dev/nu..); )'

Revision history for this message
Jeff Lane  (bladernr) wrote :

That last line should have said "2> /dev/null" not "2> /dev/nu.." it's what I get for repeating the error messages by hand...

affects: ubuntustudio → bash-completion
tags: added: iso-testing
Jeff Lane  (bladernr)
tags: added: pcert
Revision history for this message
David Paleino (dpaleino) wrote :

This error usually happens when bash is called in compatibility-mode, i.e. as /bin/sh , or with set -o posix. Check that your default shell is /bin/bash and not /bin/sh.

David

Revision history for this message
Jeff Lane  (bladernr) wrote :

This is the maverick default shell in Studio... and yes, it's /bin/bash...

also, .bashrc contains code that should prevent this from happening:

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  . /etc/bash_completion
fi

Running shopt by itself returns a 1.

also, /etc/bash.bashrc has the bash_completion bits commented out, so the command is being sourced from the user's .bashrc instead.

also, all the compat* options are set to off if I just run shopt alone...

Revision history for this message
Jeff Lane  (bladernr) wrote :

If I call /etc/bash_completion using /bin/sh I get this error:
bladernr@ubuntu:~$ /bin/sh /etc/bash_completion
/etc/bash_completion: 33: [[: not found
/etc/bash_completion: 39: [[: not found
/etc/bash_completion: 52: Bad substitution
bladernr@ubuntu:~$ /bin/bash --posix /etc/bash_completion
/etc/bash_completion.d/apport_completion: line 130: '_apport-bug': not a valid identifier

So I get completely different errors using sh and calling bash in posix mode...

Revision history for this message
David Paleino (dpaleino) wrote : Re: [Bug 588811] Re: [Maverick A1]bash errors in /etc/bash_completion.d/apt displayed when opening a terminal

On Wed, 02 Jun 2010 19:04:09 -0000, Jeff Lane wrote:

> This is the maverick default shell in Studio...

Please don't assume everyone out there is using Ubuntu :)
I'm a Debian developer, and this is the upstream bash-completion project (well,
not really, upstream is alioth, but I'm keeping it open here as well just for
convenience)

> and yes, it's /bin/bash...

Ok, thanks.

> also, .bashrc contains code that should prevent this from happening:
>
> if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
> . /etc/bash_completion
> fi
>
> Running shopt by itself returns a 1.

What does "shopt -o posix" return?

> [..]
> also, all the compat* options are set to off if I just run shopt
> alone...

Those are bash compatibility levels, irrelevant for posix and bash-completion,
I'd say ;)

David

--
 . ''`. Debian developer | http://wiki.debian.org/DavidPaleino
 : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'` GPG: 1392B174 ----|---- http://deb.li/dapal
   `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174

Revision history for this message
David Paleino (dpaleino) wrote :

On Wed, 02 Jun 2010 19:10:00 -0000, Jeff Lane wrote:

> If I call /etc/bash_completion using /bin/sh I get this error:
> bladernr@ubuntu:~$ /bin/sh /etc/bash_completion
> /etc/bash_completion: 33: [[: not found
> /etc/bash_completion: 39: [[: not found
> /etc/bash_completion: 52: Bad substitution
> bladernr@ubuntu:~$ /bin/bash --posix /etc/bash_completion
> /etc/bash_completion.d/apport_completion: line 130: '_apport-bug': not a
> valid identifier
>
> So I get completely different errors using sh and calling bash in posix
> mode...

Maybe because your /bin/sh points to /bin/dash?...

I'll look at it better, however this already happened in the past, and the
problem always was "bash in posix mode". I'd need to dig in the Debian BTS,
I'll need some more time.

--
 . ''`. Debian developer | http://wiki.debian.org/DavidPaleino
 : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'` GPG: 1392B174 ----|---- http://deb.li/dapal
   `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174

Revision history for this message
Jeff Lane  (bladernr) wrote :

On Wed, 2010-06-02 at 19:20 +0000, David Paleino wrote:
> Please don't assume everyone out there is using Ubuntu :)

No assumptions, just I reported it at Launchpad and was pointing out
that I saw this in Studiobuntu Maverick Alpha 1... It's been seen across
the board in *buntu though, from what I've gathered after mentioning
this to the QA team earlier.

And Sorry if that sounded harsh, I didn't mean any harshness there, but
tone doesn't convey very well across the internet :)

> > Running shopt by itself returns a 1.

Actually, I meant running "shopt -oq posix" returns a 1. Case of brain
thinking and fingers not typing :(

> What does "shopt -o posix" return?

posix off

--
Jeff Lane <email address hidden>
Ubuntu Ham: W4KDH
IRC: bladernr or bladernr_
gpg: 1024D/3A14B2DD 8C88 B076 0DD7 B404 1417 C466 4ABD 3635 3A14 B2DD

Revision history for this message
Jeff Lane  (bladernr) wrote :

On Wed, 2010-06-02 at 19:28 +0000, David Paleino wrote:
> Maybe because your /bin/sh points to /bin/dash?...

Indeed it does :/

--
Jeff Lane <email address hidden>
Ubuntu Ham: W4KDH
IRC: bladernr or bladernr_
gpg: 1024D/3A14B2DD 8C88 B076 0DD7 B404 1417 C466 4ABD 3635 3A14 B2DD

Ameet Paranjape (ameetp)
Changed in ubuntu:
status: New → Triaged
importance: Undecided → Medium
importance: Medium → High
Ameet Paranjape (ameetp)
affects: ubuntu → bash-completion (Ubuntu)
Ameet Paranjape (ameetp)
Changed in bash-completion:
status: New → Invalid
Ameet Paranjape (ameetp)
Changed in bash-completion (Ubuntu):
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Revision history for this message
Colin Watson (cjwatson) wrote :

This bug was due to the attempted fix for bug 546794 in bash-completion 1:1.1-3ubuntu3. This was reverted in bash-completion 1:1.1-3ubuntu4, and was determined to be undesirable anyway so I don't think it will be restored.

Changed in bash-completion (Ubuntu):
status: Triaged → Fix Released
Mathew Hodson (mhodson)
affects: bash-completion → ubuntu
no longer affects: ubuntu
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.