Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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.
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.
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.