GNU bug report logs -
#6175
dirname manpage and info page partially wrong/misleading
Previous Next
Full log
Message #14 received at 6175 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 14 years and 42 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.