bug-coreutils
[Top][All Lists]
Advanced

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

bug#12589: dirname manpage partially wrong/confusing


From: Filipus Klutiero
Subject: bug#12589: dirname manpage partially wrong/confusing
Date: Sat, 06 Oct 2012 17:30:52 -0400
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.7) Gecko/20120922 Icedove/10.0.7

This report follows a previous report about dirname's info page and manpage: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6175

dirname's info page is now IMO correct and quite clear in its description of dirname's behavior:

 `dirname' prints all but the final slash-delimited component of NAME.
 Slashes on either side of the final component are also removed.  If the
 string contains no slash, `dirname' prints `.' (meaning the current
 directory).

However, the manpage is still confusing. It used to read:

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

It now reads:

Output NAME with its last non-slash component and trailing slashes removed; if 
NAME contains no /'s, output `.' (meaning the current directory).

First, it's unclear what kind of component this refers to. A slash is not a pathname component, therefore "non-slash component" would seem equivalent to simply "component". If one understands "component" as pathname component, then the description becomes equivalent for the typical case of "/foo/bar" to:

> Output "/foo/bar" with its last component and trailing slashes removed.

That would, in my understanding, mean outputting "/foo/" (there are no trailing slashes in "/foo/bar"). But dirname would actually output "/foo", removing the last slash in the result.

I would recommend adopting the same description as the one used in the info page.

By the way, the short description reads:
strip last component from file name

In POSIX terminology, this sounds like "take a filename, output nothing". "from a pathname" would make more sense.





reply via email to

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