bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

is hard-coding the group name, "tty", portable enough for who -a?


From: Jim Meyering
Subject: is hard-coding the group name, "tty", portable enough for who -a?
Date: Mon, 07 Jul 2008 14:52:07 +0200

In http://bugzilla.redhat.com/454261, Piotr Gackiewicz
reported a bug whereby 'who -a's "+/-" indicator of whether
a user/tty is accepting messages was incorrectly listed as "+",
when in fact, the user was not accepting messages (mesg no).

The difference lay in the group name associated with the PTY.
Rather than "tty", it was "root", and so the set-group-ID-to-"tty"
write program would be unable to send a message to that PTY.

Piotr even proposed a patch (Thanks, Piotr!), which may be fine.
The only possible hitch is that it relies on the canonical group being "tty".
I've confirmed that tty is indeed used on all of the following,
at least by default:

  Fedora/RHEL
  Debian
  OpenBSD
  FreeBSD 6
  NetBSD
  Solaris 10
  HP-UX 11.11

If anyone can find a system on which this prints
something other than "tty", please let us know:

  stat --format %G $(tty)

For example, I've just confirmed that on at least one
system (Cray Y/MP EL Unicos 9.0), the above does not
print "tty".  Instead, it prints my primary group name,
which happens to be "guests".  However, while that system no
longer counts as a reasonable portability target, perhaps
other more modern SysV-related systems work the same way.

I don't see a good way to make who determine at run time
what group name to use, but am open to suggestions.
I don't want to use a configure-time test for this.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]