Skip Menu |
 

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 48869
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.831
Fixed in: (no value)

Attachments
lwp-useragent-diagnostics-on-stat.diff



Subject: Improve diagnostics from LWP::UserAgent::mirror
Download (untitled) / with headers
text/plain 449b
A similar issue is described in #48236. I happened to come across the same problem and found a different spot where the diagnostics can be improved. Because the user had no write permissions to the directory the tmpfile was not even written and the stat() call was unsuccessful. I suspect this has a corollary in some unsuccessful close() further up the chain. The patch seems orthogonal to Slaven's patch in 48236, so I make this a new RT ticket.
Subject: lwp-useragent-diagnostics-on-stat.diff
diff --git a/lib/LWP/UserAgent.pm b/lib/LWP/UserAgent.pm index d932085..f773d3a 100644 --- a/lib/LWP/UserAgent.pm +++ b/lib/LWP/UserAgent.pm @@ -839,7 +839,8 @@ sub mirror # If the file was not modified, "304" would returned, which # is considered by HTTP::Status to be a "redirect", /not/ "success" if ( $response->is_success ) { - my $file_length = ( stat($tmpfile) )[7]; + my @stat = stat($tmpfile) or die "Could not stat tmpfile '$tmpfile': $!"; + my $file_length = $stat[7]; my ($content_length) = $response->header('Content-length'); if ( defined $content_length and $file_length < $content_length ) {
Download (untitled) / with headers
text/plain 105b
Thanks. Applied in <http://github.com/gisle/libwww- perl/commit/ec326ac4ec48a3c8eb7cf0439acd655c8802e059>


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.