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
parent 64683d12
......@@ -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
......@@ -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"
......
......@@ -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"
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment