OK, I've had time to look at it. I found the actual culprit, but at the same time, I found some more errors that affect other platforms as well.

The reason why it failed, is this snippet, at lines 237-239:

if ($^O eq "MSWin32") { $fh = $_[0]; }
where later on, this is done with it:
$fh = Compress::Zlib::gzdopen_ ($fh, $mode, 0)
gzdopen_ is a low level function in Compress::Zlib. Well, guess what: this function expect a fileno, not a handle. So this fails. This does _drat() (it should either goto &_drat; or return _drat();, but not just call _drat()). $! is not set, so $error isn't set to a true value, and that's why it fails in such an ungraceful way. But I digress.

The solution is simple: set

if ($^O eq "MSWin32") { $fh = fileno($_[0]); }
instead. And now all tests succeed.

Here's the whole diff (for Archive-Tar-0.22.tar.gz):

--- Tar.pm Fri Apr 28 00:50:16 2000 +++ blib/lib/Archive/Tar.pm Sat Aug 24 15:06:04 2002 @@ -79,7 +79,7 @@ my $error; sub _drat { - $error = $! . ''; + $error = $! . '' || 'unknown error'; return; } @@ -235,7 +235,7 @@ or goto &_drat; if ($^O eq "MSWin32") { - $fh = $_[0]; + $fh = fileno($_[0]); } else { $fh = fcntl ($_[0], F_DUPFD, 0) @@ -248,7 +248,7 @@ # $fh = Compress::Zlib::gzopen ($_[0], $mode) # or &_drat; $fh = Compress::Zlib::gzdopen_ ($fh, $mode, 0) - or &_drat; + or goto &_drat; } else { $flags = fcntl ($_[0], F_GETFL, 0) & (O_RDONLY | O_WRONLY | O_RDWR +);

I'll try to warn the maintainer.


In reply to Re: Re: Re: Archive::Tar Memory Consumption by bart
in thread Archive::Tar Memory Consumption by arc_of_descent

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.