Skip Menu |
 

This queue is for tickets about the DBD-CSV CPAN distribution.

Report information
The Basics
Id: 33764
Status: resolved
Priority: 0/
Queue: DBD-CSV

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

Bug Information
Severity: Important
Broken in: 0.22
Fixed in: 0.24_01



Subject: $! is not an indicator of failure
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 334
Download (untitled) / with headers
text/plain 334b
DBD::CSV doesn't use the documented method of determining whether Text::CSV reached the end of file or not, resulting in failures when Text::CSV_PP is used instead of Text::CSV_XS. die "Error while reading file " . $self->{'file'} . ": $!" if $!; should be die "Error while reading file " . $self->{'file'} . ": $!" if !$csv->eof();
CC: mailto:IKEGAMI [...] cpan.org
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-26238-1204505949-1441.33764-4-0 [...] rt.cpan.org>
References: <RT-Ticket-33764 [...] rt.cpan.org> <rt-3.6.HEAD-26238-1204505949-1441.33764-4-0 [...] rt.cpan.org>
Content-Type: text/plain; charset=utf-8; format=flowed
X-RT-Original-Encoding: utf-8
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 678074D8046 for <bug-DBD-CSV [...] rt.cpan.org>; Sun, 2 Mar 2008 20:35:21 -0500 (EST)
Received: (qmail 11152 invoked from network); 3 Mar 2008 01:35:21 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 3 Mar 2008 01:35:21 -0000
Received: from mail6.sea5.speakeasy.net (HELO mail6.sea5.speakeasy.net) (69.17.117.8) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 Mar 2008 17:35:18 -0800
Received: (qmail 1777 invoked from network); 3 Mar 2008 01:35:15 -0000
Received: from c-24-21-138-5.hsd1.mn.comcast.net (HELO [24.21.138.5]) (jeff [...] vpservices.com [...] [24.21.138.5]) (envelope-sender <jeff [...] vpservices.com>) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for <bug-DBD-CSV [...] rt.cpan.org>; 3 Mar 2008 01:35:15 -0000
Delivered-To: cpan-bug+DBD-CSV [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #33764] $! is not an indicator of failure
User-Agent: Icedove 1.5.0.10 (X11/20070329)
Return-Path: <jeff [...] vpservices.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-CSV [...] rt.cpan.org
Date: Mon, 03 Mar 2008 01:35:10 +0000
X-Spam-Level: *
Message-Id: <47CB55CE.3090602 [...] vpservices.com>
To: bug-DBD-CSV [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Jeff Zucker <jeff [...] vpservices.com>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-26262-1204508136-1931.33764-0-0 [...] rt.cpan.org>
Content-Length: 904
Download (untitled) / with headers
text/plain 904b
If Text::CSV_PP behaves differently than Text::CSV_XS, that seems like a bug in Text:CSV_PP, why do you see it as a bug in the upstream modules? -- Jeff ikegami via RT wrote: Show quoted text
> Sun Mar 02 19:59:08 2008: Request 33764 was acted upon. > Transaction: Ticket created by ikegami > Queue: DBD-CSV > Subject: $! is not an indicator of failure > Broken in: 0.22 > Severity: Important > Owner: Nobody > Requestors: IKEGAMI@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=33764 > > > > DBD::CSV doesn't use the documented method of determining whether > Text::CSV reached the end of file or not, resulting in failures when > Text::CSV_PP is used instead of Text::CSV_XS. > > die "Error while reading file " . $self->{'file'} . ": $!" if $!; > should be > die "Error while reading file " . $self->{'file'} . ": $!" if !$csv->eof(); > > > >
CC: bug-DBD-CSV [...] rt.cpan.org
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,DK_SIGNED,HTML_MESSAGE,SPF_PASS
In-Reply-To: <47CB55CE.3090602 [...] vpservices.com>
References: <RT-Ticket-33764 [...] rt.cpan.org> <rt-3.6.HEAD-26238-1204505949-1441.33764-4-0 [...] rt.cpan.org> <47CB55CE.3090602 [...] vpservices.com>
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
Content-Type: multipart/alternative; boundary="----=_Part_17166_18169901.1204524809364"
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 2869B4D803F for <bug-DBD-CSV [...] rt.cpan.org>; Mon, 3 Mar 2008 01:13:36 -0500 (EST)
Received: (qmail 2869 invoked from network); 3 Mar 2008 06:13:35 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 3 Mar 2008 06:13:35 -0000
Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) (66.249.82.232) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 Mar 2008 22:13:32 -0800
Received: by wx-out-0506.google.com with SMTP id h29so5761700wxd.27 for <bug-DBD-CSV [...] rt.cpan.org>; Sun, 02 Mar 2008 22:13:29 -0800 (PST)
Received: by 10.70.72.11 with SMTP id u11mr11856548wxa.39.1204524809374; Sun, 02 Mar 2008 22:13:29 -0800 (PST)
Received: by 10.70.69.8 with HTTP; Sun, 2 Mar 2008 22:13:29 -0800 (PST)
Delivered-To: cpan-bug+DBD-CSV [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #33764] $! is not an indicator of failure
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=thyecl6a23JTpt+4x9VnXJdMNo1UwQU/zLzct0KiRB4yfO3EHUTgUct/qQq7/Hf/AdzDfRzgotXwJg8cci7FDzbO4S82OxD5RlKfd14l/RNKRgDGq5icLvE36JCRBju3RYHZb8auWxMVycqd+Fkzy/HyG4tXW1FwTkR7mIgI1EM=
Return-Path: <ikesuke [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=eZsHzSUhVRKknuRar/5piLnCceoXq+o2mTHhVLSZ85Y=; b=K+3YMrDN/hwH2W2bGfUWiq+HidomdO4djKh6X8tYaKA9GmmBT50QbNrim3ohRiqVnmetvMeQ7HNN3pWUeYbQEmoHgwzmDL0fOdvkN3rM32h7xIN7S7dOlsrV0suUPLz6eWsDyA7GRXKTkLymh9cgEOz3kEk/ZAPmYatEDIvEKrI=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBD-CSV [...] rt.cpan.org
X-Google-Sender-Auth: d8ccec2aadc593a4
Sender: ikesuke [...] gmail.com
Date: Mon, 3 Mar 2008 01:13:29 -0500
X-Spam-Level: *
Message-Id: <f86994700803022213v4f6c5726x16b0f377a2697195 [...] mail.gmail.com>
To: "Jeff Zucker" <jeff [...] vpservices.com>
From: "Eric Brine" <ikegami [...] adaelis.com>
RT-Message-ID: <rt-3.6.HEAD-26271-1204524822-792.33764-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: ISO-8859-1
X-RT-Original-Encoding: utf-8
Content-Length: 1303
Download (untitled) / with headers
text/plain 1.2k
On Sun, Mar 2, 2008 at 8:35 PM, Jeff Zucker <jeff@vpservices.com> wrote: Show quoted text
> If Text::CSV_PP behaves differently than Text::CSV_XS, that seems like a > bug in Text:CSV_PP, why do you see it as a bug in the upstream modules? >
They behave the same when using the documented interface. Only when you make assumptions about their implementations do they differ, and obviously the implementations are different. The problem is that DBD::CSV relies on some undocumented side-effect of Text::CSV_XS's implementation. -> You assume $! will continue to be set in future versions of the CSV parser class. -> You assume $! is currently always set when the CSV parser class encounters an error. Not only that, but that use of $! is buggy for much more basic reasons: -> You falsely assume zero is not a valid error code for $!. -> You falsely assume $! remains unchanged when no I/O error occur. perlvar clearly and emphatically states $! is meaningless (i.e. could be anything) in that situation. The documentation clearly favours the use of eof, so why use $!? If parse () or getline () was used with an IO stream, this method will return true (1) if the last call hit end of file, otherwise it will return false (''). This is useful to see the difference between a failure and end of file.") ELB/ikegami
Content-Type: text/html; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: ISO-8859-1
X-RT-Original-Encoding: utf-8
Content-Length: 1729
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-26271-1204524822-792.33764-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
References: <RT-Ticket-33764 [...] rt.cpan.org> <rt-3.6.HEAD-26238-1204505949-1441.33764-4-0 [...] rt.cpan.org> <47CB55CE.3090602 [...] vpservices.com> <f86994700803022213v4f6c5726x16b0f377a2697195 [...] mail.gmail.com> <rt-3.6.HEAD-26271-1204524822-792.33764-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-2571-1218476999-280.33764-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 984
Download (untitled) / with headers
text/plain 984b
On Mon Mar 03 01:13:42 2008, ikegami@adaelis.com wrote: Show quoted text
> On Sun, Mar 2, 2008 at 8:35 PM, Jeff Zucker <jeff@vpservices.com>
wrote: Show quoted text
>
> > If Text::CSV_PP behaves differently than Text::CSV_XS, that seems
like a Show quoted text
> > bug in Text:CSV_PP, why do you see it as a bug in the upstream
modules? Show quoted text
> >
> > They behave the same when using the documented interface. Only when
you make Show quoted text
> assumptions about their implementations do they differ, and obviously
the Show quoted text
> implementations are different. > > The problem is that DBD::CSV relies on some undocumented side-effect
of Show quoted text
> Text::CSV_XS's implementation. > > -> You assume $! will continue to be set in future versions of the CSV > parser class. > -> You assume $! is currently always set when the CSV parser class > encounters an error.
If you rely on $! to be the error from Text::CSV_??, don't. We now have $csv->error_diag (), which is much more versatile. I tested DBD::CSV today for my talk and missed error_diag () output deerly.


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.