Front page | perl.perl5.porters |
Postings from July 2011
Re: Can we do global bug fixes that change behavior?
Thread Previous
|
Thread Next
From:
H.Merijn Brand
Date:
July 4, 2011 22:48
Subject:
Re: Can we do global bug fixes that change behavior?
Message ID:
20110705074821.48f57c63@pc09.procura.nl
On Tue, 5 Jul 2011 04:20:13 +0200, Reini Urban <rurban@x-ray.at> wrote:
> 2011/6/29 Christian Walde <walde.christian@googlemail.com>:
> > On Wed, 29 Jun 2011 00:24:40 +0200, Leon Timmermans <fawaka@gmail.com>
> > wrote:
> >
> >> On Tue, Jun 28, 2011 at 11:31 PM, Christian Walde
> >> <walde.christian@googlemail.com> wrote:
> >>>
> >>> xdg suggested on IRC that i ask this as a separate question, so:
> >>>
> >>> obra:
> >>>
> >>> Assuming p5p reaches an agreement that magical newline-changing on
> >>> Windows
> >>> is a bug, would you agree to changing the behavior globally for the
> >>> interpreter; or only accept it as a lexical fix when 'use v5.16' is in
> >>> effect no matter what the concensus is?
> >>>
> >>> leont indicated that this kind of change could be applied with zero ill
> >>> effects from 5.14 on, and with a possible performance regression from
> >>> 5.12
> >>> on.
> >>
> >> It should be easy from an implementation point of view. My main
> >> concern is that files written in current versions will show up
> >> differently in the newer versions (carriage returns at the end of
> >> lines), and that would cause some breakage.
> >
> > This problem exists currently already, since files written on Windows by
> > $fh->print("\n") will contain magic \rs, which will break when read on linux
> > with the expectation of only \n.
>
> This is no convincing argument.
> \r\n is no magic on windows, it is the default.
> unix has d2u to get rid of this.
> When you want to write to unix files or streams on windows use binmode or :raw,
> instead of textmode. If you use internet protocols use :crlf.
>
> For compatibility most internet protocols (HTTP, MIME, NNTP) use
> explicitly CRLF, not LF only. Even on unix.
The de-facto standard line-ending for CSV is also \r\n, but
Text::CSV_XS will accept (consistent use of) \n, \r\n, and \r
> So you have to convince your scripts to do the right thing, not break
> perl's textmode on windows.
>
> >> Such a transition could be made easier by a generic :text. This layer
> >> should probably be based on the robustness principle (e.g. it should
> >> accept both LF and CRLF line-endings for input, but only output LF).
> >
> > I'm a bit confused this would come in if it wouldn't be an auto-applied
> > layer no matter what OS?
--
H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Thread Previous
|
Thread Next