dig cannot display ACE query if locale is not unicode
Summary
If system has no locales built or current language does not allow conversion from ACE, dig currently fails with fatal error.
Reported to RH Bugzilla Bug #1647829.
BIND version used
BIND 9.13.5 (Development Release) <id:14d48a9b69>
running on Linux x86_64 4.20.3-200.fc29.x86_64 #1 SMP Thu Jan 17 15:19:35 UTC 2019
built by make with '--enable-exportlib' '--with-libtool' '--with-dlopen' '--with-libidn2' '--without-lmdb' '--with-atf=/usr' '--enable-threads' 'CFLAGS=-ggdb -O0'
compiled by GCC 8.2.1 20181215 (Red Hat 8.2.1-6)
compiled with OpenSSL version: OpenSSL 1.1.1a FIPS 20 Nov 2018
linked to OpenSSL version: OpenSSL 1.1.1a FIPS 20 Nov 2018
compiled with libxml2 version: 2.9.8
linked to libxml2 version: 20908
compiled with libjson-c version: 0.13.1
linked to libjson-c version: 0.13.1
compiled with zlib version: 1.2.11
linked to zlib version: 1.2.11
threads support is enabled
Steps to reproduce
LANG=C bin/dig/dig -t NS $(idn2 háčkyčárky.cz)
LANG=C dig NS xn--cg4bki.
What is the current bug behavior?
dig: Cannot represent 'xn--hkyrky-ptac70bc.cz' in the current locale (string encoding error), use +noidnout or a different locale
What is the expected correct behavior?
Dig should output any valid form. ACE is not user friendly, but far better than fatal error and usage of custom parameter.
; <<>> DiG 9.13.5 <<>> -t NS xn--hkyrky-ptac70bc.cz
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51221
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;xn--hkyrky-ptac70bc.cz. IN NS
;; ANSWER SECTION:
xn--hkyrky-ptac70bc.cz. 695 IN NS b.ns.xn--hkyrky-ptac70bc.cz.
xn--hkyrky-ptac70bc.cz. 695 IN NS a.ns.xn--hkyrky-ptac70bc.cz.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jan 29 18:17:50 CET 2019
;; MSG SIZE rcvd: 86
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9699
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;xn--cg4bki. IN NS
;; ANSWER SECTION:
xn--cg4bki. 86383 IN NS ns1.xn--cg4bki.centralnic-dns.com.
xn--cg4bki. 86383 IN NS ns2.xn--cg4bki.centralnic-dns.com.
xn--cg4bki. 86383 IN NS ns3.xn--cg4bki.centralnic-dns.com.
xn--cg4bki. 86383 IN NS c.xn--cg4bki.dyntld.net.
xn--cg4bki. 86383 IN NS ns4.xn--cg4bki.centralnic-dns.com.
xn--cg4bki. 86383 IN NS d.xn--cg4bki.dyntld.net.
xn--cg4bki. 86383 IN NS a.xn--cg4bki.dyntld.net.
xn--cg4bki. 86383 IN NS b.xn--cg4bki.dyntld.net.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jan 29 18:43:59 CET 2019
;; MSG SIZE rcvd: 225
Relevant configuration files
Just compile --with-libidn2
Possible fixes
dig would just fall back to ASCII, which he already verified is working. Preserves compatibility with disabled IDN in this case, no matter what locale is used.