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.
Bug 1156389 - (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 "> ")
Summary: (reverse-i-search)`': no<TAB> caused errors: -bash: ((: -1 == : syntax error...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcp
Version: 7.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Nathan Scott
QA Contact: Miloš Prchlík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-24 11:19 UTC by Lingfei Kong
Modified: 2017-08-01 18:29 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 18:29:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
bash-log.txt (1.03 MB, text/plain)
2014-10-24 11:20 UTC, Lingfei Kong
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1968 0 normal SHIPPED_LIVE pcp bug fix and enhancement update 2017-08-01 18:09:55 UTC

Description Lingfei Kong 2014-10-24 11:19:42 UTC
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.

Comment 1 Lingfei Kong 2014-10-24 11:20:20 UTC
Created attachment 950328 [details]
bash-log.txt

Comment 6 Siteshwar Vashisht 2016-10-25 05:19:59 UTC
This bug seems to be coming from _pminfo_complete function in pcp package.

Comment 8 Nathan Scott 2016-10-25 05:37:06 UTC
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.

Comment 9 Nathan Scott 2016-10-25 06:26:00 UTC
Fixed by upstream commit b8a6b960b114fc.

Comment 11 Miloš Prchlík 2017-06-13 11:47:22 UTC
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.

Comment 12 errata-xmlrpc 2017-08-01 18:29:33 UTC
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


Note You need to log in before you can comment on or make changes to this bug.