From bae1b65b897607e7ad3f6fc6433e35e4f087856c Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Tue, 3 Aug 2021 10:05:27 +0200 Subject: [PATCH] Put TMPDIR on /var/tmp by default Resolves: rhbz1988420 --- rear-tmpdir.patch | 37 +++++++++++++++++++++++++++++++++++++ rear.spec | 1 + 2 files changed, 38 insertions(+) create mode 100644 rear-tmpdir.patch diff --git a/rear-tmpdir.patch b/rear-tmpdir.patch new file mode 100644 index 0000000..ec5ba71 --- /dev/null +++ b/rear-tmpdir.patch @@ -0,0 +1,37 @@ +diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf +index 9ada92c3..3bdb5497 100644 +--- a/usr/share/rear/conf/default.conf ++++ b/usr/share/rear/conf/default.conf +@@ -57,10 +57,16 @@ + # + # where /prefix/for/rear/working/directory must already exist. + # This is useful for example when there is not sufficient free space +-# in /tmp or $TMPDIR for the ISO image or even the backup archive. +-# TMPDIR cannot be set to a default value here, otherwise /usr/sbin/rear ++# in /var/tmp or $TMPDIR for the ISO image or even the backup archive. ++# TMPDIR cannot be set to a default value here unconditionally but only ++# if it is not set before calling the program, otherwise /usr/sbin/rear + # would not work in compliance with the Linux/Unix standards regarding TMPDIR + # see https://github.com/rear/rear/issues/968 ++# The default is /var/tmp instead of the more usual /tmp (the system default), ++# because /tmp is not intended for such large amounts of data that ReaR usually ++# produces when creating the image (see file-hierarchy(7)). In particular, ++# /tmp can be a tmpfs, and thus restricted by the available RAM/swap. ++export TMPDIR="${TMPDIR-/var/tmp}" + + ## + # ROOT_HOME_DIR +diff --git a/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh b/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh +deleted file mode 100644 +index 84d0cabb..00000000 +--- a/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh ++++ /dev/null +@@ -1,8 +0,0 @@ +-cat - <> "$ROOTFS_DIR/etc/rear/rescue.conf" +-# TMPDIR variable may be defined in local.conf file as prefix dir for mktemp command +-# e.g. by defining TMPDIR=/var we would get our BUILD_DIR=/var/tmp/rear.XXXXXXXXXXXX +-# However, in rescue we want our BUILD_DIR=/tmp/rear.XXXXXXX as we are not sure that +-# the user defined TMPDIR would exist in our rescue image +-# by 'unset TMPDIR' we achieve above goal (as rescue.conf is read after local.conf)! +-unset TMPDIR +-EOF diff --git a/rear.spec b/rear.spec index 395283c..752faee 100644 --- a/rear.spec +++ b/rear.spec @@ -18,6 +18,7 @@ Patch0: 0001-skip-kernel-buildin-modules.patch Patch4: rear-bz1492177-warning.patch Patch29: rear-bz1832394.patch Patch30: rear-sfdc02772301.patch +Patch34: rear-tmpdir.patch # rear contains only bash scripts plus documentation so that on first glance it could be "BuildArch: noarch" # but actually it is not "noarch" because it only works on those architectures that are explicitly supported.