Skip to content

Commit

Permalink
tests: create XDG_RUNTIME_DIR with mode 0700
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gperciva committed Dec 6, 2023
1 parent 1eff3b1 commit efa30fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/tests-include.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand Down
2 changes: 1 addition & 1 deletion tests/valgrind/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down

0 comments on commit efa30fa

Please sign in to comment.