[pbuilder] 01/02: modules: mount a tmpfs on /dev/shm by default, and set up a symlink /run/shm → /dev/shm

Mattia Rizzolo mattia at debian.org
Sun Jan 15 11:16:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository pbuilder.

commit 484ff6639c2907ae3d2fc5499d7b427c9cf02550
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Fri Jan 13 17:06:50 2017 +0100

    modules: mount a tmpfs on /dev/shm by default, and set up a symlink /run/shm → /dev/shm
    
    This also renames the configuration variable USERUNSHM into USESHM
    (deprecating the former).
    
    This will happen regardless of the Debian version of the chroot, and of
    the architecture used, as it ought to be harmless if unused.
    Administrators are suggested to drop any workaround in place to overcome
    this deficiency in pbuilder, such as bind-mounting /dev/shm from the
    host, to avoid over-mounting situations and such (to be clear: tests
    show that over-mounting is handled correctly, but still).
    
    Closes: #591291, #717022, #773765
---
 pbuilder-loadconfig |  5 +++++
 pbuilder-modules    | 19 ++++++++++++-------
 pbuilderrc          |  2 +-
 pbuilderrc.5        | 15 +++++++++++++--
 4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/pbuilder-loadconfig b/pbuilder-loadconfig
index e088857..f469b03 100644
--- a/pbuilder-loadconfig
+++ b/pbuilder-loadconfig
@@ -36,4 +36,9 @@ for RCFILE in \
         echo "W: PKGNAME_LOGFILE_EXTENTION will be removed at some point, please update your config!"
         PKGNAME_LOGFILE_EXTENSION="$PKGNAME_LOGFILE_EXTENTION"
     fi
+    # deprecated in v0.228
+    if [ -n "${USERUNSHM-}" ]; then
+        # wait some more before warning about this deprecation
+        USESHM="$USERUNSHM"
+    fi
 done
diff --git a/pbuilder-modules b/pbuilder-modules
index 051750a..cf88f0c 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -281,8 +281,8 @@ function umountproc () {
     if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ] || [ "$USEDEVFS" = "yes" ]; then
         umount_one "dev"
     fi
-    if [ "$USERUNSHM" = "yes" ] && [ "$DEB_BUILD_ARCH_OS" != "hurd" ]; then
-        umount_one "run/shm"
+    if [ "$USESHM" = "yes" ]; then
+        umount_one "dev/shm"
     fi
     if [ "$USEPROC" = "yes" ]; then
         if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ -e "$BUILDPLACE/proc/sys/fs/binfmt_misc/status" ]; then
@@ -360,11 +360,16 @@ function mountproc () {
         esac
         mounted[${#mounted[@]}]="$BUILDPLACE/sys"
     fi
-    if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ "$USERUNSHM" = "yes" ]; then
-        log.i "mounting /run/shm filesystem"
-        mkdir -p "$BUILDPLACE/run/shm" || true
-        mount -t tmpfs tmpfs "$BUILDPLACE/run/shm"
-        mounted[${#mounted[@]}]="$BUILDPLACE/run/shm"
+    if [ "$USESHM" = "yes" ]; then
+        log.i "creating /{dev,run}/shm"
+        rm -df "$BUILDPLACE/dev/shm" "$BUILDPLACE/run/shm"
+        mkdir -p "$BUILDPLACE/dev/shm"
+        chmod 777 "$BUILDPLACE/dev/shm"
+        # old releases might not have /run.  We create it nonetheless, can't harm
+        mkdir -p "$BUILDPLACE/run"
+        ln -s /dev/shm "$BUILDPLACE/run/shm"
+        mount -t tmpfs tmpfs "$BUILDPLACE/dev/shm"
+        mounted[${#mounted[@]}]="$BUILDPLACE/dev/shm"
     fi
     if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ "$USEDEVPTS" = "yes" ]; then
         log.i "mounting /dev/pts filesystem"
diff --git a/pbuilderrc b/pbuilderrc
index ddbd095..86cd4b7 100644
--- a/pbuilderrc
+++ b/pbuilderrc
@@ -27,12 +27,12 @@ BUILD_HOME=/nonexistent
 MIRRORSITE=http://httpredir.debian.org/debian
 #OTHERMIRROR="deb http://www.home.com/updates/ ./"
 #export http_proxy=http://your-proxy:8080/
+USESHM=yes
 USEPROC=yes
 USEDEVFS=no
 USEDEVPTS=yes
 USESYSFS=yes
 USENETWORK=no
-USERUNSHM=yes
 BUILDRESULT=/var/cache/pbuilder/result/
 
 # specifying the distribution forces the distribution on "pbuilder update"
diff --git a/pbuilderrc.5 b/pbuilderrc.5
index cee3c68..7384a94 100644
--- a/pbuilderrc.5
+++ b/pbuilderrc.5
@@ -471,12 +471,23 @@ Network is not available on a Debian buildd, so you might
 want to keep the default.
 Disabling network access currently only works on Linux.
 .TP
-.BI "USERUNSHM=" "yes"
+.BI "USESHM=" "yes"
 Specify
 .B yes
 when it is desired to mount
-.B /run/shm
+.B /dev/shm
 mount point. It is usually a good idea in order to work with software that expect shm to work.
+.br
+.B /run/shm
+will be configured as a symbolic link to
+.BR /dev/shm .
+.br
+This option used to be named
+.BR USERUNSHM ,
+for compatibility purpose the old name is still supported, and if set it'll
+override any
+.BR USESHM .
+
 .TP
 .BI "USE_PDEBUILD_INTERNAL=" "yes"
 When this option is set to

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/pbuilder.git



More information about the Pbuilder-maint mailing list