From: David Tardon Date: Fri, 5 Dec 2025 12:09:16 +0000 (+0100) Subject: find-esp: replace assert by a runtime check X-Git-Tag: v259-rc3~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50482aced5c86ec8ad1962b33cf79464dc06b462;p=thirdparty%2Fsystemd.git find-esp: replace assert by a runtime check The path--as a whole--is no longer being opened with O_DIRECTORY, hence the assertion is not valid. Reproducer: # SYSTEMD_RELAX_ESP_CHECKS=1 bootctl list --esp-path=`pwd`/README Assertion 'S_ISDIR(sxa.stx_mode)' failed at src/shared/find-esp.c:295, function verify_fsroot_dir(). Aborting. Follow-up-for: 63105f33edad423691e2d53bf7071f99c83799ba Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2417917 --- diff --git a/src/shared/find-esp.c b/src/shared/find-esp.c index 1796ed8c760..f029d7ea922 100644 --- a/src/shared/find-esp.c +++ b/src/shared/find-esp.c @@ -292,7 +292,8 @@ static int verify_fsroot_dir( (unprivileged_mode && ERRNO_IS_PRIVILEGE(errno)) ? LOG_DEBUG : LOG_ERR, errno, "Failed to determine block device node of \"%s\": %m", path); - assert(S_ISDIR(sxa.stx_mode)); /* We used O_DIRECTORY above, when opening, so this must hold */ + if (!S_ISDIR(sxa.stx_mode)) + return log_error_errno(SYNTHETIC_ERRNO(ENOTDIR), "Path \"%s\" is not a directory", path); if (FLAGS_SET(sxa.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) {