#932336 xen-utils-common: vif-nat exits with code 1 even if successful

Package:
src:xen
Source:
xen
Submitter:
Paul Sutor
Date:
2020-11-26 17:12:18 UTC
Severity:
normal
Tags:
#932336#5
Date:
2019-07-17 22:05:37 UTC
From:
To:
Dear Maintainer,

This happened after upgrading from Debian 9 to Debian 10, and also after commenting out line 88 of /etc/xen/scripts/vif-nat.

After I worked around another bug (which hasn't been assigned a number yet - "vif-nat fails to find backend/vif/x/x/domain") in vif-nat on Debian 10, vif-nat still said it was returning code 1 and was thus still preventing domUs from being created.
As I attempted to add "echo"s to the script to find out where it was erroring out, to my surprise I found that just adding the echos made the script work!
I narrowed it down to one strategic place to add an "echo" to let the script work normally: before the "handle_iptable" on line 182.
I don't know why this makes it work - perhaps an exit code is being carried through where it shouldn't.

Thanks,
Paul Sutor

#932336#12
Date:
2019-09-17 23:21:57 UTC
From:
To:
I stumbled over exactly the same issue today, tried to narrow it down by
adding debug messages to the script, and suddenly it worked.

I think the bad guy is

	[ "$dhcp" != 'no' ] && dhcp_up

which returns 1 in case no dhcp is used. Maybe using "if" here is better...

Also handle_iptable (in vif-common.sh) only does a "return" which again
returns 1. Maybe using "return 0" here is better...

The question (for me) is why this leads to an exit. Even if "set -e" is
used in some scripts, why does it exit at handle_iptable() and not
already after the false [ "$dhcp" != 'no' ]?

Stephan