bug-coreutils
[Top][All Lists]
Advanced

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

Re: who - argv not checked for values ?


From: Bob Proulx
Subject: Re: who - argv not checked for values ?
Date: Mon, 9 Feb 2009 06:47:15 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

Sujith Ramakrishnan Nair wrote:
> I saw some old track back on this subject, but nothing conclusive.
> The closest i could see was this
> thread<http://lists.gnu.org/archive/html/bug-coreutils/2008-05/msg00131.html>

The thread you mentioned read very conclusively to me.  What about it
didn't seem conclusive?  The program is behaving as expected both by
traditional behavior and by conformance to the standards.

> This is not a burning issue , but a minor irritant.

Why is it irritating?

> Why are we not checking for the values being passed for 2nd & 3rd options
> when we are not invoking any options ?

Huh?  What validity check would be applied to them?  They are either
there or they are not there.

> --- shouldn'd we have thrown an error for the below 2 ?
> [ 0 ] $ who the hell
> sujith   pts/0        2009-02-09 00:57 (:0.0)

The who command has two arguments.  Therefore it behaves as documented
and as per traditional behavior for two arguments.  This is correct.

> [ 0 ] $ who the hell did this
> who: extra operand `did'
> Try `who --help' for more information.

This invocation is not a valid invocation.  It does not match any of
the documented invocations.  Therefore an error was thrown.

> [ 1 ] $ who am i
> sujith   pts/0        2009-02-09 00:57 (:0.0)

The traditional invocation of two program arguments.  Sometimes people
like to use 'who mom likes' instead just to be cute.

Please see the documentation:

  info coreutils "who invocation"

     If given no non-option arguments, `who' prints the following
  information for each user currently logged on: login name, terminal
  line, login time, and remote hostname or X display.

     If given one non-option argument, `who' uses that instead of a
  default system-maintained file (often `/var/run/utmp' or `/etc/utmp')
  as the name of the file containing the record of users logged on.
  `/var/log/wtmp' is commonly given as an argument to `who' to look at
  who has previously logged on.

     If given two non-option arguments, `who' prints only the entry for
  the user running it (determined from its standard input), preceded by
  the hostname.  Traditionally, the two arguments given are `am i', as in
  `who am i'.

See also the standards document:

  http://www.opengroup.org/onlinepubs/009695399/utilities/who.html

Bob




reply via email to

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