Jonas Meurer <[email protected]> writes:
> On 20/07/2009 Boyd Stephen Smith Jr. wrote:
>> In <[email protected]>, Jonas Meurer wrote:
>> >- in cryptdisks_{start|stop} only one device is setup anyway. here I
>> > simply don't use set -e and check for the error code instead.
>>
>> While I understand your goal here, I think you should try and accomplish it
>> while leaving the entire script "set -e". It helps prevent errors from
>> cascading. Even if you are checking return values for everything now, you
>> might not be so disciplined with changes in the future.
>
> i see your point and indeed i already reverted the change to not set -e
> the scripts. instead I now use a if statement for the invokation of
> handle_crypttab_line_{start,stop}, do post-cryptsetup stuff (umount)
> directly in the while loop, and exit with log_action_end_msg $ret at the
> end of the while loop. that way the script always stops inside the while
> loop, with or without error.
>
> greetings,
> jonas
Beware that if you call a function from a complex expression (if,
while, ||, &&, |) then that function will not use "set -e". Inside the
function you then need to check every return code again or errors will
cascade.
MfG
Goswin
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]