Inconsistent octal madness

$ ping 010
PING 010 (0.0.0.8) 56(84) bytes of data.
$ ping 010.1.1.1
PING 010.1.1.1 (8.1.1.1) 56(84) bytes of data.
$ ping 018
ping: 018: Name or service not known
$ ping 18
PING 18 (0.0.0.18) 56(84) bytes of data.
$ ping 018.1.1.1
PING 018.1.1.1 (18.1.1.1) 56(84) bytes of data.
$ ping 18.1.1.1
PING 18.1.1.1 (18.1.1.1) 56(84) bytes of data.

@bagder OK it looked consistent until the second to last one...
@bagder This looks like a bug in your host's stdlib. With #musl on Alpine I get an error for 018.1.1.1, as expected.
@dalias @bagder Can confirm broken behaviour under glibc 2.39 on Ubuntu 24.04 (default resolver config w/ systemd-resolved).
@astraleureka @bagder Random cursed guess: It's systemd making it do the wrong thing, via some cursed NSS module.
@dalias @astraleureka as mentioned elsewhere in this thread, it's my DNS that is "helpful"!
@bagder @astraleureka It's cursed that this is even making it to DNS...
@dalias @astraleureka it is actually a pretty weak design that an IP address with wrong syntax is instead treated as a hostname and just passed along instead of outright rejected.