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 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@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........
> 
> 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/


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