]> git.ipfire.org Git - thirdparty/systemd.git/commit
test: fix test-mount-util when handling duplicate mounts on the same location 7436/head
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Nov 2017 11:48:42 +0000 (12:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Nov 2017 12:28:06 +0000 (13:28 +0100)
commit9b1573ef76b54f72619adf12a1307eb39664952f
tree60c7657ec1ff6a085ea786c9467dbec917d2d6f4
parent4739fc554dd90bb4ec3b3fa09a5e660bdac5a463
test: fix test-mount-util when handling duplicate mounts on the same location

The test was written so far under the assumption that if two mounts are
placed onto the same location the "upper" mount is listed later in
/proc/self/mountinfo. This appears not to be guaranteed however, as
running the tests in a normal nspawn shows.

This patch fixes that: it reverses the hashmap of mounts we build:
instead of keying by path, we key by mnt_id, and if we notice that
path_get_mnt_id() doesn't match what a line in /proc/self/mountinfo
says, we use the returned ID to check if maybe another line agrees.

Fixes: #7431
src/test/test-mount-util.c