[Bug 1331320] Re: Differences between test-kickseed and real execution
Hamilton Turner
hamiltont at gmail.com
Thu Jun 19 06:26:34 UTC 2014
** Branch linked: lp:~hamiltont-x/kickseed/kickseed
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to kickseed in Ubuntu.
https://bugs.launchpad.net/bugs/1331320
Title:
Differences between test-kickseed and real execution
Status in “kickseed” package in Ubuntu:
Fix Committed
Bug description:
I've encountered an odd issue, perhaps someone can help me isolate.
When I run test-kickseed on the %pre block below, 'handler/pre.sh'
reports a getopt failure parsing the %pre options **and continues
executing**. (support for --log is the feature I'm currently adding
into kickseed, the issue is that it continues executing)
---------------
%pre --log=foobar.log
echo should pass
%end
----------------
When I attempt an install with this %pre **kickseed halts**. This is
because the call to getopt returns a non-zero exit code and errexit
(set -e) is turned on. Halting seems to be the proper behavior, but
test-kickseed continues executing.
I originally thought it had something to do with my shell or my getopt
implementation, but I wrote a small test.sh file (below) that shows
that "set -e" works in a manner consistent with what I'm seeing during
an actual install. This test file halts when running "bash -e test.sh"
or "sh -e test.sh", and test-kickseed does not.
----------test.sh---------------
#!/bin/sh -e
bar () {
set -o | grep errexit
TEMP=`getopt -o '' -l foo: -- "$@"`
echo good stuff
}
bar "--foo=bar"
bar "--log"
---------------------------------
$ ./test.sh
errexit on
good stuff
errexit on
getopt: unrecognized option '--log'
----------------------------------
So what's happening with test-kickseed? I did add a debug statement in
handlers/pre.sh before the call to getopt, and errexit is definitely
turned on. I added a debug statement after getopt, and the error code
is 1. This seems like it should be halting, but for some insane reason
it's not - with set -e I shouldn't even see the output telling me the
error code, the program should terminate automatically.
PS - I have moved all my getopt calls to their own lines, so this is
not an issue with "set -e and ||"
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/kickseed/+bug/1331320/+subscriptions
More information about the foundations-bugs
mailing list