From efa30fa9dc1262fff1d5d882de544ba4bea4e15a Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Wed, 6 Dec 2023 11:22:22 -0800 Subject: [PATCH] tests: create XDG_RUNTIME_DIR with mode 0700 The XDG specification requires this: $XDG_RUNTIME_DIR defines the base directory relative to which... ... Its Unix access mode MUST be 0700. https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html Confusingly, mkdir -m X -p /tmp/tarsnap-gui-test/test-blah only applies the `-m X` to test-blah/, not tarsnap-gui-test/. I don't understand why POSIX specifies it as such, but at least it's clearly defined as such in: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html --- tests/tests-include.pri | 3 ++- tests/valgrind/generate.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tests-include.pri b/tests/tests-include.pri index f867f7d3..dce79be3 100644 --- a/tests/tests-include.pri +++ b/tests/tests-include.pri @@ -35,7 +35,8 @@ OBJECTS_DIR = $$TOPDIR/build/tests/ TEST_HOME = /tmp/tarsnap-gui-test DEFINES += "TEST_DIR=\\\"$${TEST_HOME}/$${TARGET}\\\"" DEFINES += "TEST_NAME=\\\"$${TARGET}\\\"" -test_home_prep.commands = rm -rf "$${TEST_HOME}/$${TARGET}" +test_home_prep.commands = rm -rf "$${TEST_HOME}/$${TARGET}"; \ + mkdir -m 0700 -p "$${TEST_HOME}" # XDG_*_HOME uses a custom "home" directory to store data, thereby not messing # up user-wide files. TEST_ENV = XDG_CONFIG_HOME=$${TEST_HOME} \ diff --git a/tests/valgrind/generate.sh b/tests/valgrind/generate.sh index 596e9427..70a6ef38 100755 --- a/tests/valgrind/generate.sh +++ b/tests/valgrind/generate.sh @@ -158,7 +158,7 @@ if [ "$DEBUG" -eq 1 ]; then fi # Create XDG dir (if necessary) -mkdir -p "${XDGD}" +mkdir -m 0700 -p "${XDGD}" # If the suppressions already exist, indicate that this is a retest. # (This may be useful while investigating occasional memory leaks.)