From: Daniel P. Berrangé Date: Wed, 25 Oct 2023 16:19:35 +0000 (+0100) Subject: test-blockdev-util: avoid abort when /home is a symlink X-Git-Tag: v255-rc1~123^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6aa77f9284070229f73063e15cb4b4aa59cb6020;p=thirdparty%2Fsystemd.git test-blockdev-util: avoid abort when /home is a symlink On rpm-ostree distributions like Fedora SilverBlue /home (and various other well known locations) are symlinks to somewhere beneath /var. The path_is_encrypted() method uses O_NOFOLLOW and as a result will return ELOOP on /home. This causes test-blockdev-util to abort. Add ELOOP to the ignorable set of errnos for testing. Signed-off-by: Daniel P. Berrangé --- diff --git a/src/test/test-blockdev-util.c b/src/test/test-blockdev-util.c index b97783b41fb..134386c3f68 100644 --- a/src/test/test-blockdev-util.c +++ b/src/test/test-blockdev-util.c @@ -8,12 +8,14 @@ static void test_path_is_encrypted_one(const char *p, int expect) { int r; r = path_is_encrypted(p); - if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r)) + if (IN_SET(r, -ENOENT, -ELOOP) || ERRNO_IS_NEG_PRIVILEGE(r)) /* This might fail, if btrfs is used and we run in a container. In that case we cannot * resolve the device node paths that BTRFS_IOC_DEV_INFO returns, because the device nodes * are unlikely to exist in the container. But if we can't stat() them we cannot determine * the dev_t of them, and thus cannot figure out if they are encrypted. Hence let's just - * ignore ENOENT here. Also skip the test if we lack privileges. */ + * ignore ENOENT here. Also skip the test if we lack privileges. + * ELOOP might happen if the mount point is a symlink, as seen with under + * some rpm-ostree distros */ return; assert_se(r >= 0);