From: dongshengyuan <545258830@qq.com> Date: Fri, 10 Jul 2026 08:05:07 +0000 (+0800) Subject: udevadm-hwdb: honor root when querying X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13d8955088c00ca87619a146a1a85c3f67e4211d;p=thirdparty%2Fsystemd.git udevadm-hwdb: honor root when querying The deprecated udevadm hwdb command parsed --root for both update and test modes, but the test path always queried the host database. Pass the configured root to hwdb_query() so --root affects --test in the same way as systemd-hwdb query. Reproducer: $ tmp=$(mktemp -d) $ mkdir -p "$tmp/etc/udev/hwdb.d" $ printf 'test:codex-root-test\n ID_TEST_CODEX=from-root\n' > "$tmp/etc/udev/hwdb.d/99-codex.hwdb" $ systemd-hwdb --root="$tmp" update $ systemd-hwdb --root="$tmp" query test:codex-root-test ID_TEST_CODEX=from-root $ udevadm hwdb --root="$tmp" --test=test:codex-root-test udevadm hwdb is deprecated. Use systemd-hwdb instead. The last command was expected to print ID_TEST_CODEX=from-root, but queried the host database instead. --- diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index bb6f03d5408..0a38e6ee068 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -99,7 +99,7 @@ int verb_hwdb_main(int argc, char *argv[], uintptr_t _data, void *userdata) { } if (arg_test) - return hwdb_query(arg_test, NULL); + return hwdb_query(arg_test, arg_root); return 0; }