Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 482732 - =app-shells/bash-completion to 2.1-r1 - Causes ‘bash’ to loop on startup (^C cancels execution of that script)
Summary: =app-shells/bash-completion to 2.1-r1 - Causes ‘bash’ to loop on startup (^C ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-27 22:19 UTC by Tom Wijsman (TomWij) (RETIRED)
Modified: 2014-01-28 23:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
An excerpt of `strace -f -p PID`. Compressed because it grows huge despite only running for about a second. (errors.xz,19.19 KB, application/octet-stream)
2013-08-31 09:42 UTC, gentoo
Details
/etc/bash_completion.d/bash_completion (bash_completion,65.34 KB, text/plain)
2013-08-31 10:09 UTC, gentoo
Details
New output of strace -f (strace.log,542.53 KB, text/x-log)
2013-09-10 13:34 UTC, gentoo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-08-27 22:19:08 UTC
Reported by user 'haasn' or IRC.

Removing /etc/profile.d/bash_completion.sh or downgrading to 2.1 fixes it.
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2013-08-28 09:20:54 UTC
Can you provide steps for reproducing?
I'm afraid this bug won't get otherwise attention, since I have no idea howto proceed with information of "it doesn't work" when it does here.
Comment 2 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-08-28 10:18:42 UTC
Nothing special was done, he has upgraded and it broke the next time he opened up bash. He did do dispatch-conf / etc-update which didn't show the file as he has never modified it; so, he is using the right file that came with the last bash.

He will try to upgrade from the downgraded version again later. He also still has a copy around of the file he obtained after the upgrade, will attach later.

Any other debugging steps that could be taken to reproduce this or gain info?
Comment 3 Martin von Gagern 2013-08-31 01:15:57 UTC
(In reply to Tom Wijsman (TomWij) from comment #2)
> Any other debugging steps that could be taken to [...] gain info?

Use "pstree -p" to see what processes were spawned by that shell.
Use "strace -f -p" to see what syscall activity there is for these.
Use "gdb -p" to attach a debugger to it. rebukd with debug symbols as needed.
Comment 4 gentoo 2013-08-31 09:42:10 UTC
Created attachment 357486 [details]
An excerpt of `strace -f -p PID`. Compressed because it grows huge despite only running for about a second.
Comment 5 gentoo 2013-08-31 10:09:41 UTC
Created attachment 357488 [details]
/etc/bash_completion.d/bash_completion
Comment 6 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-08-31 10:10:17 UTC
It seems to be looking at /etc/bash_completion.d/bash_completion (I assume this is a script), then /etc/init.d/* (expansion) and then `ls /etc/bash_completion.d` (an actual call); after all that, it just repeats those steps. So, either something in bash itself or in /etc/bash_completion.d/bash_completion is looping here; as there is a mention of init.d, I assume that this happens in the script.
Comment 7 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-08-31 10:15:32 UTC
This code runs over /etc/bash_completion.d and sources the files:

    for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do
        i=$BASH_COMPLETION_COMPAT_DIR/$i
        [[ ${i##*/} != @($_backup_glob|Makefile*|$_blacklist_glob) \
            && -f $i && -r $i ]] && . "$i"
    done

