I've got a chroot problem. It probably isn't a problem if you know FreeBSD 3.? very well at all. That's why I need help. I tracked this much down on my own, but then became completely baffled.

This whole problem is related to the fact that I didn't copy something into my fake root ... but I haven't the foggiest idea what that would be.

Arren@Anarres II on (Intermud III) suggested it might have to do with the getpeername(). Though I didn't follow it...

[code 15:35] Arren@Anarres II: I did do a fix recently where getpeerna +me() wasn't working properly on some generated symbol globs for sockets, something seems to have changed there. Probably doesn't h +elp.

This works (without being in the chroot prison):

#!/usr/bin/perl -w use strict; use Net::SMTP; use Carp qw(confess cluck); $SIG{__WARN__} = sub { cluck(@_) }; $SIG{__DIE__} = sub { confess(@_) }; my $smtp = Net::SMTP->new("localhost", Hello=>"localhost", Timeout=>20 +, Debug=>1) or die "$!";

However, when I'm in the prison, it turns up this nonsense:

No such file or directory at ./file.pl line 17. main::__ANON__('No such file or directory at ./file.pl line 17 +.^J') called at ./file.pl line 17
Using the perl debugger, I found this (this is not all of the trace):
44: if(defined $proto) { IO::Socket::INET::_sock_info(/usr/local/lib/perl5/5.6.1/IO/Socket/INET +.pm:45): 45: if (@proto = ( $proto =~ m,\D, 46: ? getprotobyname($proto) 47: : getprotobynumber($proto)) 48: ) { IO::Socket::INET::_sock_info(/usr/local/lib/perl5/5.6.1/IO/Socket/INET +.pm:52): 52: $@ = "Bad protocol '$proto'"; IO::Socket::INET::_sock_info(/usr/local/lib/perl5/5.6.1/IO/Socket/INET +.pm:53): 53: return; IO::Socket::INET::_error(/usr/local/lib/perl5/5.6.1/IO/Socket/INET.pm: +83):
So, I changed my Net::SMTP new to this:
my $sock = new IO::Socket::INET ( LocalPort => 88988, Proto => 'tcp', Reuse => 1, Listen => 1, ) or die "poopy: $!";
and got this:
poopy: No such file or directory at ./file.pl line 10. main::__ANON__('poopy: No such file or directory at ./file.pl +line 10.^J') called at ./file.pl line 10

Edit by tye to change 'pre' tags to 'code' tags


In reply to Obscure IO::Socket getprotobyname problem under a chroot by jettero

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.