Skip Menu |

This queue is for tickets about the AppConfig CPAN distribution.

Report information
The Basics
Id: 18618
Status: new
Priority: 0/
Queue: AppConfig

People
Owner: Nobody in particular
Requestors: demerphq [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Various failures under Win32 fixed.
With AppConfig 1.56 building on Win32 produces the following result: t/file.........ok 3/43Usage: POSIX::getpwuid(uid) at lib/AppConfig/File.pm line 410 # Looks like you planned 43 tests but only ran 3. # Looks like your test died just after 3. t/file.........dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 4-43 Failed 40/43 tests, 6.98% okay t/flag.........ok t/getopt.......ok t/multi........ok t/novars.......ok t/state........ok t/sys..........ok Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/file.t 255 65280 43 80 186.05% 4-43 Failed 1/14 test scripts, 92.86% okay. 40/253 subtests failed, 84.19% okay. NMAKE : fatal error U1077: 'D:\ASPerl\811\bin\perl.exe' : return code '0xff' Stop. This failure is due to the line use POSIX qw(getpwuid getpwnam); which loads the two POSIX subs into the AppConfig::Sys namespace, which means that the entire AUTOLOAD logic for handling getpwuid/getpwnam is bypassed. By changing the use to a require and then explicitly calling the POSIX versions of these subs the error goes away. Note that this means that most of the point of having AppConfig::Sys is redundant. Frankly I think the use of AUTOLOAD in AppConfig::Sys is entirely superfluous, and would be better off being replaced by proper subroutines. It makes no sense to me to autoload routines that could be resolved once at compile time. Once that error is fixed further failures occur unless ENV{HOME} is explicitly set, something that cannot be guaranteed on Win32. Therefore my patch explicitly sets ENV{HOME} before testing. I also patched the code that tries to ascertain the home directory for a user so that on Win32 when ENV{HOME} is not set it uses the windows standard path for the purpose. With the patch applied I get passing results: D:\dev\cpan\Versioned\AppConfig-1.56>nmake test Microsoft (R) Program Maintenance Utility Version 7.00.9955 Copyright (C) Microsoft Corporation. All rights reserved. D:\ASPerl\811\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t t/appconfig....ok t/args.........ok t/block........ok t/cgi..........ok t/compact......ok t/const........ok t/default......ok t/file.........ok t/flag.........ok t/getopt.......ok t/multi........ok t/novars.......ok t/state........ok t/sys..........ok All tests successful. Files=14, Tests=253, 2 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU) Cheers, Yves D:\.cpan\build\AppConfig-1.56>ver Microsoft Windows 2000 [Version 5.00.2195] D:\dev\cpan\ExtUtils-Install\trunk>perl -V Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPL ICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"D:\ASPerl\811\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_ 32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"D:\ASPerl\811\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 811 21540 Fix backward-compatibility issues in if.pm 23565 Wrong MANIFEST.SKIP Built under MSWin32 Compiled at Dec 13 2004 09:52:01 @INC: D:/ASPerl/811/lib D:/ASPerl/811/site/lib .
Subject: apconfig.patch
Only in d:\dev\cpan\Versioned\AppConfig-1.56: Makefile Only in D:\.cpan\build\AppConfig-1.56: apconfig.patch Only in d:\dev\cpan\Versioned\AppConfig-1.56: blib diff -urd D:\.cpan\build\AppConfig-1.56/lib/AppConfig/File.pm d:\dev\cpan\Versioned\AppConfig-1.56/lib/AppConfig/File.pm --- D:\.cpan\build\AppConfig-1.56/lib/AppConfig/File.pm 2006-04-09 22:06:32.566368600 +0200 +++ d:\dev\cpan\Versioned\AppConfig-1.56/lib/AppConfig/File.pm 2006-04-09 20:36:03.503868600 +0200 @@ -407,11 +407,15 @@ unless (defined($val = $self->{ HOME })) { if (exists $ENV{ HOME }) { $val = $ENV{ HOME }; - } - elsif ($sys->can_getpwuid()) { - $val = ($sys->getpwuid($<))[7]; - } - + } else { + if ($^O=~/win32/i) { + require Win32; + $val = Win32::GetFolderPath(Win32::CSIDL_LOCAL_APPDATA(),1); + } + if (!$val && $sys->can_getpwuid()) { + $val = ( $sys->getpwuid($<) )[7]; + } + } # cache value for next time $self->{ HOME } = $val; } diff -urd D:\.cpan\build\AppConfig-1.56/lib/AppConfig/Sys.pm d:\dev\cpan\Versioned\AppConfig-1.56/lib/AppConfig/Sys.pm --- D:\.cpan\build\AppConfig-1.56/lib/AppConfig/Sys.pm 2006-04-09 22:05:49.441368600 +0200 +++ d:\dev\cpan\Versioned\AppConfig-1.56/lib/AppConfig/Sys.pm 2006-04-09 20:24:55.816368600 +0200 @@ -19,7 +19,7 @@ require 5.004; use strict; use vars qw( $VERSION $AUTOLOAD $OS %CAN %METHOD); -use POSIX qw( getpwnam getpwuid ); +require POSIX; $VERSION = sprintf("%d.%02d", q$Revision: 1.61 $ =~ /(\d+)\.(\d+)/); @@ -38,13 +38,12 @@ else { $METHOD{ getpwuid } = sub { - getpwuid( defined $_[0] ? shift : $< ); + POSIX::getpwuid( defined $_[0] ? shift : $< ); }; $METHOD{ getpwnam } = sub { - getpwnam( defined $_[0] ? shift : '' ); + POSIX::getpwnam( defined $_[0] ? shift : '' ); }; } - # try out each METHOD to see if it's supported on this platform; # it's important we do this before defining AUTOLOAD which would # otherwise catch the unresolved call @@ -184,6 +183,7 @@ $self->{ OS } = $os; $self->{ PATHSEP } = $ps; + } Only in d:\dev\cpan\Versioned\AppConfig-1.56: pm_to_blib diff -urd D:\.cpan\build\AppConfig-1.56/t/file.t d:\dev\cpan\Versioned\AppConfig-1.56/t/file.t --- D:\.cpan\build\AppConfig-1.56/t/file.t 2006-04-09 22:07:31.191368600 +0200 +++ d:\dev\cpan\Versioned\AppConfig-1.56/t/file.t 2006-04-09 22:09:10.644493600 +0200 @@ -91,6 +91,9 @@ ok( defined $state, 'state defined' ); ok( defined $cfgfile, 'cfgfile defined' ); +# explicitly set the HOME variable for testing in situations where there +# is no HOME variable set. +$ENV{HOME}='HOME'; ok( $cfgfile->parse(\*DATA), 'parsed' ); @@ -109,9 +112,11 @@ # see if "[~/$html]" matches "[${HOME}/$html]". It may fail if your # platform doesn't provide getpwuid(). See AppConfig::Sys for details. + +my $same=$state->same(); my ($one, $two) = - $state->same() =~ / \[ ( [^\]]+ ) \] \s+=>\s+ \[ ( [^\]]+ ) \]/gx; -is( $one, $two, 'one is two' ); + $same =~ / \[ ( [^\]]+ ) \] \s+=>\s+ \[ ( [^\]]+ ) \]/gx; +is( $one, $two, "one is two: $same" ); # test that "split" came out the same as "same" is( $state->same(), $state->split(), 'same split' );