Skip to content

Test failure if there are systemd credential mounts with name containing backslash #778

Closed

Description

@smcv

Even with #777, I'm seeing a test failure when running the bubblewrap test suite on a real system:

not ok 54 test_ro_bind_root_is_recursive
...
#   File "[REDACTED]/bubblewrap/tests/test-sandbox.py", line 331, in _test_ro_bind_root_is_recursive
#     flags = os.statvfs(mountpoint).f_flag
# FileNotFoundError: [Errno 2] No such file or directory: '/run/credentials/systemd-cryptsetup@[REDACTED].service'

I can work around this with

diff --git a/tests/test-sandbox.py b/tests/test-sandbox.py
index 74fb4aa..95351b7 100644
--- a/tests/test-sandbox.py
+++ b/tests/test-sandbox.py
@@ -328,7 +328,12 @@ class TestSandbox(unittest.TestCase):
             if any(mountpoint == p or mountpoint.startswith(p + '/')
                    for p in skip_prefixes):
                 continue
-            flags = os.statvfs(mountpoint).f_flag
+
+            try:
+                flags = os.statvfs(mountpoint).f_flag
+            except FileNotFoundError:
+                pass
+
             self.assertTrue(
                 flags & os.ST_RDONLY,
                 f'{mountpoint} is not read-only',

but I'd prefer to understand what's happening here and why. Perhaps it's just that these are mount points that I don't have read access to as an unprivileged user, and so they're excluded from the recursive bind-mount?

Activity

  1. smcv commented on Aug 28, 2026

    @smcv
    CollaboratorAuthor

    This happens for both test_ro_bind_root_is_recursive and test_ro_bind_root_is_recursive_fallback.

  2. xxyzz commented on Aug 29, 2026

    @xxyzz
    Contributor

    Maybe it's not a shared mount?

  3. smcv commented on Aug 29, 2026

    @smcv
    CollaboratorAuthor

    Aha, found it. The problem is not that they aren't shared (they are), the problem is that one of my credentials has a - in its name, which systemd escapes as \x2d, which /proc/self/mounts then re-escapes as \134x2d.

  4. changed the title [-]Test failure if there are systemd credential mounts[/-] [+]Test failure if there are systemd credential mounts with name containing backslash[/+] on Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions