Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Bug in SUA R2 'test' with empty strings and the 'and' operator

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Bug in SUA R2 'test' with empty strings and the 'and' operator Page: [1]
Login
Message << Older Topic   Newer Topic >>
Bug in SUA R2 'test' with empty strings and the 'and' o... - May 12, '06, 10:38:06 AM   
Ron

 

Posts: 77
Joined: May 21, '03,
Status: offline
Hi all, I think I found a bug with test (ksh builtin or /bin/test) with empty strings and the 'and' operator. The issue is only seen in SUA R2; SFU 3.5 is ok.

For instance on OpenServer, Linux and SFU 3.5:
$ test ;echo $?
1
$ test -a ;echo $?
0
$ test "" ;echo $?
1
$ test "" -a "" ;echo $?
1    <--- compare to notice below

On SUA R2:
$ test ;echo $?
1
$ test -a ;echo $?
0
$ test "" ;echo $?
1
$ test "" -a "" ;echo $?
0    <--- notice here


Regards,
Ron
Post #: 1
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 11:32:22 AM   
Ron

 

Posts: 77
Joined: May 21, '03,
Status: offline
Here's another issue with 'test' on SUA R2 (OK in SFU 3.5). Here test does not like the "-d". I also tried it with '-d' (single quotes). The only way around it is to escape it "\-d".

$ test "a" = "-d" -o "a" = "-dbname"
test: syntax error


Regards,
Ron

(in reply to Ron)
Post #: 2
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 12:47:06 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Which ksh are you testing this with?
The one that ships (5.2.13) or 5.2.14 from ftp://pub ?

(in reply to Ron)
Post #: 3
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 12:49:40 PM   
Ron

 

Posts: 77
Joined: May 21, '03,
Status: offline
The one that ships, but also note that /bin/test exhibits the same behavior. I'll try the /pub one now...

(in reply to Rodney)
Post #: 4
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 12:51:40 PM   
Ron

 

Posts: 77
Joined: May 21, '03,
Status: offline
In ksh 5.2.14 the first example is ok:
$ test "" -a "" ;echo $?
1

But the second fails:
$ test "a" = "-d" -o "a" = "-dbname"
test: syntax error

(in reply to Ron)
Post #: 5
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 1:19:48 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Okay. At some point I'll get a full package of 5.2.14 going for 3.5 and 5.2 folks.
The update for test was easy enough, so it's a package now.
    pkg_update -L test

(in reply to Ron)
Post #: 6
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 1:36:52 PM   
Ron

 

Posts: 77
Joined: May 21, '03,
Status: offline
Wow that was quick, thanks!

I see it also takes care of the execute bit issue for files on NFS shares.

Ron

(in reply to Rodney)
Post #: 7
RE: Bug in SUA R2 'test' with empty strings and the 'an... - May 12, '06, 1:50:03 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
> I see it also takes care of the execute bit issue for files on NFS shares.

great. That saves me looking to fix it thanks.

(in reply to Ron)
Post #: 8
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Bug in SUA R2 'test' with empty strings and the 'and' operator Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.047