diff options
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 2 | ||||
-rwxr-xr-x | test/test-systemd-tmpfiles.py | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 098b12c495..73beff063b 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2286,7 +2286,7 @@ static int rm_if_wrong_type_safe( return 0; (void) fd_get_path(parent_fd, &parent_name); - log_notice("Wrong file type 0x%x; rm -rf \"%s/%s\"", st.st_mode & S_IFMT, strna(parent_name), name); + log_notice("Wrong file type 0o%o; rm -rf \"%s/%s\"", st.st_mode & S_IFMT, strna(parent_name), name); /* If the target of the symlink was the wrong type, the link needs to be removed instead of the * target, so make sure it is identified as a link and not a directory. */ diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py index a60a6909a4..791a88497c 100755 --- a/test/test-systemd-tmpfiles.py +++ b/test/test-systemd-tmpfiles.py @@ -28,6 +28,7 @@ except AttributeError: sys.exit(EXIT_TEST_SKIP) exe_with_args = sys.argv[1:] +temp_dir = tempfile.TemporaryDirectory(prefix='test-systemd-tmpfiles.') def test_line(line, *, user, returncode=EX_DATAERR, extra={}): args = ['--user'] if user else [] @@ -75,7 +76,7 @@ def test_uninitialized_t(): user=True, returncode=0, extra={'env':{'HOME': os.getenv('HOME')}}) def test_content(line, expected, *, user, extra={}, subpath='/arg', path_cb=None): - d = tempfile.TemporaryDirectory(prefix='test-systemd-tmpfiles.') + d = tempfile.TemporaryDirectory(prefix='test-content.', dir=temp_dir.name) if path_cb is not None: path_cb(d.name, subpath) arg = d.name + subpath @@ -199,12 +200,7 @@ def test_hard_cleanup(*, user): test_content('f= {} - - - - ' + label, label, user=user, subpath='/deep/1/2', path_cb=valid_symlink) def test_base64(): - test_line('f~ /tmp/base64-test - - - - UGlmZgpQYWZmClB1ZmYgCg==', user=False, returncode=0) - - with open("/tmp/base64-test", mode='r') as f: - d = f.read() - - assert d == "Piff\nPaff\nPuff \n" + test_content('f~ {} - - - - UGlmZgpQYWZmClB1ZmYgCg==', "Piff\nPaff\nPuff \n", user=False) if __name__ == '__main__': test_invalids(user=False) |