From ef02c579ea1057028bd8a8fe394dd413f09a8e3d Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 6 Sep 2015 06:52:33 +0000 Subject: pbuilder-modules: remove the /tmp/buildd symlink if it points to the current BUILDDIR before repacking and just after unpacking Closes: #797351 --- pbuilder-modules | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pbuilder-modules') diff --git a/pbuilder-modules b/pbuilder-modules index 9caee07..8efa273 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -503,6 +503,9 @@ function extractbuildplace () { # BUILDDIR, please file a bug if you need that variable to also be available # elsewhere other than hook script; given that, I won't do too fancy checks) if [ "$BUILDDIR" != '/tmp/buildd' ]; then + if [ -h "$BUILDPLACE/tmp/buildd" ] && [ "$(readlink -f "$BUILDPLACE/tmp/buildd")" = "${BUILDPLACE}$BUILDDIR" ]; then + rm "$BUILDPLACE/tmp/buildd" + fi if [ -d "$BUILDPLACE/tmp/buildd" ] && [ ! -h "$BUILDPLACE/tmp/buildd" ]; then if [ ! "$(ls -A "$BUILDPLACE/tmp/buildd" 2>&1)" ]; then # empty /tmp/buildd, let's change it to a symlink to BUILDDIR @@ -575,6 +578,9 @@ function create_basetgz() { sleep 10s done log "I: creating base tarball [${BASETGZ}]" + if [ -h "$BUILDPLACE/tmp/buildd" ] && [ "$(readlink -f "$BUILDPLACE/tmp/buildd")" = "${BUILDPLACE}$BUILDDIR" ]; then + rm "$BUILDPLACE/tmp/buildd" + fi if ! tar -c --use-compress-program "$COMPRESSPROG" -f "${BASETGZ}.tmp" * ; then log "E: failed building base tarball" rm -f "${BASETGZ}.tmp" -- cgit v1.2.3