public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/6047: weird behaviour when reading from a pipe through an ifstream
@ 2002-04-09 12:20 bkoz
  0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2002-04-09 12:20 UTC (permalink / raw)
  To: benko, bkoz, gcc-bugs, gcc-prs, nobody

Synopsis: weird behaviour when reading from a pipe through an ifstream

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Tue Apr  9 12:20:24 2002
Responsible-Changed-Why:
    Mine.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6047


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/6047: weird behaviour when reading from a pipe through an ifstream
@ 2002-11-30 20:06 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2002-11-30 20:06 UTC (permalink / raw)
  To: benko, bkoz, gcc-bugs, gcc-prs

Synopsis: weird behaviour when reading from a pipe through an ifstream

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Thu Nov 21 03:47:23 2002
State-Changed-Why:
    Duplicate of libstdc++/5799.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6047


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/6047: weird behaviour when reading from a pipe through an ifstream
@ 2002-11-06 13:53 bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2002-11-06 13:53 UTC (permalink / raw)
  To: benko, bkoz, gcc-bugs, gcc-prs

Synopsis: weird behaviour when reading from a pipe through an ifstream

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Nov  6 13:53:02 2002
State-Changed-Why:
    This behavior still exists with 3.2.1pre and 3.3CVS

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6047


^ permalink raw reply	[flat|nested] 4+ messages in thread

* libstdc++/6047: weird behaviour when reading from a pipe through an ifstream
@ 2002-03-23  1:16 benko
  0 siblings, 0 replies; 4+ messages in thread
From: benko @ 2002-03-23  1:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6047
>Category:       libstdc++
>Synopsis:       weird behaviour when reading from a pipe through an ifstream
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 23 01:16:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Benko Pal
>Release:        3.0.4
>Organization:
>Environment:
i686, SuSE 7.3, glibc 2.2.4
>Description:
When two programs communicate through fifos and handles them
with std::fstreams, then flushing on the writing side does
not make the contents appear on the reading side.  The
reading side only sees the data when the writing buffer is
overrun or the writing side closes the buffer.

A test case:

------------------------------------------
#ifdef WORKAROUND
# include <cstdio>
#endif /* WORKAROUND */
#include <fstream>
#include <iostream>


int
main()
{
#ifdef WORKAROUND
  std::filebuf b(std::fopen("/tmp/pipe", "r"), std::ios_base::in, 1);
  std::istream in(&b);
#else /* ! WORKAROUND */
  std::ifstream in("/tmp/pipe");
#endif /* WORKAROUND */
  char          c;

  while (in.get(c))
    std::cout.put(c);
  
  return 0;
}
-------------------------------------------

In an other shell do

$ rm -f /tmp/pipe 
$ mkfifo /tmp/pipe
$ cat > /tmp/pipe
hallo
world
^D
$ 

If the program above is compiled with 3.0.*, and run, then
"hallo" and "world" appear together, after ^D is pressed in
the writing shell.
Compiling with 2.95.3, "hallo" appears when I hit <enter> in
the writing shell, separately from "world", so this is a
sort of regression.  An equivalent C program behaves like
2.95.3, compiled with either compiler.  This behavior is
very important for me, without this the two programs just
keep waiting for each other.

By defining WORKAROUND I get the expected result, but it's a
bit inconvenient to initialise a stream like this.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-21 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-09 12:20 libstdc++/6047: weird behaviour when reading from a pipe through an ifstream bkoz
  -- strict thread matches above, loose matches on Subject: below --
2002-11-30 20:06 paolo
2002-11-06 13:53 bangerth
2002-03-23  1:16 benko

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