Skip Menu |
 

This queue is for tickets about the autodie CPAN distribution.

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

People
Owner: niels [...] thykier.net
Requestors: craigberry [...] mac.com
Cc:
AdminCc:

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



Subject: [PATCH] fix O_CREAT without O_TRUNC in utf8_open.t
Date: Tue, 23 Jul 2013 22:28:29 -0500
To: bug-autodie [...] rt.cpan.org
From: "Craig A. Berry" <craigberry [...] mac.com>
The attached patch fixes a sysopen call in utf8_open.t that specifies O_CREAT without also specifying O_TRUNC. If you want the behavior you would get by creating a file, you have to specify O_TRUNC if the file already exists, which it definitely does in this case. See <http://pubs.opengroup.org/onlinepubs/009695399/functions/open.html>. This fixes a test failure on VMS. Other platforms seem to be more forgiving. And here's the patch inline: --- a/cpan/autodie/t/utf8_open.t +++ b/cpan/autodie/t/utf8_open.t @@ -96,7 +96,7 @@ else { # open for writing only { - sysopen my $fh, $file, O_CREAT|O_WRONLY; + sysopen my $fh, $file, O_CREAT|O_TRUNC|O_WRONLY; my @layers = PerlIO::get_layers($fh); ok( (grep { $_ eq 'utf8' } @layers), "open write honors open pragma" ) or diag join ", ", @layers; [end] Show quoted text
________________________________________ Craig A. Berry mailto:craigberry@mac.com "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser
Download utf8_open_t.patch
text/x-diff 419b

Message body is not shown because sender requested not to inline it.

Download (untitled) / with headers
text/plain 854b
On Tue Jul 23 23:28:51 2013, craigberry@mac.com wrote: Show quoted text
> The attached patch fixes a sysopen call in utf8_open.t that specifies > O_CREAT without also specifying O_TRUNC. If you want the behavior you > would get by creating a file, you have to specify O_TRUNC if the file > already exists, which it definitely does in this case. See > <http://pubs.opengroup.org/onlinepubs/009695399/functions/open.html>. > > This fixes a test failure on VMS. Other platforms seem to be more > forgiving. And here's the patch inline: > > [...] > ________________________________________ > Craig A. Berry > mailto:craigberry@mac.com > > "... getting out of a sonnet is much more > difficult than getting in." > Brad Leithauser
Hi, Thanks for the patch, it has been merged into the master branch and is expected to be a part of v2.26. ~Niels
Download (untitled) / with headers
text/plain 207b
Hi, Thanks for reporting the issue. :) A fix for this bug was included in the v2.26 release (uploaded to CPAN today). Please have a look at it and let us know if v2.26 works as intended. Thanks, ~Niels


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.