Skip Menu |
 

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 28491
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: Nobody in particular
Requestors: allard [...] byte.nl
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.01
  • 2001.1103
  • 2002.0305
  • 2002.1031
  • 2004.0904
  • 96.042202
  • 98.071901
  • 9999.01
  • 9999.02
  • 9999.03
  • 9999.04
  • 9999.06
  • 9999.07
  • 9999.08
  • 9999.09
  • 9999.10
  • 9999.11
  • 9999.12
Fixed in: (no value)



Subject: Please patch File::Slurp to support multi-byte character files (patch included)
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1185440958-28224-12"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 314
Download (untitled) / with headers
text/plain 314b
Dear Maintainer, File::Slurp does not support reading from or writing to files that use multibyte character sets. The manual even says so :) Even still, the patch to support this is stunningly simple. Please apply the patch. Regards, Allard Hoeve PS: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=429933
Subject: libfile-slurp-perl_binmode.patch
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1185440954-28224-11"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: text/x-patch; name="libfile-slurp-perl_binmode.patch"
Content-Disposition: inline; filename="libfile-slurp-perl_binmode.patch"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: ascii
Content-Length: 1618
--- /usr/share/perl5/File/Slurp.pm.orig 2005-04-19 07:12:40.000000000 +0200 +++ /usr/share/perl5/File/Slurp.pm 2007-06-21 12:37:36.000000000 +0200 @@ -65,7 +65,6 @@ # a regular file. set the sysopen mode my $mode = O_RDONLY ; - $mode |= O_BINARY if $args{'binmode'} ; # open the file and handle any error @@ -75,6 +74,8 @@ goto &error ; } + binmode($read_fh, $args{'binmode'}) if $args{'binmode'}; + # get the size of the file for use in the read loop $size_left = -s $read_fh ; @@ -210,7 +211,6 @@ # set the mode for the sysopen my $mode = O_WRONLY | O_CREAT ; - $mode |= O_BINARY if $args->{'binmode'} ; $mode |= O_APPEND if $args->{'append'} ; $mode |= O_EXCL if $args->{'no_clobber'} ; @@ -221,6 +221,8 @@ @_ = ( $args, "write_file '$file_name' - sysopen: $!"); goto &error ; } + + binmode($write_fh, $args->{'binmode'}) if $args->{'binmode'}; } sysseek( $write_fh, 0, SEEK_END ) if $args->{'append'} ; @@ -435,10 +437,8 @@ mode. my $bin_data = read_file( $bin_file, binmode => ':raw' ) ; - -NOTE: this actually sets the O_BINARY mode flag for sysopen. It -probably should call binmode and pass its argument to support other -file modes. + # Or + my $bin_data = read_file( $bin_file, binmode => ':utf8' ) ; =head3 array_ref @@ -537,10 +537,8 @@ mode. write_file( $bin_file, {binmode => ':raw'}, @data ) ; - -NOTE: this actually sets the O_BINARY mode flag for sysopen. It -probably should call binmode and pass its argument to support other -file modes. + # Or + write_file( $bin_file, {binmode => ':utf8'}, @data ) ; =head3 buf_ref
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-2356-1287018248-1320.28491-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 143
Download (untitled) / with headers
text/plain 143b
Hi allard, Are you up for adding some tests for this, too? Surely it'll be easier to get Dave (the new maintainer) to apply the patch, then.
From allardhoeve [...] gmail.com Sat Oct 16 15: 12:51 2010
CC: allard [...] byte.nl
MIME-Version: 1.0
X-Spam-Status: No, score=-6.109 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779, T_TO_NO_BRKTS_FREEMAIL=0.01] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-2356-1287018248-377.28491-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-28491 [...] rt.cpan.org> <rt-3.8.HEAD-2356-1287018248-377.28491-6-0 [...] rt.cpan.org>
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <AANLkTim_-XFptEApjN2b0bRxwYH6z9oe0siU4sOiBDBR [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary=0016369f9dc767b8080492c0b9d0
X-Spam-Score: -6.109
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Authentication-Results: hipster.bestpractical.com (amavisd-new); domainkeys=pass header.sender=allardhoeve [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id F1768240E68 for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Sat, 16 Oct 2010 15:12:50 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9b8kmFC5Wbzc for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Sat, 16 Oct 2010 15:12:49 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0F621240E2A for <bug-File-Slurp [...] rt.cpan.org>; Sat, 16 Oct 2010 15:12:48 -0400 (EDT)
Received: (qmail 6201 invoked by uid 103); 16 Oct 2010 19:12:56 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 16 Oct 2010 19:12:56 -0000
Received: from mail-iw0-f178.google.com (HELO mail-iw0-f178.google.com) (209.85.214.178) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Sat, 16 Oct 2010 12:12:54 -0700
Received: by iwn7 with SMTP id 7so1112451iwn.9 for <bug-File-Slurp [...] rt.cpan.org>; Sat, 16 Oct 2010 12:12:42 -0700 (PDT)
Received: by 10.231.171.7 with SMTP id f7mr1869560ibz.72.1287256348800; Sat, 16 Oct 2010 12:12:28 -0700 (PDT)
Received: by 10.231.150.67 with HTTP; Sat, 16 Oct 2010 12:12:28 -0700 (PDT)
Received: by 10.231.150.67 with HTTP; Sat, 16 Oct 2010 12:12:28 -0700 (PDT)
Delivered-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #28491] Please patch File::Slurp to support multi-byte character files (patch included)
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=ETXdVZ89AbiQ3gdb0jB2HYclyTXJvGj4mCUSEF+DWMgWHU8B+3uXEt0JZA9ej0LlFJ eeDgxhTMOqqefGLKhQ2AXuTQXdr141G9Im5FQrejCj/WjDKAnDvc2qQFKhYHgKLChH0D RnBvoDRYTLSG0iodiXr3jE6AMvHO2YaXT0/fE=
Return-Path: <allardhoeve [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=hCYc+XZIgJ43UGvTlQflBVLZlcKPed7HEe8Kctpdsfs=; b=roghtZ+PrSexz2uQABmcWJSfhrsmCnimi7mPdWhhAYVbQ5l0N3dcRVZ2trX4vtTN8B kVbNPSzvhd6DujNIWjWmNpGDC3boFjj5aiqw1Tz63ennIVf9JGdpC9U2p2D94VlxNByO JKdy5Y19KTs+47f+eUwBnmWuEWbbMNSL2A5Ww=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
X-RT-Mail-Extension: file-slurp
X-Google-Sender-Auth: jPVGG6-s0aMjQ_wknHI9n-N2FAw
Sender: allardhoeve [...] gmail.com
Date: Sat, 16 Oct 2010 21:12:28 +0200
X-Spam-Level:
To: bug-File-Slurp [...] rt.cpan.org
From: Allard Hoeve <allard [...] byte.nl>
RT-Message-ID: <rt-3.8.HEAD-2357-1287256380-1224.28491-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
X-RT-Original-Encoding: utf-8
Content-Length: 393
Download (untitled) / with headers
text/plain 393b
Yes, I am. But am also short on time. More to follow... Met vriendelijke groet, Allard Sent from my HTC. On Oct 14, 2010 3:04 AM, "ABH via RT" <bug-File-Slurp@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=28491 > > > Hi allard, > > Are you up for adding some tests for this, too? Surely it'll be easier to
get Dave (the new Show quoted text
> maintainer) to apply the patch, then.
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 660
From allardhoeve [...] gmail.com Mon Oct 18 05: 46:48 2010
MIME-Version: 1.0
X-Spam-Status: No, score=-6.109 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779, T_TO_NO_BRKTS_FREEMAIL=0.01] autolearn=ham
In-Reply-To: <AANLkTim_-XFptEApjN2b0bRxwYH6z9oe0siU4sOiBDBR [...] mail.gmail.com>
X-Spam-Flag: NO
References: <RT-Ticket-28491 [...] rt.cpan.org> <rt-3.8.HEAD-2356-1287018248-377.28491-6-0 [...] rt.cpan.org> <AANLkTim_-XFptEApjN2b0bRxwYH6z9oe0siU4sOiBDBR [...] mail.gmail.com>
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <AANLkTinu9p+4fpBn20xmmTC0Xe2FYwWdtQo-V=F6WoDW [...] mail.gmail.com>
Content-Type: multipart/mixed; boundary=0022152d6c657b0f840492e10dc4
X-Spam-Score: -6.109
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Authentication-Results: hipster.bestpractical.com (amavisd-new); domainkeys=pass header.sender=allardhoeve [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id A8703240EA6 for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Mon, 18 Oct 2010 05:46:48 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UZnlXgqyMjUH for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Mon, 18 Oct 2010 05:46:45 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id ABD28240EA4 for <bug-File-Slurp [...] rt.cpan.org>; Mon, 18 Oct 2010 05:46:45 -0400 (EDT)
Received: (qmail 11060 invoked by uid 103); 18 Oct 2010 09:46:46 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 18 Oct 2010 09:46:46 -0000
Received: from mail-iw0-f178.google.com (HELO mail-iw0-f178.google.com) (209.85.214.178) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Mon, 18 Oct 2010 02:46:44 -0700
Received: by iwn7 with SMTP id 7so1036852iwn.9 for <bug-File-Slurp [...] rt.cpan.org>; Mon, 18 Oct 2010 02:46:38 -0700 (PDT)
Received: by 10.231.33.132 with SMTP id h4mr2988598ibd.150.1287395198307; Mon, 18 Oct 2010 02:46:38 -0700 (PDT)
Received: by 10.231.161.76 with HTTP; Mon, 18 Oct 2010 02:46:18 -0700 (PDT)
Delivered-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #28491] Please patch File::Slurp to support multi-byte character files (patch included)
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=SjDDlzAmNPzU44ie/dRV4d7sW/fHhg66+rtW8vBsBO3V/WW9iYFp8Zgs6difJidD1y JiASLyaTqspPY8durvwR9dovuwjQAluSBjX+zVZl8fEtfZeXZblZuK0x8xw1tffFO2kb D2Fz8MLvMduP4roTRpFwYsGMfba5gHqXWMz60=
Return-Path: <allardhoeve [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=BRN2zs5OwUDcaYdLicwj2YFg+Bmf2Us9VQOmHvcUkMM=; b=EFwhdC/TGEseuGPJ8MYWiqjYDu3lbRHHJuUxxaROD7d3bDxHivbB+eOgd4TR8wbQAn +TY6azIapS2NuJVPib0FboIhnjw7XHTeK1bWr/tQd/etn2iX/tCxlw71fhIBArrjvyq+ +j16A2wusAumKpqW647Hp4h82d+ScHmHzBoRU=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
X-RT-Mail-Extension: file-slurp
X-Google-Sender-Auth: ySzqtRu1-kHjKzzRSQtpGAz1_y8
Sender: allardhoeve [...] gmail.com
Date: Mon, 18 Oct 2010 11:46:18 +0200
X-Spam-Level:
To: bug-File-Slurp [...] rt.cpan.org
From: Allard Hoeve <allard [...] byte.nl>
RT-Message-ID: <rt-3.8.HEAD-2360-1287395210-355.28491-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: multipart/alternative; boundary=0022152d6c657b0f750492e10dc2
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
X-RT-Original-Encoding: utf-8
Content-Length: 93
Hello all, I found some time to write tests. Please find the patch attached. Best, Allard
Content-Type: text/html; charset=UTF-8
X-RT-Original-Encoding: utf-8
Content-Length: 180
content-type: text/x-patch; charset="UTF-8"; name="utf8-tests.patch"
X-Attachment-ID: f_gff5u3mt0
content-disposition: attachment; filename="utf8-tests.patch"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: utf-8
Content-Length: 2259
Download utf8-tests.patch
text/x-diff 2.2k

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

MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-18806-1306129024-280.28491-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 5
fixed


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.