]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Try to create temporary XDG_RUNTIME_DIR with correct mode
authorSimon McVittie <smcv@collabora.com>
Thu, 23 Jun 2022 18:44:27 +0000 (19:44 +0100)
committerSimon McVittie <smcv@collabora.com>
Wed, 13 Jul 2022 19:36:13 +0000 (20:36 +0100)
Signed-off-by: Simon McVittie <smcv@collabora.com>
test/Makefile.am
test/meson.build
test/mkdir-m700.py [new file with mode: 0755]

index 9886f285c52f068dcd50fb10b86aac228088045e..9a25924db8bbf353c4b3d5445f4197a6608089e7 100644 (file)
@@ -855,6 +855,7 @@ EXTRA_DIST += data/installable/meson.build
 EXTRA_DIST += data/meson.build
 EXTRA_DIST += meson.build
 EXTRA_DIST += meta_template.test.in
+EXTRA_DIST += mkdir-m700.py
 
 # Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE
 include $(top_srcdir)/aminclude_static.am
index e65c5c384944e808a167265d898bd5e3e1dac4ea..9fb625970b10112c12a095f50cb2b713893825e4 100644 (file)
@@ -76,8 +76,8 @@ test_env.set('DBUS_TEST_UNINSTALLED', '1')
 
 xdgdir = custom_target('gen-xdgdir',
     command: [
-        python, '-c',
-        'import os, sys; os.makedirs(sys.argv[1], exist_ok=True)',
+        python,
+        files('mkdir-m700.py'),
         meson.current_build_dir() / 'XDG_RUNTIME_DIR',
     ],
     output: 'XDG_RUNTIME_DIR'
diff --git a/test/mkdir-m700.py b/test/mkdir-m700.py
new file mode 100755 (executable)
index 0000000..d8ebddb
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+import os
+import sys
+
+# Note that we can't create the XDG_RUNTIME_DIR with permissions 0700
+# on MSYS2, which rejects attempts to change permissions, hence "|| true".
+os.makedirs(sys.argv[1], exist_ok=True)
+
+try:
+    os.chmod(sys.argv[1], 0o700)
+except OSError:
+    pass