Hi, Thanks for the patch, will apply in next release.
At Tue, 19 Mar 2013 10:11:28 +0100, Jean-Baptiste Lallement wrote: > > [1 <text/plain; UTF-8 (7bit)>] > Package: cowdancer > Version: 0.71 > Tags: patch > > Reference issue in Ubuntu [1] > > If a bind-mounted directory is still mounted during the clean-up phase > (device busy for example) cowbuilder unconditionally deletes its content. > > Excerpt from a log with this bug (complete log attached) > ===== > I: umounting /var/lib/jenkins/cu2d > umount: /var/cache/pbuilder/build/cow.15281/var/lib/jenkins/cu2d: device > is busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > [...] > -> Cleaning COW directory > forking: rm -rf /var/cache/pbuilder/build//cow.1195 > rm: cannot remove > `/var/cache/pbuilder/build//cow.1195/var/cache/pbuilder/ccache': Device > or resource busy > rm: cannot remove > `/var/cache/pbuilder/build//cow.1195/var/lib/jenkins/cu2d/work/experimental/100scopes': > > Device or resource busy > rm: cannot remove > `/var/cache/pbuilder/build//cow.1195/var/lib/jenkins/cu2d/launchpad.cache': > Directory not empty > ===== > > This bug occurs when pbuilder fails to mount a bindmounted directory, > then fails to unmount previously successfully mounted directories. This > condition is not so rare when executing several cowbuilder processes in > parallel using the same bind-mounted directories. wait, what? Not sure I understand. > > The attached patch has been proposed to Ubuntu and skips cleanup if > anything is mounted under the chroot. > > [1] https://bugs.launchpad.net/ubuntu/+source/cowdancer/+bug/1156540 > > -- > Jean-Baptiste > IRC: jibel > [2 cowdancer_0.71ubuntu1.debdiff <text/plain; UTF-8 (base64)>] > diff -Nru cowdancer-0.71/cowbuilder.c cowdancer-0.71ubuntu1/cowbuilder.c > --- cowdancer-0.71/cowbuilder.c 2011-07-29 15:01:39.000000000 +0200 > +++ cowdancer-0.71ubuntu1/cowbuilder.c 2013-03-19 09:27:03.000000000 > +0100 > @@ -46,6 +46,7 @@ > #include <sys/wait.h> > #include <string.h> > #include <unistd.h> > +#include <mntent.h> > #include "parameter.h" > #include "ilist.h" > > @@ -220,7 +221,61 @@ > */ > static int cpbuilder_internal_cleancow(const struct pbuilderconfig* pc) > { > + /* > + * A directory bind-mounted into pc->buildplace, will be cleaned out by > + * rmrf() > + * To avoid that potential disaster we want to make sure that there is > + * *nothing* mounted under the chroot before running the cleanup procedure > + */ > + > + char dest[strlen(pc->buildplace)]; > + int i=0; > + int j=0; > + unsigned char ch; > + > printf(" -> Cleaning COW directory\n"); > + > + /* Remove // from pc->buildplace */ > + while(pc->buildplace[i]) > + { > + ch = pc->buildplace[i]; > + if(i==0) > + { > + j++; > + dest[0] = pc->buildplace[0]; > + } > + else > + { > + if (ch != pc->buildplace[i-1] || ch != '/') > + { > + dest[j] = ch; > + j++; > + } > + } > + i++; > + } > + dest[j] = '\0'; > + > + /* Check if buildplace is still mounted */ > + FILE *mtab = NULL; > + struct mntent * part = NULL; > + if ((mtab = setmntent("/etc/mtab", "r")) != NULL) > + { > + while ((part = getmntent(mtab) ) != NULL) > + { > + if ( part->mnt_fsname != NULL ) > + { > + if (strstr(part->mnt_dir, dest) ) > + { > + printf("E: Something is still mounted under %s; unmount > and remove %s manually\n", dest, dest); > + endmntent(mtab); > + return 1; > + } > + } > + } > + endmntent(mtab); > + } > + > if (0!=rmrf(pc->buildplace)) > return 1; > return 0; > Binary files /tmp/2njoJ6paZ0/cowdancer-0.71/.cowbuilder.c.swp and > /tmp/C4QmySsSlo/cowdancer-0.71ubuntu1/.cowbuilder.c.swp differ > diff -Nru cowdancer-0.71/debian/changelog > cowdancer-0.71ubuntu1/debian/changelog > --- cowdancer-0.71/debian/changelog 2012-08-23 21:51:56.000000000 +0200 > +++ cowdancer-0.71ubuntu1/debian/changelog 2013-03-19 09:38:12.000000000 > +0100 > @@ -1,3 +1,11 @@ > +cowdancer (0.71ubuntu1) UNRELEASED; urgency=low > + > + * A directory bind-mounted into pc->buildplace, will be cleaned out by > + rmrf() To avoid this disaster, we skip buildplace clean-up if a directory > + is bind-mounted under the chroot (LP: #1156540) > + > + -- Jean-Baptiste Lallement <jean-baptiste.lallem...@canonical.com> Tue, 19 > Mar 2013 09:35:26 +0100 > + > cowdancer (0.71) unstable; urgency=low > > * copyright file in copyright-format-1.0 as specified in policy version > 3.9.3.1 > [3 > cu2d-100scopes-experimental-1.1prepare-unity-scope-calculator_2013-03-18_07-23-49_log > <text/plain; UTF-8 (base64)>] > Started by upstream project > "[8mha:AAAArB+LCAAAAAAAAABb85aBtbiIQSajNKU4P08vOT+vOD8nVc+jsiC1KCczL9svvyT1dMUiOWdZ/mImBiZPBrac1Lz0kgwfBubSopwSBiGfrMSyRP2cxLx0/eCSosy8dOuKIgYpNOOcITTIMAYIYGRiYKgoADLUShh09LPyk/STS41SdA0NDIqT8wtSi3VTK4AuyMxNzStJzNE11DMoKEotSCxK1QcA2cXCB7EAAAA=[0mcu2d-100scopes-experimental-1.0prepare" > build number > [8mha:AAAArR+LCAAAAAAAAABdjjsOwjAQBRcjaJEoEXCD2AkdokwDUkTDCUxY5YNZW2sHmetQcxPOwh0ISsdrZqrRe31g4hmWdXfxlmRpyVuDcv9wyKah69EGfMfnOl/NvABxgKlBqkJdwLhjE2BetPquldFUqVPghqpdZFj85fKBvxgMGwmA6HoRAaRq7VmV3eaSZGnqS+vQJxj7B80NKWiTZDJ1jE4zqmz7BZnNiZCzAAAA[0m19 > [EnvInject] - Loading node environment variables. > Building on master > [workspace] $ /bin/bash -e /tmp/hudson5834096135151465052.sh > 2013-03-18 07:23:59,293 INFO Branching lp:~submarine/ubuntu-scopes/calculator > to unity-scope-calculator > 2013-03-18 07:24:46,577 INFO Get changelog info > 2013-03-18 07:24:47,711 INFO Get previous version in ppa > 2013-03-18 07:25:00,006 INFO A version in the ppa > (0.1daily13.03.15.1ubuntu.unity.experimental.certified-0ubuntu1) is higher > than the proposed version in bzr (0.1-0ubuntu1) (previous tests/builds > failing?). Basing on that one. > 2013-03-18 07:25:00,006 INFO Get version available in distro > 2013-03-18 07:25:11,203 INFO Check if we need to release a new package > 2013-03-18 07:25:11,204 INFO This package was never released to the > destination archive, don't return downloaded source > 2013-03-18 07:25:11,204 INFO Update symbol files version if needed > 2013-03-18 07:25:11,204 INFO Prepare changelog content > dch warning: Recognised distributions are: > {hardy,lucid,maverick,natty,oneiric,precise,quantal}{,-updates,-security,-proposed,-backports} > and UNRELEASED. > Using your request anyway. > 2013-03-18 07:25:13,125 INFO Generate a diff if meaningfull packaging changes > 2013-03-18 07:25:13,125 INFO Build source package and upload to the ppa > -> Copying COW directory > forking: rm -rf /var/cache/pbuilder/build//cow.1195 > forking: cp -al /var/cache/pbuilder/raring-amd64/base.cow > /var/cache/pbuilder/build//cow.1195 > I: removed stale ilistfile /var/cache/pbuilder/build//cow.1195/.ilist > -> Invoking pbuilder > forking: pbuilder execute --bindmounts > /var/lib/jenkins/cu2d/work/experimental/100scopes --bindmounts > /var/lib/jenkins/cu2d --buildplace /var/cache/pbuilder/build//cow.1195 > --no-targz --internal-chrootexec chroot /var/cache/pbuilder/build//cow.1195 > cow-shell /home/desktop-team/cupstream2distro/chroot-tools/buildsource-chroot > /var/lib/jenkins/cu2d/work/experimental/100scopes/unity-scope-calculator > --gnupg-parentdir /var/lib/jenkins/cu2d --uid 111 --gid 120 --gnupg-keyid > B879A3E9 --distro-version 0 > I: Running in no-targz mode > I: copying local configuration > I: mounting /proc filesystem > I: mounting /dev/pts filesystem > I: Mounting /var/cache/pbuilder/ccache > I: Mounting /var/lib/jenkins/cu2d > I: Mounting /var/lib/jenkins/cu2d/work/experimental/100scopes > /usr/lib/pbuilder/pbuilder-modules: line 273: 24886 Alarm clock > mount $MOUNTPARAMS "$mnt" "$BUILDPLACE/$mnt" > I: error recovery: umount successfully mounted mount-points: > /var/cache/pbuilder/build/cow.1195/proc > /var/cache/pbuilder/build/cow.1195/dev/pts /var/cache/pbuilder/ccache > /var/lib/jenkins/cu2d > I: umounting /var/cache/pbuilder/build/cow.1195/proc > I: umounting /var/cache/pbuilder/build/cow.1195/dev/pts > I: umounting /var/cache/pbuilder/ccache > I: umounting /var/lib/jenkins/cu2d > umount: /var/cache/pbuilder/build/cow.15281/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > umount: /var/cache/pbuilder/build/cow.1195/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > umount: /var/cache/pbuilder/build/cow.1197/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > umount: /var/cache/pbuilder/build/cow.1739/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > umount: /var/cache/pbuilder/build/cow.59368/var/lib/jenkins/cu2d: not mounted > umount: /var/cache/pbuilder/build/cow.53454/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > umount: /var/cache/pbuilder/build/cow.36950/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > umount: /var/cache/pbuilder/build/cow.19691/var/lib/jenkins/cu2d: device is > busy. > (In some cases useful info about processes that use > the device is found by lsof(8) or fuser(1)) > -> Cleaning COW directory > forking: rm -rf /var/cache/pbuilder/build//cow.1195 > rm: cannot remove > `/var/cache/pbuilder/build//cow.1195/var/cache/pbuilder/ccache': Device or > resource busy > rm: cannot remove > `/var/cache/pbuilder/build//cow.1195/var/lib/jenkins/cu2d/work/experimental/100scopes': > Device or resource busy > rm: cannot remove > `/var/cache/pbuilder/build//cow.1195/var/lib/jenkins/cu2d/launchpad.cache': > Directory not empty > Traceback (most recent call last): > File "/var/lib/jenkins/cu2d/cupstream2distro/prepare-package", line 166, in > <module> > packagemanager.build_source_package(series, previous_finaledest_version) > File > "/home/desktop-team/cupstream2distro/cupstream2distro/packagemanager.py", > line 295, in build_source_package > raise Exception("The above command returned an error.") > Exception: The above command returned an error. > Error in sys.excepthook: > Traceback (most recent call last): > File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 70, in > apport_excepthook > binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0])) > OSError: [Errno 2] No such file or directory > > Original exception was: > Traceback (most recent call last): > File "/var/lib/jenkins/cu2d/cupstream2distro/prepare-package", line 166, in > <module> > packagemanager.build_source_package(series, previous_finaledest_version) > File > "/home/desktop-team/cupstream2distro/cupstream2distro/packagemanager.py", > line 295, in build_source_package > raise Exception("The above command returned an error.") > Exception: The above command returned an error. > Build step 'Execute shell' marked build as failure > Archiving artifacts > Recording test results > Build was marked for publishing on https://jenkins.qa.ubuntu.com/ > Notifying upstream projects of job completion > Finished: FAILURE -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org