delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT sources DOT redhat DOT com |
Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
Reply-To: | <egf7 AT columbia DOT edu> |
From: | "Eric Fifer" <egf7 AT columbia DOT edu> |
To: | "'David M. Karr'" <dkarr AT tcsi DOT com>, <cygwin AT sourceware DOT cygnus DOT com> |
Subject: | RE: Perl INPUT_RECORD_SEPARATOR not matching default text file type? |
Date: | Mon, 8 Jan 2001 01:33:55 -0000 |
Message-ID: | <000b01c07913$14993ba0$283670c2@fifer> |
MIME-Version: | 1.0 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) |
In-Reply-To: | <uyu27dbk4e.fsf@tcsi.com> |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
Importance: | Normal |
David M. Karr wrote: >If my default text file type is "DOS", should the cygwin-built Perl >have the INPUT_RECORD_SEPARATOR variable ($/) be set to "\r\n"? It >appears to be set to "\n". If a file with CRLF endings is opened in text mode, the CR should be automatically stripped by Cygwin before Perl ever sees the line. The INPUT_RECORD_SEPARATOR should be "\n". However, now that I'm checking this, it looks like there is a bug somewhere. If I create a test file x.txt with CRLF endings on a text mount and create a x.pl script with: open(STDIN, 'x.txt'); print while(<STDIN>); If I run 'perl x.pl | od -c' I see only \n as I expected. However, if this is my script: open(FH, 'x.txt'); print while(<FH>); Then, I see \r \n. The only difference is the filehandle. A strace shows in both cases that the file is being opened in text mode: fhandler_base::open: filemode set to text However, in the second case something is triggering a reassessment: _cygwin_istext_for_stdio: _cygwin_istext_for_stdio (3) _cygwin_istext_for_stdio: _cifs: get_*_binary setmode_helper: setmode: file was cle now raw setmode: setmode (3, binary) returns text _cygwin_istext_for_stdio: _cygwin_istext_for_stdio (3) _cygwin_istext_for_stdio: _cygwin_istext_for_stdio says yes setmode_helper: setmode: file was raw now cle setmode: setmode (3, text) returns binary Very odd. I'll try to track this down. Eric Fifer -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |