#1 ShDeny does not recognize all non-zero return values

closed-fixed
nobody
None
5
2005-11-22
2005-02-08
Mark Harig
No

By convention, the Bourne shells define 'false' to be
any non-zero return code.

The file ShUnit has the following initialization:

FALSE=1

and the function ShDeny, which has the following check:

if [ ${boolResult} -ne ${FALSE} ]
then
...
fi

This function will not return the correct result when
the test code that precedes returns a non-zero value
other than one (1).

I believe the following change to ShDeny should return
the correct result:

if [ ${boolResult} -eq ${TRUE} ]
then
...
fi

With the above change, any non-zero return code passed
to ShDeny (as the second argument) should result in the
correct behavior.

Discussion

  • Mark Harig

    Mark Harig - 2005-02-08

    Logged In: YES
    user_id=555886

    I see that this fix has been checked into CVS already.

     
  • Steve Cline

    Steve Cline - 2005-04-26

    Logged In: YES
    user_id=34534

    Correct - I have fixed this in the code I use locally
    already, just have not updated the Sourceforge copy - will
    try to do that this week

     
  • Bobby Nations

    Bobby Nations - 2005-11-22

    Logged In: YES
    user_id=425916

    Good suggestion! It's been checked in, so I'm closing this bug.

     
  • Bobby Nations

    Bobby Nations - 2005-11-22
    • status: open --> closed-fixed
     

Log in to post a comment.