This one time, at band camp, Michal Čihař said: > > init script fails to start clamav-deamon because is_true function does > not properly return error code when not using bash. > > This can be fixed by changing > > return $([ 'true' = "$lcvar" ] || [ 'yes' = "$lcvar" ] || [ 1 = "$lcvar" ]) > > to > > [ 'true' = "$lcvar" ] || [ 'yes' = "$lcvar" ] || [ 1 = "$lcvar" ] > return $? > > PS: I'm not even sure that original code works with bash, as $() should > be replaced with output of commands inside and [ (test) command does not > have any output.
That's not my undertanding of how return works: return: return [n] Causes a function to exit with the return value specified by N. If N is omitted, the return status is that of the last command. and it certainly does work in bash: [EMAIL PROTECTED]:~/t/clamav-0.93$ bash [EMAIL PROTECTED]:~/t/clamav-0.93$ . debian/common_functions [EMAIL PROTECTED]:~/t/clamav-0.93$ is_true false [EMAIL PROTECTED]:~/t/clamav-0.93$ echo $? 1 Since the subshell is evaluated first, it is the last command, and that exit status is what (I thought) should be returned. In doing some testing, I see that what is actually likely happening is that return is being called with a null argument, and bash is passing back the exit status of the last command, where dash does not seem to. I'll make the change and reupload. Cheers, -- ----------------------------------------------------------------- | ,''`. Stephen Gran | | : :' : [EMAIL PROTECTED] | | `. `' Debian user, admin, and developer | | `- http://www.debian.org | -----------------------------------------------------------------
signature.asc
Description: Digital signature