Bug 222 - Bashisms in nsdc
Bashisms in nsdc
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
3.0.x
All FreeBSD
: P2 normal
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-02 20:20 CET by John Lightsey
Modified: 2009-01-05 12:39 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Lightsey 2009-01-02 20:20:41 CET
This was pointed out by Lew Payne on the nsd-users mailing list.

There are several instances in nsdc where this syntax is used:

if test "something" == "$somevar"; then


== isn't the correct string equality operator for test and only works under shells like bash.  The GNU coreutils version of test also flags this syntax as an error.  The operator = should be used instead.

jd:~$ /usr/bin/test "this" == "that" ;  echo $?
/usr/bin/test: ==: binary operator expected
2
jd:~$ /usr/bin/test "this" = "that" ;  echo $?
1


This breaks nsdc "update" and "notify" on FreeBSD where the standard /bin/sh doesn't use the bash builtin for test.
Comment 1 Matthijs Mekking 2009-01-05 11:58:22 CET
fixed in trunk 2830. Will be in the next release. Thanks for submitting!
Comment 2 Matthijs Mekking 2009-01-05 12:39:24 CET
I mean r2831