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