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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user