nslookup incorrect exit code

Slava Bacherikov slava at bacher09.org
Wed Jan 9 10:52:01 UTC 2019


Hi,

It looks like busybox recently changed behavior of nslookup and this
broke some scripts. Previously, nslookup returned 1 as exit code if DNS
server returned NXDOMAIN, or some other failure. Actually, nslookup from
bind-utils also have same behavior.

But recently, nslookup in busybox return zero exit code in case of
NXDOMAIN or some other failure.

Few examples:

original nslookup:
nslookup baddomain > /dev/null; echo $?
1

busybox:
nslookup baddomain > /dev/null; echo $?
0

original nslookup:
nslookup busybox.net 205.251.193.145 > /dev/null; echo $?
1

busybox:
nslookup busybox.net 205.251.193.145 > /dev/null; echo $?
0

Here's one of use cases where it was used:
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#init-containers-in-use
. Now this is broken.

I've also attached patch that mimic old behavior.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nslookup.patch
Type: text/x-patch
Size: 1626 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20190109/4f9d196b/attachment.bin>


More information about the busybox mailing list