Mailinglist Archive: opensuse-buildservice (170 mails)

< Previous Next >
[opensuse-buildservice] [PATCH] - fixup build for BuildRequires: Sun JRE
  • From: <Michael_E_Brown@xxxxxxxx>
  • Date: Tue, 29 Sep 2009 11:35:38 -0500
  • Message-id: <23FB5629F59DB0438C772CCC7352E5B9B73434@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

The RPM %post for the official SUN JRE will mount /proc/sys/fs/binfmt_misc,
which causes all of the "umount -n $BUILD_ROOT/proc" in init_buildsystem and
build to fail. Then, when the next build comes up /proc is still mounted and
the clean of the buildroot tries to recursively rm -rf all of proc.

Attached is the straightforward patch to fix this for both 'build' and
'init_buildsystem'. I've been carrying these privately for > 6 months now.
Please apply, I'm tired of breaking my build service every time I upgrade. :)

A better long-term fix would be to use the 'unshare(CLONE_NEWNS)' system call
to detach from the parents FS so that mounts of /proc, etc wont outlive the
build process. This would also completely eliminate the need to umount when
complete. But this would require a much more intrusive reorganization of the
build code.

--
Michael



--- obs-orig/build 2009-09-29 11:17:14.000000000 -0500
+++ obs-fixes/build 2009-09-29 11:14:58.000000000 -0500
@@ -192,6 +191,7 @@
exec /bin/bash -c 'mount -n -o remount,ro / ; halt -f -p'
halt -f -p
else
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2>/dev/null || true
umount -n $BUILD_ROOT/dev/pts 2>/dev/null || true
test "$VM_IMAGE" = 1 && VM_IMAGE=
@@ -993,6 +1012,7 @@
echo -n "repos=(" >> $BUILD_ROOT/.build/build.data
shellquote "${repos[@]}" >> $BUILD_ROOT/.build/build.data
echo ")" >> $BUILD_ROOT/.build/build.data
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null || true
umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
umount -n $BUILD_ROOT/mnt 2> /dev/null || true
@@ -1608,6 +1587,7 @@
echo "... running `basename $CHECKSCRIPT`"
$CHECKSCRIPT || cleanup_and_exit 1
done
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null
fi

@@ -1628,6 +1608,7 @@
if test -f $BUILD_ROOT/usr/lib/build/mkbaselibs -o "$CREATE_BASELIBS" !=
internal ; then
mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
create_baselibs
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null
fi
fi
@@ -1654,9 +1635,7 @@
if test -n "$RPMS" -a -d "$BUILD_ROOT/$TOPDIR/RPMS" -a -d
"$BUILD_ROOT/.build.oldpackages" -a -x
"$BUILD_ROOT/usr/lib/build/same-build-result.sh" ; then
echo "... comparing built packages with the former built"
# exit with 2, if packages built successfull, but have no changes to
former built packages.
- mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
chroot $BUILD_ROOT /usr/lib/build/same-build-result.sh /.build.oldpackages
"$TOPDIR/RPMS" "$TOPDIR/SRPMS" && cleanup_and_exit 2
- umount -n $BUILD_ROOT/proc 2> /dev/null
fi

echo
--- obs-orig/init_buildsystem 2009-09-29 11:17:19.000000000 -0500
+++ obs-fixes/init_buildsystem 2009-09-29 11:14:53.000000000 -0500
@@ -92,6 +90,7 @@
[ "$BUILD_ROOT" != / ] || chown $browner $BUILD_ROOT
# umount so init_buildsystem can be used standalone
# XXX: use stat -f /dev/pts/ -c %T to check whether it's mounted and not
suppress errors then?
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null || true
umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
umount -n $BUILD_ROOT/mnt 2> /dev/null || true
@@ -100,12 +99,12 @@

function clean_build_root () {
test -n "$BUILD_ROOT" && {
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null || true
umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
umount -n $BUILD_ROOT/mnt 2> /dev/null || true
rm -rf -- $BUILD_ROOT/*
rm -rf -- $BUILD_ROOT/.build
- rm -rf -- $BUILD_ROOT/.root
rm -rf -- $BUILD_ROOT/.init_b_cache
mkdir -p $BUILD_ROOT/proc
mkdir -p $BUILD_ROOT/dev/pts
@@ -323,6 +320,7 @@
if test -e $BUILD_IS_RUNNING ; then
echo It seems that there was an incomplete setup of $BUILD_ROOT.
echo To be sure, we will build it again completely...
+ umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
umount -n $BUILD_ROOT/proc 2> /dev/null
umount -n $BUILD_ROOT/dev/pts 2> /dev/null
umount -n $BUILD_ROOT/mnt 2> /dev/null
< Previous Next >
This Thread
  • No further messages