tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: "host <tld>" returns 0 without any data
Jan Schaumann a écrit :
> Hi,
>
> Can somebody here explain to me why a DNS lookup of a TLD causes the
> host(1) command to return successfully but not print any data? Ie,
> (why) is this correct behaviour?
>
> $ host de.
> $ echo $?
> 0
> $ host com.
> $ echo $?
> 0
>
there's no error here. so the return code is 0. The usefulness of this
is debatable, but the unix convention has limitations anyway (it allows
for a single "success" code, but success is "relative").
> The reason I'm not sure I understand why this returns 0 is that it
> clearly does not have any A, AAAA, or MX records (which are looked up
> according to the tcpdump), and if I ask for either one of these
> explicitly, host(1) will (while still returning successfully) at least
> print out this fact:
>
> $ host -t A fr.
> fr has no A record
> $ host -t AAAA fr.
> fr has no AAAA record
> $ host -t MX fr.
> fr has no MX record
> $ echo $?
> 0
>
> I understand that I can't expect to get back an NXDOMAIN (since the
> domain does exist), but I would have expected some sort of error or
> output.
>
> Can somebody enlighten me?
>
> Thanks,
> -Jan
Home |
Main Index |
Thread Index |
Old Index