Michael G Schwern <[EMAIL PROTECTED]> writes:

> In general I find Perl parroting C/Shell mistakes to be... well... a
> mistake.  The mistake is further exasperated when the documentation
> assumes the reader is already aware of any quirks being parroted.  Alas,
> I've discovered that mountain of legacy code as well and concluded the
> behavior cannot be changed.  So I guess the thing to do is document the
> dirname() surprise better.

> In particular, this is a lie:

>   The dirname() routine returns the directory portion of the input file
>   specification.

> and to realize that its a lie you have to not trust such a simple
> statement of purpose, wade through the following docs which seem to be
> only about VMS and Mac portability and have detailed knowledge of how
> dirname(1) works.

Borrowing the comment from either the GNU documentation:

     Print NAME with its trailing /component removed; if NAME contains no
     /'s, output `.' (meaning the current directory).

or the Solaris documentation:

     The dirname utility delivers all but the last level of the path name
     in string.

might be clearer.

It's sort of an interesting theoretical question on what dirname
/var/local/ should ideally return, but all of the actual implementations
appear to return /var.

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>

Reply via email to