test: fix bind mount test to work without /dev/shm mounted - #139
Merged
Conversation
KrzysztofMolon
force-pushed
the
fix-bind-mount-test
branch
2 times, most recently
from
July 16, 2026 10:53
78a67aa to
61ab9db
Compare
Replace the two /proc/mounts-based bind mount assertions with stat-based device number comparisons. The old tests parsed /proc/mounts entries with sed, which is fragile: /proc/mounts does not distinguish bind mounts from their source mount. The new tests use stat -c %d to compare device numbers: - bind mount: verify /dev/shm and /mnt share the same device - tmpfs mount: verify /dev/shm and /mnt have different devices This works regardless of whether /dev/shm is a separate tmpfs mountpoint or just a subdirectory of /dev.
KrzysztofMolon
force-pushed
the
fix-bind-mount-test
branch
from
July 16, 2026 11:18
61ab9db to
840e93e
Compare
Snaipe
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/proc/mounts-based bind mount assertions with a singlestat -c %ddevice number comparison/proc/mountsentries with sed —/proc/mountsdoes not distinguish bind mounts from their source, making the comparison unreliablestat, which works regardless of whether/dev/shmis a separate tmpfs mountpoint or just a subdirectory of/dev/dev/shmis not mounted as its own filesystemInvestigation
The old test failed in barney because
/dev/shmis not a separate mount — it's a subdirectory of the/devtmpfs. We investigated two approaches:mountinfo(device ID column 3): works when/dev/shmis a mountpoint, but fails when it's a subdirectory because it has no entry in mountinfostat -c %d(device number): works in both cases — stat reports the device of the filesystem the path lives onTested in both GitHub CI (Docker,
/dev/shm= separate tmpfs) and barney (no/dev/shmmount).Supersedes #137 (reverted in #138). Suggested by @Snaipe.
Test plan
mount -t tmpfs tmpfs /dev/shm