#628815 coreutils: pinky makes crazy DNS queries

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Bruno Muller
Date:
2024-03-19 15:00:04 UTC
Severity:
normal
Tags:
#628815#5
Date:
2011-06-01 15:15:17 UTC
From:
To:
In a ssh session over IPv6, "ltrace pinky" shows:
...
strncpy(0x7fff7204e2c0, "2a01:e35:1380:19a0:3187:b730:838"..., 256) = 0x7fff7204e2c0
strchr("2a01:e35:1380:19a0:3187:b730:838"..., ':') = ":e35:1380:19a0:3187:b730:8380:97"...
getaddrinfo("2a01", NULL, 0x00607c20, 0x7fff7204e288) = -2
printf(" %s:%s", "2a01", "e35:1380:19a0:3187:b730:8380:97e"...) = 39
...

#628815#12
Date:
2024-03-19 10:54:30 UTC
From:
To:
I looked into this and found that
pinky tries to canonicalize the information in the "Where" column
automaticaly, and it has no option to disable this behaviour.
see line 285 pinky.c:
	if (*ut_host)
        	/* See if we can canonicalize it.  */
        	host = canon_host (ut_host);
this results in many unnecessary dns queries.
For example on a debian system with acpi-support, /etc/acpi/lid.sh will
make many requests to find the host $WAYLAND_DISPLAY every time the lid
is opened.

"who" has the --lookup (attempt to canonicalize hostnames via DNS)
option, and doesn't do it by default.
Maybe it would be more lightweight to forget about canonicalization
altogether.

#628815#17
Date:
2024-03-19 12:50:59 UTC
From:
To:
I don't see anything in lid.sh that calls pinky.
#628815#22
Date:
2024-03-19 13:26:54 UTC
From:
To:
pinky is slow here on Fedora 39 too.
I agree that it should avoid this by default.
pinky is supposed to be a lightweight finger after all.

I'll apply the attached to upstream coreutils soon.

thanks,
Pádraig

#628815#27
Date:
2024-03-19 14:27:52 UTC
From:
To:
/etc/acpi/lid.sh calls getXuser, that's defined in
/usr/share/acpi-support/power-funcs
which has on line 36
                plist=$(pinky -fw) || pwf_error "pinky lost"

#628815#32
Date:
2024-03-19 14:57:59 UTC
From:
To:
I'd suggest a wishlist bug on acpi-support-base to use "who -us" in
place of "pinky -fw". who is a posix standard command, pinky is an
oddball that was hacked up from who years ago because someone liked the
finger command output and wanted something that would add the full name,
.plan, .project, etc., to the regular who output (none of which is used
by acpi). Basically, pinky is simply not the right tool for the task at
hand and it makes more sense IMO to use the right tool than to try to
add functionality to a 30 year old special-purpose tool intended to
replicate the functionality of an information program from another era.