[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6175: dirname manpage and info page partially wrong/misleading
From: |
Eric Blake |
Subject: |
bug#6175: dirname manpage and info page partially wrong/misleading |
Date: |
Mon, 17 May 2010 09:36:09 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4 |
On 05/17/2010 09:17 AM, Filipus Klutiero wrote:
>> Strip the last component and resulting trailing slashes; if the file
>> name contains only one component, print '.'.
>>
>> But I welcome your ideas for a coherent sentence.
>>
> That sounds more correct and comprehensible. I don't know how many
> corner cases there are and if they can all be covered in the help, but
> there's also the no component case:
> $ dirname ''
> prints ".".
Yes, that's a corner case not covered by the above sentence, which we
could fix with "if the file name contains less than two components,
print '.'".
> $ dirname /
> prints "/".
I tend to classify the all-slash corner case as being one component, not
zero components. You can view it as the root directory being contained
in (well, reachable from) the root directory, as evidenced by '/../'
resolving to '/'. But that doesn't work as well with the '<2
components' wording above, so I'm feeling more comfortable with leaving
the corner-cases undocumented in the terse --help output, by using your
view that '/' has no components rather than 1, and anyone worried about
the two corner cases of '' and '/' can read the info page.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature