Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bizarre Problem in Archive::Tar (auto-vivification problem?) #1167

Closed
p5pRT opened this issue Feb 10, 2000 · 5 comments
Closed

Bizarre Problem in Archive::Tar (auto-vivification problem?) #1167

p5pRT opened this issue Feb 10, 2000 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 10, 2000

Migrated from rt.perl.org#2135 (status was 'resolved')

Searchable as RT2135$

@p5pRT
Copy link
Author

p5pRT commented Feb 10, 2000

From gustav@morpheus.demon.co.uk

Created by gustav@morpheus.demon.co.uk

The basic problem is that Archive​::Tar 0.21 fails test 5 with Perl 5.5.650 under
Win32. The error message is "Can't call method "gzseek" on an undefined value at
blib\lib/Archive/Tar.pm line 794."

Now, in order to try to diagnose the problem, I added some print statements. The
appropriate patch is attached (there are some added binmode statements as well,
which are needed to get the module working on Win32, but which haven't been
folded into the main Archive​::Tar distribution yet).

The peculiar thing is that if I uncomment print #1, the test succeeds!
If I then uncomment print #2, the test fails again...
Uncomment prints #3 and #4, and the test succeeds again.

I suspect the issue here is something to do with auto-vivification -- that's the
only thing I can think of which could make $handle be undef unless I print it in
advance....

But the whole thing is very strange.

------ Tar.pm patch ------

Inline Patch
--- Tar.pm.orig	Tue Feb 02 16:37:13 1999
+++ Tar.pm	Thu Feb 10 22:23:58 2000
@@ -232,11 +232,13 @@

 	$fh = Compress::Zlib::gzopen ($_[0], $mode)
 	    or goto &_drat;
+	# (print #3) print STDERR "ZLIB: fh=$fh\n";
     }
     else {
 	$fh = bless *{$_[0]}{IO}, "Archive::Tar::_io";
 	binmode $fh
 	    or goto &_drat;
+	# (print #4) print STDERR "IO: fh=$fh\n";
     }

     return $fh;
@@ -616,6 +618,7 @@
     $handle = gensym;
     open $handle, ref ($file) ? ">&". fileno ($file) : ">" . $file
 	or goto &_drat;
+    binmode $handle;

     _write_tar (_get_handle ($handle, int ($compress)),
 		map {_add_file ($_)} @_);
@@ -629,6 +632,7 @@
     $handle = gensym;
     open $handle, ref ($file) ? "<&". fileno ($file) : "<" . $file
 	or goto &_drat;
+    binmode $handle;

     my $data = _read_tar (_get_handle ($handle), 1);

@@ -647,6 +651,7 @@
     $handle = gensym;
     open $handle, ref ($file) ? "<&". fileno ($file) : "<" . $file
 	or goto &_drat;
+    binmode $handle;

     _read_tar (_get_handle ($handle), 0, 1);
 }
@@ -681,6 +686,7 @@
     $self->{_handle} = gensym;
     open $self->{_handle}, ref ($file) ? "<&". fileno ($file) : "<" . $file
 	or goto &_drat;
+    binmode $self->{_handle};

     $self->{_data} = _read_tar (_get_handle ($self->{_handle}),
 				  sysseek $self->{_handle}, 0, 1);
@@ -697,6 +703,7 @@
     my $handle = gensym;
     open $handle, ref ($file) ? ">&". fileno ($file) : ">" . $file
 	or goto &_drat;
