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.
}
if (arg_test)
- return hwdb_query(arg_test, NULL);
+ return hwdb_query(arg_test, arg_root);
return 0;
}