diff options
author | Stefan Fritsch <sf@sfritsch.de> | 2009-03-18 12:46:18 +0100 |
---|---|---|
committer | Junichi Uekawa <dancer@netfort.gr.jp> | 2009-03-18 23:11:17 +0900 |
commit | 6fd203c1f54e529ea7b1cca7189c647be9050bbf (patch) | |
tree | 44d1513a5d29b20c99f8763d1ed56623960d2ef5 /pbuilder-buildpackage | |
parent | 499e3fa251a0352701e9f4faa1d5c797318692f4 (diff) | |
download | pbuilder-6fd203c1f54e529ea7b1cca7189c647be9050bbf.tar pbuilder-6fd203c1f54e529ea7b1cca7189c647be9050bbf.tar.gz |
Bug#520251: pbuilder: Pbuilder does not umount bindmounts when ssh connection dies
Package: pbuilder
Version: 0.181
Severity: important
When pbuilder is executed over ssh and the ssh connection dies, it won't
umount bind mounts and won't clean up the build dir. Unfortunately,
cowbuilder WILL cleanup the build dir, wiping all bind mounts. The
execution order is like this:
ssh -> sudo -> cowbuilder -> pbuilder
Because of the sudo, the SIGHUP will not be delivered to pbuilder.
However, pbuilder will get SIGPIPE when writing to stdout or stderr.
In addition, even when SIGPIPE is ignored, a write to stdout will give
EPIPE, which causes echo to return with an error.
Therefore, you
- need to catch sigpipe in addition to sighup
- need to ignore sigpipe and sighup in the cleanup handler
- need to set +x in the cleanup handler to avoid exiting just
because echo returns an error.
The attached patch works for me but I have only edited
pbuilder-buildpackage and not the other commands.
Diffstat (limited to 'pbuilder-buildpackage')
-rwxr-xr-x | pbuilder-buildpackage | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage index 2be908e..0fbaf2e 100755 --- a/pbuilder-buildpackage +++ b/pbuilder-buildpackage @@ -52,7 +52,7 @@ export HOME="/tmp/buildd" echobacktime extractbuildplace -trap umountproc_cleanbuildplace_trap exit sighup +trap umountproc_cleanbuildplace_trap exit sighup sigpipe loadhooks if [ ! -d "${BUILDRESULT}" ]; then @@ -89,10 +89,10 @@ recover_aptcache createbuilduser log "I: Installing the build-deps" executehooks "D" -trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup +trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup sigpipe checkbuilddep "$PACKAGENAME" save_aptcache -trap umountproc_cleanbuildplace_trap exit sighup +trap umountproc_cleanbuildplace_trap exit sighup sigpipe log "I: Copying source file" copydsc "$PACKAGENAME" "$BUILDPLACE/tmp/buildd" @@ -140,7 +140,7 @@ else fi if ! wait ${BUILD_PID}; then - trap umountproc_cleanbuildplace_trap exit sighup + trap umountproc_cleanbuildplace_trap exit sighup sigpipe eval "${KILL_WAIT_PID}" log "E: Failed autobuilding of package" executehooks "C" @@ -150,10 +150,10 @@ else # build was successful fi -trap umountproc_cleanbuildplace_trap exit sighup +trap umountproc_cleanbuildplace_trap exit sighup sigpipe executehooks "B" save_aptcache -trap cleanbuildplace_trap exit sighup +trap cleanbuildplace_trap exit sighup sigpipe umountproc @@ -167,6 +167,6 @@ fi : cleanbuildplace -trap - exit sighup +trap - exit sighup sigpipe echobacktime exit 0 |