Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Reply-To: From: "Eric Fifer" To: "'David M. Karr'" , 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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) In-Reply-To: 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(); 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(); 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