Now, because /etc/bash_completion.d/bash_completion is in /etc/bash_completion.d it will source itself over and over again; so, it will keep doing the steps I described above.
Comment 8 Alexander Tsoy 2013-08-31 10:20:15 UTC
(In reply to gentoo from comment #5)
> Created attachment 357488 [details]
> /etc/bash_completion.d/bash_completion

I don't have this file O_o
Comment 9 gentoo 2013-08-31 10:21:37 UTC
`equery b /etc/bash_completion.d/bash_completion` says it belongs to app-shells/bash-completion-2.1-r1.
Comment 10 Alexander Tsoy 2013-08-31 10:26:39 UTC
(In reply to gentoo from comment #9)
> `equery b /etc/bash_completion.d/bash_completion` says it belongs to
> app-shells/bash-completion-2.1-r1.

I gues it is a symlink to /usr/share/bash-completion/bash_completion. You probably enabled completion 'bash_completion' globally via eselect. Am I right?

$ eselect bashcomp list
Available completions:
  [1]   bash_completion
  [2]   dbus
  [3]   udisks
Comment 11 gentoo 2013-08-31 10:29:18 UTC
(In reply to Alexander Tsoy from comment #10)
> (In reply to gentoo from comment #9)
> > `equery b /etc/bash_completion.d/bash_completion` says it belongs to
> > app-shells/bash-completion-2.1-r1.
> 
> I gues it is a symlink to /usr/share/bash-completion/bash_completion. You
> probably enabled completion 'bash_completion' globally via eselect. Am I
> right?
> 
> $ eselect bashcomp list
> Available completions:
>   [1]   bash_completion
>   [2]   dbus
>   [3]   udisks

No, it's a file. `eselect bashcomp --list` shows no enabled rules, and enabling or disabling bash_completion has no visible effect, neither on that directory nor any others I've seen.
Comment 12 Alexander Tsoy 2013-08-31 11:51:37 UTC
$ qlist -ICv bash-completion
app-shells/bash-completion-2.1-r1
$ qlist bash-completion | egrep '/etc/'
/etc/profile.d/bash_completion.sh
Comment 13 Alexander Tsoy 2013-09-03 23:19:15 UTC
(In reply to gentoo from comment #11)
> No, it's a file.

Please attach build.log
Comment 14 Alexander Tsoy 2013-09-10 09:28:05 UTC
Also check that /etc/bash_completion.d is not a symlink to /usr/share/bash-completion on your system.
Comment 15 gentoo 2013-09-10 13:33:06 UTC
(In reply to Alexander Tsoy from comment #14)
> Also check that /etc/bash_completion.d is not a symlink to
> /usr/share/bash-completion on your system.

Sorry for the late response, I was using the downgraded version in the meantime.

I upgraded back to the problematic versions. It's a symlink now, and no longer a separate directory. I'm not sure what caused that the first time round, but whatever it seems to have been, it hasn't reproduced itself.

I re-emerged all of the packages that installed bash completions and now my /etc/bash_completion.d looks probably a lot more like it should, with bash_completion at the top level and most of my scripts in the ‘completions’ subdirectory. It still doesn't work, however. Some scripts were still in the top level, of packages that I think the advised ‘auto-rebuild’ left out, and moving those into ‘completions’ manually does not affect the issue.

I've attached a new strace. Tell me if you still want a build.log.
Comment 16 gentoo 2013-09-10 13:34:10 UTC
Created attachment 358414 [details]
New output of strace -f
Comment 17 Alexander Tsoy 2013-09-10 13:46:56 UTC
(In reply to gentoo from comment #15)

/etc/bash_completion.d should not be a symlink. Most likely, you have created it yourself (e.g. to enable all completions globally for bash-completion-1.x).
Comment 18 gentoo 2013-09-10 13:52:12 UTC
(In reply to Alexander Tsoy from comment #17)
> (In reply to gentoo from comment #15)
> 
> /etc/bash_completion.d should not be a symlink. Most likely, you have
> created it yourself (e.g. to enable all completions globally for
> bash-completion-1.x).

That seems probable. I've removed the symlink, and now bash works fine but I don't have any completion. `eselect bashcomp` no longer exists, apparently. What should I be doing to re-enable everything?
Comment 19 Alexander Tsoy 2013-09-10 13:59:32 UTC
(In reply to gentoo from comment #18)

> What should I be doing to re-enable everything?

Read elog and ewarn messages. You should run the following command:

emerge -av1 $(qfile -q -S -C /usr/share/bash-completion)

And you should source /usr/share/bash-completion/bash_completion in your ~/.bashrc.
Comment 20 gentoo 2013-09-10 14:03:50 UTC
(In reply to Alexander Tsoy from comment #19)
> (In reply to gentoo from comment #18)
> 
> > What should I be doing to re-enable everything?
> 
> Read elog and ewarn messages. You should run the following command:
> 
> emerge -av1 $(qfile -q -S -C /usr/share/bash-completion)
> 
> And you should source /usr/share/bash-completion/bash_completion in your
> ~/.bashrc.

Thanks, that resolves my issues.

I didn't get any ewarn/elog messages when emerging it, at least not this time - I still have the output of ‘emerge -1u bash-completion gentoo-bashcomp’ in my terminal and there's nothing to suggest anything needs to be done on my side, it's only when I looked at the build.log upon your request that I realized I had to re-emerge all of the packages that provided bash completions. Just a heads up.
Comment 21 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2014-01-28 23:31:27 UTC
(In reply to gentoo from comment #20)
> (In reply to Alexander Tsoy from comment #19)
> > Read elog and ewarn messages. You should run the following command:
> > 
> > emerge -av1 $(qfile -q -S -C /usr/share/bash-completion)
> > 
> > And you should source /usr/share/bash-completion/bash_completion in your
> > ~/.bashrc.
> 
> Thanks, that resolves my issues.