resolvectl: reject --raw for regular lookups

--raw only affects ResolveRecord output. Without --type= or an
RFC4501 dns: URI, query takes the ResolveHostname/ResolveAddress
paths, where --raw was silently ignored.

Reproducer:

  build/resolvectl --raw query localhost

Before:

  The command exited successfully and printed regular text output,
  such as:

    localhost: 127.0.0.1

After:

  The command fails before issuing a lookup:

    --raw may only be combined with --type= or dns: URIs.

Follow-up for: 05ea7e87b6
This commit is contained in:
dongshengyuan
2026-08-13 17:40:49 +08:00
parent e021a64391
commit e7223f2ab2
3 changed files with 12 additions and 0 deletions
+4
View File
@@ -565,6 +565,10 @@ testcase_08_resolved() {
run resolvectl query signed.test
grep -qF "signed.test: 10.0.0.10" "$RUN_OUT"
grep -qF "authenticated: yes" "$RUN_OUT"
(! run resolvectl --raw query localhost)
grep -qF -- "--raw may only be combined with --type= or dns: URIs." "$RUN_OUT"
resolvectl --raw=packet query --type=A signed.test >"$RUN_OUT"
test -s "$RUN_OUT"
run dig @ns1.unsigned.test +short MX signed.test
grep -qF "10 mail.signed.test." "$RUN_OUT"
run resolvectl query --legend=no -t MX signed.test