Skip Menu |
 

This queue is for tickets about the autodie CPAN distribution.

Report information
The Basics
Id: 42110
Status: resolved
Priority: 0/
Queue: autodie

People
Owner: PJF [...] cpan.org
Requestors: cberry [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.997
Fixed in: (no value)



Subject: [PATCH] truncate.t doesn't check return status when testing whether we can test
Download (untitled) / with headers
text/plain 660b
In determining whether tests based on truncate() are worth running, truncate.t calls truncate() inside an eval, which should handle the case where the function doesn't exist. But since the return value is not checked, it doesn't handle the case where a simple truncate operation fails. The attached patch remedies that. This came up because on VMS, the C library's ftruncate() does not play nice with temporary files having the delete-on-close bit set, which is what File:Temp gives us by default. An alternative would be to have it roll its own temp file, but that seems an unnecessary burden to place on a test script that is doing the right thing.
Subject: truncate.patch.txt
Download truncate.patch.txt
text/plain 531b
--- t/lib/autodie/truncate.t;-0 Sat Dec 20 07:32:08 2008 +++ t/lib/autodie/truncate.t Fri Jan 2 10:24:27 2009 @@ -6,13 +6,14 @@ use File::Temp qw(tempfile); use IO::Handle; my $tmpfh = tempfile(); +my $truncate_status; eval { - truncate($tmpfh, 0); + $truncate_status = truncate($tmpfh, 0); }; -if ($@) { - plan skip_all => 'Truncate not implemented on this system'; +if ($@ || !defined($truncate_status)) { + plan skip_all => 'Truncate not implemented or not working on this system'; } plan tests => 3;
G'day Craig, On Fri Jan 02 17:58:16 2009, CBERRY wrote: Show quoted text
> In determining whether tests based on truncate() are worth running, > truncate.t calls truncate() inside an eval, which should handle the > case where the function doesn't exist. But since the return value > is not checked, it doesn't handle the case where a simple > truncate operation fails. The attached patch remedies that.
You are awesome! I don't have access to any VMS machines, and so I'm always concerned that despite my best efforts, things may break there. I very much appreciate the bug report! Your patch has been applied to the autodie repository[1] as commit b418327 with attribution to yourself in the commit meta-info and Changes file, along with kudos on ohloh[2]. The changes will go out in the next release of autodie, which (unless an avalanche of works fall on my plate) should be tomorrow. I'll drop a note to p5p with the patch and credit to yourself in a few minutes. Many many thanks, Paul [1] http://github.com/pfenwick/autodie/ [2] https://www.ohloh.net/p/perl/contributors/19393924877611
Download (untitled) / with headers
text/plain 224b
G'day Craig, Autodie 1.998 has been pushed to the CPAN, and will soon appear at a mirror near you. It includes your fixes to truncate.t. A patch has also been sent to p5p for inclusion in core. Many thanks again, Paul


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.