Summary: | app-shells/bash-completion-2.1-r92 - completion on empty prompt in root shell gives error message "-su: words: bad array subscript" | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Ole Langbehn <neurolabs.de> |
Component: | Current packages | Assignee: | Michał Górny <mgorny> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kultihell, leho, pva, shell-tools |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Ole Langbehn
2014-11-03 00:48:54 UTC
And before you ask, I have performed the migration steps from the warn elog message of app-shells/bash-completion-2.1-r91 > For bash-completion autoloader to work, all completions need to > be installed in /usr/share/bash-completion/completions. You may > need to rebuild packages that installed completions in the old > location. You can do this using: > > $ find /usr/share/bash-completion -maxdepth 1 -type f '!' -name 'bash_completion' -exec emerge -1v {} + > > After the rebuild, you should remove the old setup symlinks: > > $ find /etc/bash_completion.d -type l -delete The error is happening with -r92 as well, updated the subject to indicate that. Through diff debugging I found that removing the complete call from line 1947 in /usr/share/bash-completion/bash_completion solves the issue. But then it gets fuzzy for me. Something inside the _minimal function seems to not define the words array correctly. But I can't figure out if it's directly in _minimal or in a sub-function. I'm sorry but I currently can't sacrifice any of my time to try to fix this. If you could figure out what exactly goes wrong, that would be very helpful :). (In reply to Michał Górny from comment #3) > I'm sorry but I currently can't sacrifice any of my time to try to fix this. > If you could figure out what exactly goes wrong, that would be very helpful > :). Sorry, I don't have any time for this either...just got twins. (In reply to Ole Langbehn from comment #4) > (In reply to Michał Górny from comment #3) > > I'm sorry but I currently can't sacrifice any of my time to try to fix this. > > If you could figure out what exactly goes wrong, that would be very helpful > > :). > > Sorry, I don't have any time for this either...just got twins. Congrats :). Got it... in line 710 of /usr/share/bash-completion/bash_completion, a check against zero is performed: [[ $cword -eq 0 ]] && return 1 In case of the issue, $cword is set to -1, so does not return. In the next line, $cword is used as an index for accessing the words array. Accessing the array at index -1 results in the error. I tried to change line 710 to [[ $cword -le 0 ]] && return 1 but with the result of no completions on an empty shell. But the erroneous shell behaviour is gone then. Can you take over from here? This was fixed upstream, so I think it's sane to apply patch: http://anonscm.debian.org/cgit/bash-completion/bash-completion.git/commit/?id=a9c556ccad819869a6a5d932aac0a75a99372f08 We should probably package a snapshot. The 2.1 release is ancient... +*bash-completion-2.1_p20141224 (23 Dec 2014) + + 23 Dec 2014; Michał Górny <mgorny@gentoo.org> + +bash-completion-2.1_p20141224.ebuild: + Package a new snapshot with upstream fix for bug #528064 (and more). Update + the Gentoo bundle with new patch, proper eselect module version (bug #530798) + and fixed non-existing file ref (bug #532126). Seems to solve the problem for me. |