I think I've found a bug, or at least some incorrectness, in the perldoc for the 'recv' function.

How so? Well, I'm attempting to use the Net::Time module, to grab the current time from a remote machine. This fairly simple code works fine on Linux, but not on HP:

perl -MNet::Time=inet_time -le'print inet_time("volvo", "tcp", 10);'
('volvo' is the HP-UX machine, which means Linux can get the time from HP-UX, but HP-UX can't get it from itself..)

After digging in the code, I noticed the problem is with the following:

return undef unless $s->recv($buf, length(pack("N",0)));
Looking at the docs for 'recv', it should return the senders address, if supported by the socket protocol (I assume udp and tcp do, since both can be used for the time protocol), and an empty string otherwise, and undef on error. recv is based on the system call recvfrom. So this code should actually be checking for undef, and indeed changing this solved the problem, for the Net::Time module.

So wheres the bug? The manpage for 'recvfrom' on the HP-UX 11.0 machine says, explicitly, that the 'recvfrom' system call behaves the same way as the 'recv' system call, except that it does not return the senders address. Thus perls 'recv' does not behave according to its documentation, on HP-UX.

This was all tested with v5.6.1 perl + docs, and the latest libnet from CPAN (which contains Net::Time). I also peeked at the v5.8.0 docs for recv, which claim the same thing, and in the Net::Time module in the 5.8.0 core, which has the same bug.

Since I'm not subscribed to p5p (and don't aspire to be), where else should I report this, apart from the RT for libnet?

And would anyone else like to confirm it?

C. (breaking things today..)


In reply to perldoc recv, Net::Time and HP-UX by castaway

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.