Re: is hard-coding the group name, tty, portable enough for who -a?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Meyering on 7/7/2008 6:52 AM: | If anyone can find a system on which this prints | something other than tty, please let us know: | | stat --format %G $(tty) On cygwin 1.5.25, this prints None. By default, cygwin has neither a 'root' nor a 'tty' group, so cygwin punts and chooses the only group name that is guaranteed to exist on underlying Windows. Meanwhile, wall is installed with the permissions of the user who ran the cygwin installer: $ ls -lF /usr/bin/wall $(tty) - -rwxrwxrwx+ 1 eblake Users 8192 Apr 1 01:55 /usr/bin/wall.exe* crw-rw-rw- 1 eblake None 136, 0 Nov 30 2006 /dev/tty0 $ id uid=1007(eblake) gid=513(None) 513(None),544(Administrators),545(Users) There is no /usr/bin/write on cygwin, and I've never tried using wall to see whether terminal messaging is even reasonable to expect to work. It may just be that worrying about 'who -a' on cygwin is not worth the effort, since I'm not sure whether terminal messaging is supported. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkh7SV4ACgkQ84KuGfSFAYAnhQCeMYjlxHnT1SRWQELVsnCZAUlP 2m0An3YgXJ2SGahXQf5c1Gj5nqE+cxQv =BqWs -END PGP SIGNATURE- ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
Jim Meyering [EMAIL PROTECTED] writes: It's starting to look like the cost/benefit ratio is too high, so I don't expect to spend time on this. However, if someone can propose a portable and reliable test for that attribute, I'll be happy to consider it. How about adding a configure option to set the expected group? The default could just be tty since it's the right one for the vast majority of systems, but allows to override it if necessary. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
Andreas Schwab [EMAIL PROTECTED] wrote: Jim Meyering [EMAIL PROTECTED] writes: It's starting to look like the cost/benefit ratio is too high, so I don't expect to spend time on this. However, if someone can propose a portable and reliable test for that attribute, I'll be happy to consider it. How about adding a configure option to set the expected group? The default could just be tty since it's the right one for the vast majority of systems, but allows to override it if necessary. That would work on systems with a designated TTY group name. What about those older SYSV-derived systems where stat --format %G $(tty) prints the primary group of the user running who? I don't know enough about how write/who/mesg work on those systems (maybe write is set-*U*ID, not set-GID?), but patches are always welcome. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
Jim Meyering [EMAIL PROTECTED] writes: What about those older SYSV-derived systems where stat --format %G $(tty) prints the primary group of the user running who? I wonder how they get the functionaly of write. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
Jim Meyering wrote: If anyone can find a system on which this prints something other than tty, please let us know: stat --format %G $(tty) I get my primary GID on AIX 4.3 and Irix 6.5, and terminal on OSF1 5.1. The OSS I have access to probably isn't a reasonable porting target :-), and the other systems I can think of that I could test are BSD-ish, Linux, HP-UX, or Solaris, which you tested already. -- Matthew PIE INCOMING!!! ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
James Youngman [EMAIL PROTECTED] wrote: How about just comparing the GID of the other user's terminal against the GID of the terminal whose name would have been printed if we'd run tty? Thanks, but in http://bugzilla.redhat.com/454261, the example shows that a user in the mesg n state has the group of their tty device set to root. That would make who -a's indicator vary depending upon the user/tty running it. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
On Mon, 7 Jul 2008, James Youngman wrote: How about just comparing the GID of the other user's terminal against the GID of the terminal whose name would have been printed if we'd run tty? Actually, my patch with checking terminals group against tty was based on permissions of write and wall packaged in fedora 8 (and probably most of modern linuxes): -bash-3.2# ls -l /usr/bin/write /usr/bin/wall -r-xr-sr-x 1 root tty 8308 paź 10 2007 /usr/bin/wall -rwxr-sr-x 1 root tty 10056 lip 7 12:13 /usr/bin/write Another possibility is to set same permissions on who as on these tools. Regards, -- Piotr Gackiewicz___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
is hard-coding the group name, tty, portable enough for who -a?
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. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: is hard-coding the group name, tty, portable enough for who -a?
How about just comparing the GID of the other user's terminal against the GID of the terminal whose name would have been printed if we'd run tty? ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils