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: 1.5.24: data corruption problem with popen and gzip on a text mounted filesystem

Eric Blake <ebb9 <at>> writes:

> Hugh Secker-Walker <hugh <at>> 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.


Unsubscribe info:
Problem reports:

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