delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/07/23/14:02:38

X-Spam-Check-By: sourceware.org
Message-ID: <46A4ED4A.9060303@merl.com>
Date: Mon, 23 Jul 2007 14:02:50 -0400
From: Hugh Secker-Walker <hugh AT merl DOT com>
User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.24: data corruption problem with popen and gzip on a text mounted filesystem
References: <46A4BC14 DOT 1050603 AT merl DOT com>
In-Reply-To: <46A4BC14.1050603@merl.com>
Received-SPF: pass (cambridge.merl.com: domain of hugh AT merl DOT com designates 137.203.134.9 as permitted sender)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Eric Blake <ebb9 <at> byu.net> writes:

 > Hugh Secker-Walker <hugh <at> merl.com> writes:
 >
 > > I'm having trouble getting correct behavior on a third-party OpenSource
 > > project that I'm building using Cygwin.  The problem involves the
 > > writing of corrupt data to a file.  The output file is created and
 > > written via popen("gzip > outputfile", "wb").  The data is fine if the
 > > filesystem is mounted in binary mode.  The data is corrupted if the
 > > filesystem is mounted in text mode.
 >
 > As a workaround, you can force gzip to see stdout in binary mode by 
using an
 > intermediary pipe, as in popen("gzip | cat > outputfile", "wb").

Thank you.  That simple workaround appears to work.

Interestingly, I had tried popen("gzip | dd of=outputfile", "wb") as a
lower-level way to avoid what I guessed was a problem with gzip using
the stdout.  The dd attempt didn't work.  This failure suggests to me
that dd and gzip experience a similar problem in this popen() context,
a problem that cat somehow avoids.

-Hugh



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