delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/04/14:44:20

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 19:43:08 -0000
MIME-Version: 1.0
In-Reply-To: <20041104190433.GJ11533@trixie.casa.cgf.cx>
Message-ID: <NUTMEG6nmGq3MSL2pBI000004d8@NUTMEG.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 04 Nov 2004 19:43:08.0906 (UTC) FILETIME=[82DC6CA0:01C4C2A6]

> -----Original Message-----
> From: cygwin-owner On Behalf Of Christopher Faylor
> Sent: 04 November 2004 19:05

> On Thu, Nov 04, 2004 at 06:52:03PM -0000, Dave Korn wrote:
> >> -----Original Message-----
> >> From: cygwin-owner On Behalf Of Earl Chew
> >> Sent: 04 November 2004 18:40

> >> The problem appears to be related to a change in Perl, rather
> >> than Cygwin.
> >
> >  ....or maybe a change in 'od' ?
> 
> Hard to see how "od" would take previous versions of perl 
> into account.

Well, yes, that would be magic of it.

I guess it's my own fault for not explicitly using smilies.

> >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........
> 
> The OP showed consistent behavior using od and different 
> versions of perl.
> There is no reason to speculate about od problems in this scenario.

  The fact that od was involved was a detail; the actual point I was making
was just about the complications of diagnosing a problem like this when
there are multiple interactions between file modes and mountpoints and in
particular when those interactions also affect the tools being used as
diagnostics.  It was a fairly generic point about debugging in general.
Perl and od just happened to be the first handy candidates.  It wasn't
"speculating about od problems".

> setmode() should trump everything.  If a program calls setmode() on an
> open file descriptor, future operations on that file should honor what
> setmode() says.

  Yes, but as I was pointing out, no matter what effect setmode might or
might not have had on the contents of the file when perl wrote it out to
disk, there's a whole secondary stage of processing when od opens the file
and reads it back in, interacting with the shell's stdio handling, and that
secondary stage may (or may not; but we can't just _assume_) involve a
non-null transformation of the data under analysis.

    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