+    binmode $handle;

     if ($compress && !$compression) {
 	$error = "Compression not available.\n";
@@ -782,6 +789,8 @@
 	    unless $entry->{offset};

 	my $handle = _get_handle ($self->{_handle});
+# (print #1) print STDERR "HANDLE IS $self->{_handle}\n";
+# (print #2) print STDERR "HANDLE IS $handle\n";
 	$handle->gzseek ($entry->{offset}, 0)
 	    or goto &_drat;
Perl Info


Site configuration information for perl v5.5.650:

Configured by Administrator at Wed Feb  9 18:46:52 2000.

Summary of my perl5 (revision 5 version 5 subversion 650) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=undef
    usesocks=undef useperlio=undef d_sfio=undef
    use64bits=undef uselargefiles=undef usemultiplicity=undef
  Compiler:
    cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
    cppflags='-DWIN32'
    ccflags
'-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_MSVCR
T_READFIX'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags
'-nologo -nodefaultlib -release  -libpath:"E:\Applications\DevPerl\lib\MSWin32-x
86\CORE"  -machine:x86'
    libpth=D:\VisualStudio\VC98\lib
    libs=-DELAYLOAD:wsock32.dll delayimp.lib
E:\CDs\General\Libraries\Lib\MD\libdes.lib  oldnames.lib kernel32.lib user32.lib
gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
ddlflags='-dll -nologo -nodefaultlib -release  -libpath:"E:\Applications\DevPerl
\lib\MSWin32-x86\CORE"  -machine:x86'

Locally applied patches:



@INC for perl v5.5.650:
    E:/Applications/DevPerl/lib/MSWin32-x86
    E:/Applications/DevPerl/lib
    E:/Applications/DevPerl/site/lib/MSWin32-x86
    E:/Applications/DevPerl/site/lib
    .


Environment for perl v5.5.650:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=D:\WINNT\system32;D:\WINNT;D:\NTRESKIT;D:\VisualStudio\Common\Tools\WinNT;D
:\VisualStudio\Common\MSDev98\Bin;D:\VisualStudio\Common\Tools;D:\VisualStudio\V
C98\bin;D:\UTILS;E:\Applications\DevPerl\bin;E:\Applications\DevPerl\bin\MSWin32
-x86;E:\Oracle\Ora81\bin;D:\Program
Files\Oracle\jre\1.1.7\bin;E:\Oracle\Ent204\bin;E:\APPLIC~1\Tcl\bin;E:\Applicati
ons\Mingw32\bin;E:\Applications\XEmacs\XEmacs-21.2.27\i586-pc-win32;
    PERL_BADLANG (unset)
    SHELL (unset)



@p5pRT
Copy link
Author

p5pRT commented Feb 22, 2000

From [Unknown Contact. See original ticket]

Created by gustav@morpheus.demon.co.uk

The basic problem is that Archive​::Tar 0.21 fails test 5 with Perl 5.5.650
under
Win32. The error message is "Can't call method "gzseek" on an undefined
value at
blib\lib/Archive/Tar.pm line 794."

Now, in order to try to diagnose the problem, I added some print statements.
The
appropriate patch is attached (there are some added binmode statements as
well,
which are needed to get the module working on Win32, but which haven't been
folded into the main Archive​::Tar distribution yet).

The peculiar thing is that if I uncomment print #1, the test succeeds!
If I then uncomment print #2, the test fails again...
Uncomment prints #3 and #4, and the test succeeds again.

I suspect the issue here is something to do with auto-vivification -- that's
the
only thing I can think of which could make $handle be undef unless I print
it in
advance....

But the whole thing is very strange.

------ Tar.pm patch ------

Inline Patch
--- Tar.pm.orig	Tue Feb 02 16:37:13 1999
+++ Tar.pm	Thu Feb 10 22:23:58 2000
@@ -232,11 +232,13 @@

 	$fh = Compress::Zlib::gzopen ($_[0], $mode)
 	    or goto &_drat;
+	# (print #3) print STDERR "ZLIB: fh=$fh\n";
     }
     else {
 	$fh = bless *{$_[0]}{IO}, "Archive::Tar::_io";
 	binmode $fh
 	    or goto &_drat;
+	# (print #4) print STDERR "IO: fh=$fh\n";
     }

     return $fh;
@@ -616,6 +618,7 @@
     $handle = gensym;
     open $handle, ref ($file) ? ">&". fileno ($file) : ">" . $file
 	or goto &_drat;
+    binmode $handle;

     _write_tar (_get_handle ($handle, int ($compress)),
 		map {_add_file ($_)} @_);
@@ -629,6 +632,7 @@
     $handle = gensym;
     open $handle, ref ($file) ? "<&". fileno ($file) : "<" . $file
 	or goto &_drat;
+    binmode $handle;

     my $data = _read_tar (_get_handle ($handle), 1);

@@ -647,6 +651,7 @@
     $handle = gensym;
     open $handle, ref ($file) ? "<&". fileno ($file) : "<" . $file
 	or goto &_drat;
+    binmode $handle;

     _read_tar (_get_handle ($handle), 0, 1);
 }
@@ -681,6 +686,7 @@
     $self->{_handle} = gensym;
     open $self->{_handle}, ref ($file) ? "<&". fileno ($file) : "<" . $file
 	or goto &_drat;
