public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: <cygwin@alanhowells.e4ward.com>
To: cygwin@cygwin.com
Cc: jamesj@motionview3d.com
Subject: Re: Cygwin passes through null writes to other software when redirecting standard input/output (i.e. piping)
Date: Fri, 27 Apr 2012 09:09:00 -0000	[thread overview]
Message-ID: <CAHxe11=BG_h7NcnbiT4pBxQ6jSyezCPtLfYz7+06n9DH7-HN-g@mail.gmail.com> (raw)
In-Reply-To: <020501cd23f2$20f07620$62d16260$@motionview3d.com>

On 26 April 2012 22:18, James Johnston <JamesJ@motionview3d.com> wrote:
> I have "run into an issue with Cygwin".  This is arguably not a bug in
> Cygwin, but in other platform runtime libraries.  Never-the-less, the
> symptoms occur only with Cygwin and not the Windows command prompt.  So,
> from a practical standpoint, Cygwin is "broken."  This is almost certainly
> the same issue mentioned in the "1.7.10->1.7.13 : output from .NET programs
> does not get through pipeline to a visual c++ program" thread started by
> cygwin AT alanhowells.e4ward.com last week.  It's also related to the issue
> I raised over a month ago, titled "Can't reliably redirect standard output
> from C# program in recent Cygwin".

Thank you! It is good to see someone else reproduce this!

<snip>

> I am providing several sample programs that can be compiled in Visual C#
> 2008 / .NET Framework 3.5, or Visual C++ 2008.  They should demonstrate the
> problem 100% of the time on any system, because appropriate Sleep() calls
> are made.

Of course, why didn't I think of using Sleep??

When adding sleep to my test programs, the test where it failed on the
first attempt reliably fails.

I think I hinted at an issue with the VC++ runtime as I proved that
using the Win32 API calls succeeded, but unfortunately didn't follow
that through.

I tested with VC++ 2010 runtime and that still has the issue.

<snip>

Christopher Faylor says
> Nope, it won't always be that because I get what's expected.  I built
> the C++ files using mingw g++.  Although I actually expected the reader
> to honor the null byte, it did not.  Perhaps you are using a different
> version of Windows than I am or a different runtime.

But the point by James is that it is the VC++ runtimes (and .NET
runtimes) that think that a null write is EOF. Other runtimes may not
(e.g. mingw).

I agree with James that the runtimes are probably buggy BUT I also
agree that cygwin should be able to have a handle these scenarios.

I have also found a workaround, by piping through a cygwin command,
you lose the null writes, a good one to use is cat so:

$ ./SenderC | cat | ./ReceiverCPP
$ Got line Hello world!
$ Got end-of-file
<snip>

Unfortunately, this isn't a real workaround unless you remember to use
it all the time.


Alan

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2012-04-27  9:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 21:19 James Johnston
2012-04-27  0:17 ` Christopher Faylor
2012-04-27 14:26   ` James Johnston
2012-04-27 16:28     ` Christopher Faylor
2012-04-27 15:12   ` jojelino
2012-04-27 16:28     ` Christopher Faylor
2012-04-27  9:09 ` cygwin [this message]
2012-04-27 14:41   ` Christopher Faylor
2012-04-27 14:38 ` Corinna Vinschen
2012-04-27 22:38   ` James Johnston
2012-04-28  0:25     ` Daniel Colascione
2012-04-28  5:27       ` Christopher Faylor
2012-04-28 11:20         ` Daniel Colascione
2012-05-09 19:00           ` Linda Walsh
2012-05-09 19:21             ` James Johnston
2012-05-09 20:12               ` Christopher Faylor
2012-05-10 16:28                 ` James Johnston
2012-05-10 16:33                   ` Otto Meta
2012-05-10 17:57                   ` Earnie Boyd
2012-05-10 18:39                     ` Corinna Vinschen
2012-05-11  9:05                       ` Andrey Repin
2012-05-11  3:34                 ` Daniel Colascione
2012-05-11  5:08               ` Linda Walsh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHxe11=BG_h7NcnbiT4pBxQ6jSyezCPtLfYz7+06n9DH7-HN-g@mail.gmail.com' \
    --to=cygwin@alanhowells.e4ward.com \
    --cc=cygwin@cygwin.com \
    --cc=jamesj@motionview3d.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).