delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/08/22/12:06:32

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
Date: Mon, 22 Aug 2005 12:06:12 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: "Gerrit P. Haase" <gerrit AT familiehaase DOT de>
cc: cygwin AT cygwin DOT com
Subject: Re: Perl binmode problems when redirecting to text mounts
In-Reply-To: <4309B1E7.8090403@familiehaase.de>
Message-ID: <Pine.GSO.4.61.0508221205170.8277@slinky.cs.nyu.edu>
References: <Pine DOT GSO DOT 4 DOT 61 DOT 0508211211150 DOT 16057 AT slinky DOT cs DOT nyu DOT edu> <Pine DOT GSO DOT 4 DOT 61 DOT 0508211252560 DOT 16057 AT slinky DOT cs DOT nyu DOT edu> <4309B1E7 DOT 8090403 AT familiehaase DOT de>
MIME-Version: 1.0

On Mon, 22 Aug 2005, Gerrit P. Haase wrote:

> Igor Pechtchanski wrote:
>
> > On Sun, 21 Aug 2005, Igor Pechtchanski wrote:
> >
> >
> > > I'm trying to make sure our perl program works with text mounts.  In the
> > > course of the testing, one weird problem cropped up: binmode seems to
> > > have no effect on STDOUT when redirecting to a file on a text mount.
> > >
> > > The following consistently reproduces the problem for me:
> > >
> > > $ mount -m | grep text
> > > mount -f -u -t "c:/cygwin/tmp/text" "/tmp/text"
> > > $ cd /tmp/text
> > > $ /usr/bin/perl -e 'binmode(STDOUT);print "\n"' > PT
> > > $ od -c PT
> > > 0000000  \r  \n
> > > 0000002
> > > $
> > >
> > > I've tried various combinations of ":raw", ":perlio", etc, both directly
> > > and through the PERLIO variable, with no success.  The strace output
> > > (available upon request) seems to show that the handle is successfully
> > > set to binary mode, but that the write still happens in text mode.
> > >
> > > Can anyone else reproduce this?  Is there a way I can force binary mode
> > > on STDOUT in Perl?
> >
> >
> > On second thought, this probably has to do with *how* Perl sets binmode on
> > STDOUT.  The shells (I tried ash, bash, tcsh) don't seem to honor it.
> >
> > BTW, the code I used is the same as that in /usr/bin/GET.pl and
> > /usr/bin/piconv (both break in the same way on redirection to files on
> > text mounts).
> >
> > I know the shells can honor the O_BINARY specifier on STDOUT, since "cat"
> > uses this (via setmode(1, O_BINARY)).  There must be something that Perl
> > is doing differently.  Any ideas?
>
> I believe that this was discussed before, evtually a bug report was already
> filed.  I think the problem is the redirection, here is the
> shell involved.  Please search the archives (and send me a link when
> you have found it).

Here's the thread, with a nearly identical subject:
<http://cygwin.com/ml/cygwin/2004-11/msg00131.html>.  The conclusion was
that someone has to report this as a perl bug.  Apparently, nobody did.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
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