+    binmode $self->{_handle};

     $self->{_data} = _read_tar (_get_handle ($self->{_handle}),
 				  sysseek $self->{_handle}, 0, 1);
@@ -697,6 +703,7 @@
     my $handle = gensym;
     open $handle, ref ($file) ? ">&". fileno ($file) : ">" . $file
 	or goto &_drat;
+    binmode $handle;

     if ($compress && !$compression) {
 	$error = "Compression not available.\n";
@@ -782,6 +789,8 @@
 	    unless $entry->{offset};

 	my $handle = _get_handle ($self->{_handle});
+# (print #1) print STDERR "HANDLE IS $self->{_handle}\n";
+# (print #2) print STDERR "HANDLE IS $handle\n";
 	$handle->gzseek ($entry->{offset}, 0)
 	    or goto &_drat;
Perl Info


Site configuration information for perl v5.5.650:

Configured by Administrator at Wed Feb  9 18:46:52 2000.

Summary of my perl5 (revision 5 version 5 subversion 650) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=undef
    usesocks=undef useperlio=undef d_sfio=undef
    use64bits=undef uselargefiles=undef usemultiplicity=undef
  Compiler:
    cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
    cppflags='-DWIN32'
    ccflags
'-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DPERL_MSVCR
T_READFIX'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags
'-nologo -nodefaultlib -release
-libpath:"E:\Applications\DevPerl\lib\MSWin32-x
86\CORE"  -machine:x86'
    libpth=D:\VisualStudio\VC98\lib
    libs=-DELAYLOAD:wsock32.dll delayimp.lib
E:\CDs\General\Libraries\Lib\MD\libdes.lib  oldnames.lib kernel32.lib
user32.lib
gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
version.lib
odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
ddlflags='-dll -nologo -nodefaultlib -release
-libpath:"E:\Applications\DevPerl
\lib\MSWin32-x86\CORE"  -machine:x86'

Locally applied patches:



@INC for perl v5.5.650:
    E:/Applications/DevPerl/lib/MSWin32-x86
    E:/Applications/DevPerl/lib
    E:/Applications/DevPerl/site/lib/MSWin32-x86
    E:/Applications/DevPerl/site/lib
    .


Environment for perl v5.5.650:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=D:\WINNT\system32;D:\WINNT;D:\NTRESKIT;D:\VisualStudio\Common\Tools\Win
NT;D
:\VisualStudio\Common\MSDev98\Bin;D:\VisualStudio\Common\Tools;D:\VisualStud
io\V
C98\bin;D:\UTILS;E:\Applications\DevPerl\bin;E:\Applications\DevPerl\bin\MSW
in32
-x86;E:\Oracle\Ora81\bin;D:\Program
Files\Oracle\jre\1.1.7\bin;E:\Oracle\Ent204\bin;E:\APPLIC~1\Tcl\bin;E:\Appli
cati
ons\Mingw32\bin;E:\Applications\XEmacs\XEmacs-21.2.27\i586-pc-win32;
    PERL_BADLANG (unset)
    SHELL (unset)


@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2003

From @floatingatoll

Hi :) This bug seems to be regarding a non-core module that's your
territory these days. Any comments? Do you know if the problem's been
resolved?

- R.

[1] http​://rt.perl.org/rt2/Ticket/Display.html/id=2135

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2003

From kane@dwim.org

On Nov 23, 2003, at 4​:52 AM, crystalflame (via RT) wrote​:

Hi :) This bug seems to be regarding a non-core module that's your
territory these days. Any comments? Do you know if the problem's been
resolved?

- R.

[1] http​://rt.perl.org/rt2/Ticket/Display.html/id=2135

since all the internals are /completely/ rewritten, i'd say​: 'probably'
grab the latest version of A​::T [2] and try again.

p.s. note the age of this ticket, i hardly think it's current any
more...

--

Jos Boumans

  "If superman is so smart, why does he wear underpants over his
  trousers?"

  CPANPLUS http​://cpanplus.sf.net

[2] http​://search.cpan.org/~kane/Archive-Tar-1.07/lib/Archive/Tar.pm

@p5pRT p5pRT closed this as completed Aug 27, 2004
@p5pRT
Copy link
Author

p5pRT commented Aug 27, 2004

@petdance - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant