Some co-workers were trying to build mod_perl with the setup mentioned in the subject line, and the 2nd test in t/internal/auth.t was failing.

This test is really short (and weird IMO) but all it does it issue to requests to the server to test basic auth. the first one should pass dougm and mod_perl as the login credentials and get a 200, and the second request should pass bad and one, and get a 403.

In this environment the second test was also sending dougm/mod_perl and thus the test failed. This seems like a perl bug to me more than anything else, but if someone can confirm that for me (and point me at how to report it) it'd be appreciated.

Here's the original test:

---
use Apache::testold;

my $ua = Apache::UserAgent->new;
my $url = URI::URL->new("http://$net::httpserver/auth/.htaccess";);
my $i;
my $request = HTTP::Request->new(GET => $url);

unless($net::callback_hooks{PERL_AUTHEN}) {
    print "1..1\nok 1\n";
    exit(0);
}

print "1..2\n";

my $response = $ua->request($request, undef, undef);

test ++$i, $response->is_success;
#print $response->as_string;
$ua->creds(qw(bad one));

$response = $ua->request($request, undef, undef);

test ++$i, $response->is_error;

BEGIN {
package Apache::UserAgent;
@ISA = qw(LWP::UserAgent);
@creds = qw(dougm mod_perl);

sub get_basic_credentials { shift->creds }

sub creds {
    shift;
    @creds = @_ if @_;
    @creds;
}

}
---

and here's what I changed the test to, which gets it to pass:

---
use Apache::testold;

my $ua = Apache::UserAgent->new;
my $ua2 = Apache::UserAgent2->new;
my $url = URI::URL->new("http://$net::httpserver/auth/.htaccess";);
my $i;
my $request = HTTP::Request->new(GET => $url);

unless($net::callback_hooks{PERL_AUTHEN}) {
    print "1..1\nok 1\n";
    exit(0);
}

print "1..2\n";

my $response = $ua->request($request, undef, undef);

test ++$i, $response->is_success;
#print $response->as_string;

$response = $ua2->request($request, undef, undef);

test ++$i, $response->is_error;

BEGIN {
package Apache::UserAgent;
@ISA = qw(LWP::UserAgent);
@creds = qw(dougm mod_perl);

sub get_basic_credentials { shift->creds }

sub creds {
    shift;
    @creds = @_ if @_;
    @creds;
}

package Apache::UserAgent2;
@ISA = qw(LWP::UserAgent);
@creds = qw(bad one);

sub get_basic_credentials { shift->creds }

sub creds {
    shift;
    @creds = @_ if @_;
    @creds;
}

}
---

Here's the contents of perl -V, if that's any help.

perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=solaris, osvers=2.10, archname=i86pc-solaris
uname='sunos fxbuild-i386 5.10 generic_127112-11 i86pc i386 i86pc solaris '
    config_args='-Dcc=gcc -Dprefix=/oanda/system'
    hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV',
    optimize='-O',
    cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement'
    ccversion='', gccversion='4.2.1', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' '
    libpth=/usr/lib /usr/ccs/lib /oanda/system/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G'


Characteristics of this binary (from libperl):
  Compile-time options: PERL_MALLOC_WRAP PERL_USE_SAFE_PUTENV
                        USE_LARGE_FILES USE_PERLIO
  Built under solaris
  Compiled at Oct 21 2008 11:41:57
  @INC:
    /oanda/system/lib/site_perl/i86pc-solaris
    /oanda/system/lib/site_perl
    /oanda/system/lib/site_perl/i86pc-solaris
    /oanda/system/lib/site_perl
    /oanda/system/lib/site_perl
    /oanda/lib/site_perl/i86pc-solaris
    /oanda/lib/site_perl
    /oanda/lib/site_perl
    .


Adam

Reply via email to