delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/04/13:53:12

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
From: "Dave Korn" <dk AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Perl binmode problem on text mount
Date: Thu, 4 Nov 2004 18:52:03 -0000
MIME-Version: 1.0
In-Reply-To: <418A779A.6080808@agilent.com>
Message-ID: <NUTMEGmZ5fgSdmlm1DT000004d6@NUTMEG.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 04 Nov 2004 18:52:04.0031 (UTC) FILETIME=[600D9CF0:01C4C29F]

> -----Original Message-----
> From: cygwin-owner On Behalf Of Earl Chew
> Sent: 04 November 2004 18:40

> Christopher Faylor wrote:
> > You are missing the fact that the OP was reporting a real 
> bug, apparently.
> 
> To confirm, I ran the program:
> 
> 	binmode STDOUT;
> 	print "Hello\n";
> 
> using Perl 5.6.1-2 on Cygwin 1.5.11:
> 
> 	perl foo.pl > foo.txt ; od -c foo.txt
> 
> 	0000000  H e l l o \r \n	# Perl 5.8.5-3 Cygwin 1.5.11
> 	0000000  H e l l o \n		# Perl 5.6.1-2 Cygwin 1.3.10
> 	0000000  H e l l o \n		# Perl 5.6.1-2 Cygwin 1.5.11
> 
> The problem appears to be related to a change in Perl, rather
> than Cygwin.

  ....or maybe a change in 'od' ?

  Trying to understand problems like this mangles my brain.  Ok, there's
perl's file descriptor, that's in binmode.  But then it's being redirected
to a file.  By a shell.  What mode do shell redirections happen in?  And
then the file in question is getting written to a textmode mount.  Which
we'd expect to be changing it.  And then it gets read back by 'od'.  From a
text mount.  Via a file open, rather than a redirection.  There's just
waaaay too many potential changes of mode to keep track of!

  If you doubt that it's as complicated as I make out, check this example:

dk AT mace /win/textmode/c> od -c foo.txt
0000000   H   e   l   l   o  \n
0000006
dk AT mace /win/textmode/c> od -c < foo.txt
0000000   H   e   l   l   o  \r  \n
0000007
dk AT mace /win/textmode/c>

  I wouldn't like to jump to *any* hasty conclusions about whether or not I
know what the _actual_ contents of this file are just by looking at it with
od........


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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