This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Perl binmode problem on text mount


> -----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@mace /win/textmode/c> od -c foo.txt
0000000   H   e   l   l   o  \n
0000006
dk@mace /win/textmode/c> od -c < foo.txt
0000000   H   e   l   l   o  \r  \n
0000007
dk@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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]