Re: Conflicting alias for some man pages

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

 



Hi Alex,

At 2022-12-09T19:53:44+0100, Alejandro Colomar wrote:
> > > Could you remove these duplicates in your next upload?
> > > 
> > > I found the following duplicates, I did not do an extensive search:
> > > ===================================================================
> > > rindex - Both in index.3 and in string.3
> > > strncasecmp - Both in strcasecmp.3 and in string.3
> > > strncat - Both in strcat.3 and in string.3
> > > strncmp - Both in strcmp.3 and in string.3
> > > strncpy - Both in strcpy.3 and in string.3
> > > __fpurge - Both in fpurge.3 and in stdio_ext.3
> > > strcspn - Both in strspn.3 and in string.3
> > > strrchr - Both in strchr.3 and in string.3
> > > pselect - Both in select.2 and in select_tut.2
> 
> Could you please confirm if this is a bug in the Linux man-pages, or is it
> something desirable?

I don't think it is a bug for multiple pages to have a mandb entry for
the same name.  The man(1) librarian is designed in expectation of that;
we have both printf(1) and printf(3), after all.

> I find it a bit weird that we need to specify a NAME only once.

There is no such need, and it would be impossible to enforce across
projects anyway.

> Then whatis(1) will not find the other pages that also talk
> about an interface (of course, ideally, only a page would describe an
> interface, but we know that's not reality).

apropos(1) and whatis(1) do indeed behave in a way that surprises me on
my Debian system (man-db 2.9.4-2).  I would have expected multiple
results.

What I expected:

$ whatis rindex
rindex (3)           - locate character in string
string (3)           - string operations
[...and maybe others I haven't thought of]

What I got:
rindex (3)           - locate character in string

I am not sure why further matches are being hidden.

"apropos" (synonym: "man -k") searches the page topics _and_ summary
descriptions, while "whatis" (synonym: "man -f") searches only the
topics.

However, given the string(3) page:

.SH NAME
stpcpy, strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn,
strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk,
strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex
\- string operations

I don't see why "rindex" isn't treated as a match for "rindex".
"index", "strcoll", and "stpcpy" aren't either, so the position in the
topic list doesn't seem to matter.

I don't see anything ill-formed about the man pages in question, so I
can only assume this is either a man-db bug or an aspect of its behavior
that I don't understand.  But man-db's man(1) page suggests that my
expectations are correct.

--snip--
       man -k printf
           Search the short descriptions and manual page names for the
           keyword  printf  as  regular  expression.   Print  out  any
           matches.  Equivalent to apropos printf.

       man -f smail
           Lookup the manual pages referenced by smail and  print  out
           the   short  descriptions  of  any  found.   Equivalent  to
           whatis smail.
--snip--

Note the plurals.  So I will punt to Colin Watson here.

On another topic, I will stump again for the idea of having separate
strings.h(3) and string.h(3) pages instead of the single string(3) page
we see here.  :)

On yet another topic, the history of strcasecmp() seems incomplete, and
fails to motivate why "strings.h" (note the additional "s") even exists.

NOTES
       The strcasecmp() and strncasecmp() functions first appeared  in
       4.4BSD, where they were declared in <string.h>.  Thus, for rea‐
       sons of historical compatibility, the glibc  <string.h>  header
       file also declares these functions, if the _DEFAULT_SOURCE (or,
       in glibc 2.19 and earlier, _BSD_SOURCE) feature test  macro  is
       defined.

They're older than the above indicates.  strings.h as a _file_ is at
least as old as 4.2BSD (1983),[1] a decade before 4.4BSD.
str{n,}casecmp() came in with 4.3BSD-Tahoe (June 1988).[2]  In
4.3BSD-Reno (June 1989), strings.h became a stump that loaded
<string.h>,[3] where it remained and after which the man-pages history
above picks up the story.

Want a patch?  Feel free to retitle the thread when following up on my
asides.

Regards,
Branden

[1] https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/include/strings.h
[2] https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Tahoe/usr/include/strings.h
[3] https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/include/strings.h

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux