#3460 Issue closed: mktemp is called before local.conf is sourced

Labels: support / question, fixed / solved / done, not ReaR / invalid

cocker-cc opened issue at 2025-04-23 15:45:

ReaR version

Relax-and-Recover 2.7 / 2022-07-13

Describe the ReaR bug in detail

mktemp is called (Line 623)
before local.conf is sourced (Line 809),
which means that a user-specified $TMPDIR gets not respected.

Platform

Linux x64

OS version

OS_VENDOR=SUSE_LINUX OS_VERSION=15

What steps will reproduce the bug?

specify in /etc/rear/local.conf:

export TMPDIR='/var/tmp/rear'

expected:
ReaR would place temporary Directories like /var/tmp/rear/rear.aGDiX8SMeWnpJYX

actual:
ReaR still creates temporary Directories like /var/tmp/rear.aGDiX8SMeWnpJYX instead

jsmeix commented at 2025-04-24 08:17:

@cocker-cc
specifying TMPDIR in etc/rear/local.conf is not supported.

In ReaR 2.7 usr/share/rear/conf/default.conf shows

# To have a specific working area directory prefix for Relax-and-Recover call
#   export TMPDIR="/prefix/for/rear/working/directory"
# before calling 'rear' (/prefix/for/rear/working/directory must already exist).

https://github.com/rear/rear/blob/rear-2.7/usr/share/rear/conf/default.conf#L53C1-L55C81

In the current ReaR 2.9 release we have a check in sbin/rear

saved_tmpdir="$TMPDIR"
...
# All workflows need to read the configurations first.
...
if [ "$saved_tmpdir" != "$TMPDIR" ] ; then
    Error "Setting TMPDIR in a configuration file is not supported. To specify a working area directory prefix, export TMPDIR before executing '$PROGRAM'"
fi

https://github.com/rear/rear/blob/rear-2.9/usr/sbin/rear#L813


[Export of Github issue for rear/rear.]