mainThe GNU Bourne-Again SHell - Support: sr #108555, builtin test misinterprets "(...

 
 

sr #108555: builtin test misinterprets "( ! ! )" expression

Submitter:  None
Submitted:  Tue 22 Apr 2014 01:26:55 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Jun 2014 06:32:51 AM UTC, comment #1: 

Not a bug.

! alone is not enough for a test and what test does really depends on the number of its arguments.
 
So your test is really:

test \( ! ! string

with string = )

and bash correctly reports you are missing a closing paren.


Anonymous
Tue 22 Apr 2014 01:26:55 PM UTC, original submission:  

[miky@gremlin ~]$ bash -version
GNU bash, version 4.3.8(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[miky@gremlin ~]$ builtin test \( ! ! \)
bash: test: `)' expected
[miky@gremlin ~]$ echo $?
2
[miky@gremlin ~]$


The bug is in term() function in test.c: the argv[pos] is not tested for ")" in top-level but only in the if ( "(" ) {} branch. The last top-level test "consumes" the last argument before it returns back to the original call origin within the if ( "(" ) {} branch.

Not a C developer, hence no patch. Sorry.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-13 chet StatusNone Invalid

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code