delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/03/14:49:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
To: cygwin AT cygwin DOT com
From: Rolf Campbell <rcampbell AT tropicnetworks DOT com>
Subject: Re: Updated: perl-5.8.0-2
Date: Thu, 03 Apr 2003 14:48:33 -0500
Lines: 40
Message-ID: <b6i363$1sr$1@main.gmane.org>
References: <83040F98B407E6428FEC18AC720F5D732DB804 AT exchange DOT tropicnetworks DOT com> <121-156912388 DOT 20030401120153 AT familiehaase DOT de> <b6cdqm$v99$1 AT main DOT gmane DOT org> <182578293952 DOT 20030402073253 AT familiehaase DOT de> <b6fj7f$nss$1 AT main DOT gmane DOT org> <23715472465 DOT 20030403213912 AT familiehaase DOT de>
Mime-Version: 1.0
X-Complaints-To: usenet AT main DOT gmane DOT org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312
X-Accept-Language: en-us, en
In-Reply-To: <23715472465.20030403213912@familiehaase.de>

Gerrit P. Haase wrote:
> Hallo Rolf,
>>>>TEST.PL:
>>>>1:#!/bin/perl
>>>>2:$/ = "\r\n";
>>>>3:
>>>>4:open( LOG, "<in" ) ||
>>>>5:  die "Could not open log.\n";
>>>>6:binmode LOG, ":crlf";
>>>>7:
>>>>8:$in = <LOG>;
>>>>9:print $in;
>>Ok, so you get the same results as me.  They are both wrong.  The script 
>>should only print the first line.
> 
> 
>>I just tried something, I made a file like this: "0000000   a   b   c 
>>\r  \r  \n   d   e   f  \r  \r  \n".  Then the perl script shows only 
>>the first line.
> 
> 
>>In 5.6: setting 'binmode LOG, ":crlf";' would set the line-separator to 
>>"\r\n".
>>In 5.8: setting 'binmode LOG, ":crlf";' sets the line-separator to "\r" 
>>+ $/.  So, given that I've already set the line-separator to "\r\n" it 
>>ends up as "\r\r\n" for that file.
> 
> What about removing line #6 and let Perl do the conversion:
> Gerrit

I know that there are ways to write the script so that it avoids the 
problem.  I've converted the script into python anyways (partially 
because of this problem).  So, it's not like this problem is halting my 
work or anything, I just think it's strange that cygwin perl operates 
differently than Linux perl (when run on a bin-mode mount).

I just wanted to point out this bug in the cygwin port.

-Rolf



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019