On Fri, Nov 17, 2006 at 01:21:39AM +0100, Frederic Schutz wrote:
> Here is where I am with this bug.

> postinst calls /usr/share/wwwconfig-common/restart.sh, which itself
> calls /etc/init.d/apache2 restart.

> If the restart fails with exit value != 0, the execution of the scripts
> stops, thus making postinst fail.

> If I replace /usr/share/wwwconfig-common/restart.sh by a single call to
> an external script which contains only a line "exit 1", postinst will
> fail; with "exit 0", it will work.

> I would think that if the external script exits with return value 1,
> /usr/share/wwwconfig-common/restart.sh would get this return value and
> continue its execution, but no, it never gets an opportunity to continue
> executing -- which means that postinst will not be able to continue
> executing, and it will look like it failed.

> I am maybe missing something simple here, but I have not been able to
> reproduce this behaviour outside of postinst -- everytime the external
> script exits with value 1, return.sh just continue executing normally.
> Any help ?

Your postinst runs under set -e, as it should, and then it sources
/usr/share/wwwconfig-common/restart.sh (it does *not* execute it).   That
means any non-zero exit codes from restart.sh are going to propagate and
result in the shell (i.e., the postinst) exiting non-zero.

You may be able to address this by checking the return value of the source
command, e.g.:

if ! . /usr/share/wwwconfig-common/restart.sh ; then
        handle_the_error
fi

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to