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 |
|
Login |
|
|
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
|
|
|
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
|
|
|
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 ?
|
|
|
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...
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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 |
|
|
|