Thank you for addressing my bug report #849100.

I believe, however, that the fix only partially addresses the bug.
In current master, 
<https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git/tree/debian/dhclient-script.linux#n144> 
and 
<https://anonscm.debian.org/cgit/pkg-dhcp/isc-dhcp.git/tree/debian/dhclient-script.linux#n149>, 
(both in the same function "exit_with_hooks", there is a check of 
success in the form
    if ! run_something ; then
        exit_status = $?
    fi

Which is erronous - it is guaranteed to set exit_status=0 which is not the intended result.
The reason this happens is that the "if/then" construct already eats the 
$? return code. To get convince myself, I used the following test:
---script---
#!/bin/sh
return_1() {
    return 1
}

return_1
echo "RC is $?"

if ! return_1; then
  echo "then RC is $?"
else
  echo "else RC is $?"
fi
---output---
RC is 1
then RC is 0
------------

The solution requires either:

    if ! run_something ; then
        exit_status = $?
    fi

to be replaced with something like

    run_something
    exit_status=$((exit_status|$?))

or some other construct that stores the $? return code before "if/then" eats it. I am not a shell expert, I'm not sure the fix above is exactly what is needed, but as my example test script shows, there is still a bug.


Reply via email to