Bug 1156389
| Summary: | (reverse-i-search)`': no<TAB> caused errors: -bash: ((: -1 == : syntax error: operand expected (error token is "== ")\nbash: ((: -1 > : syntax error: operand expected (error token is "> ") | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Lingfei Kong <lkong> | ||||
| Component: | pcp | Assignee: | Nathan Scott <nathans> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Miloš Prchlík <mprchlik> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 7.1 | CC: | brolley, fche, kdudka, lberk, leiwang, mbenitez, mcermak, mgoodwin, mprchlik, nathans, wshi | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2017-08-01 18:29:33 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Created attachment 950328 [details]
bash-log.txt
This bug seems to be coming from _pminfo_complete function in pcp package. Hi there, (In reply to Lingfei Kong from comment #0) > [...] > set -x and find the following lines: > ..... > complete -F _filedir_xspec dvitype > complete -F _filedir_xspec dviselect > complete -F _filedir_xspec xdvi > complete -F _longopt uniq > complete -F _command tsocks > complete -F _service /etc/rc.d/init.d/network > complete -a unalias' > + func=_pminfo_complete This line is strange - it should (from reading pcp_completion.sh) look more like the preceding lines, i.e. complete -F _pcp_complete -o default pmdumplog ... So, that parts a mystery - however, the failure should be easily resolved via some more defensive code in _pcp_complete. The local $curpos_expand variable is expanding to nothing (not triggering a switch/case) and is later used unconditionally - I'll fix that up. > root@rhel7 ~]# -bash: ((: -1 == : syntax error: operand expected (error > token is "== ") > -bash: ((: -1 > : syntax error: operand expected (error token is "> ") maps to this part of the code: if (( $COMP_CWORD == $curpos_expand )) || \ ( (( $COMP_CWORD > $curpos_expand )) \ ... if $curpos_expand had been initialized to zero, we'd not generate this error and the function would be safely traversed (despite the odd parameters). I'll fix that up. cheers. Fixed by upstream commit b8a6b960b114fc. I haven't been able to reproduce the issue therefore more or less "sanity only" verification - changes from the upstream patch (b8a6b960b114fc) are present, AFAICT bash completion works. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1968 |
Description of problem: When i type C-r and input some characters of the command which i want to complete(nohup), i receive an error from bash: [root@rhel7 ~]# -bash: ((: -1 == : syntax error: operand expected (error token is "== ") -bash: ((: -1 > : syntax error: operand expected (error token is "> ") set -x and find the following lines: ..... complete -F _filedir_xspec dvitype complete -F _filedir_xspec dviselect complete -F _filedir_xspec xdvi complete -F _longopt uniq complete -F _command tsocks complete -F _service /etc/rc.d/init.d/network complete -a unalias' + func=_pminfo_complete + [[ 2 -ge 2 ]] + _pminfo_complete cat '' + local cur=anaconda-ks.cfg + local opt_regex= curpos_expand= + COMPREPLY=() + case ${COMP_WORDS[0]} in + (( -1 == )) -bash: ((: -1 == : syntax error: operand expected (error token is "== ") + (( -1 > )) -bash: ((: -1 > : syntax error: operand expected (error token is "> ") + local opt + [[ complete -o default -F _pminfo_complete pmstore complete -o filenames -F _cr_createrepo createrepo complete -F _minimal complete -F _filedir_xspec oodraw complete -F _filedir_xspec elinks complete -F _filedir_xspec freeamp complete -F _longopt split ....... The error is caused by a NULL string '${COMP_WORDS[0]}'. I don't know why this string is NULL, when i remove package pcp-3.9.10-4.el7, and redo the test, this time no errors output. I don't know if it is caused by bash-completion-2.1-6.el7.noarch or pcp-3.9.10-4.el7. File this bug against bash-completion for first review. Version-Release number of selected component (if applicable): bash-completion-2.1-6.el7.noarch pcp-3.9.10-4.el7 Host: RHEL-7.1-20141006.1 How reproducible: 100% Steps to Reproduce: 1. #nohup cat anyfile.txt & 2. Press C-r and input first two haracters of 'nohup' # (reverse-i-search)`no': nohup cat anaconda-ks.cfg & And then press Tab key. root@rhel7 ~]# -bash: ((: -1 == : syntax error: operand expected (error token is "== ") -bash: ((: -1 > : syntax error: operand expected (error token is "> ") Actual results: Bash output error messages Expected results: Complete command 'nohup cat anyfile.txt &' successfully. Additional info: verbose info when do these operations.