public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/10097: filebuf::underflow drops characters.
@ 2003-03-25 19:56 paolo
0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2003-03-25 19:56 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, paolo, peturr02
Synopsis: filebuf::underflow drops characters.
State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Tue Mar 25 19:55:00 2003
State-Changed-Why:
Fixed for 3.3 and 3.4.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10097
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: libstdc++/10097: filebuf::underflow drops characters.
@ 2003-03-15 18:46 Pétur Runólfsson
0 siblings, 0 replies; 4+ messages in thread
From: Pétur Runólfsson @ 2003-03-15 18:46 UTC (permalink / raw)
To: paolo; +Cc: gcc-prs
The following reply was made to PR libstdc++/10097; it has been noted by GNATS.
From: =?iso-8859-1?Q?P=E9tur_Run=F3lfsson?= <peturr02@ru.is>
To: <paolo@gcc.gnu.org>,
<gcc-bugs@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>,
<nobody@gcc.gnu.org>,
=?iso-8859-1?Q?P=E9tur_Run=F3lfsson?= <peturr02@ru.is>,
<gcc-gnats@gcc.gnu.org>
Cc:
Subject: RE: libstdc++/10097: filebuf::underflow drops characters.
Date: Sat, 15 Mar 2003 18:36:18 -0000
> Confirmed. P=E9tur, looks like this makes for a good testcase
> for your suggestion to add:
> =20
> if (gptr() < egptr())
> return *gptr();
> =20
> on top of underflow, right?
Yes.
Petur
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++/10097: filebuf::underflow drops characters.
@ 2003-03-15 18:27 paolo
0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2003-03-15 18:27 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, paolo, peturr02
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
Synopsis: filebuf::underflow drops characters.
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sat Mar 15 18:27:55 2003
Responsible-Changed-Why:
Analyzing.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sat Mar 15 18:27:55 2003
State-Changed-Why:
Confirmed. Pétur, looks like this makes for a good testcase
for your suggestion to add:
if (gptr() < egptr())
return *gptr();
on top of underflow, right?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10097
^ permalink raw reply [flat|nested] 4+ messages in thread
* libstdc++/10097: filebuf::underflow drops characters.
@ 2003-03-15 10:56 peturr02
0 siblings, 0 replies; 4+ messages in thread
From: peturr02 @ 2003-03-15 10:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 10097
>Category: libstdc++
>Synopsis: filebuf::underflow drops characters.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 15 10:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: peturr02@ru.is
>Release: gcc-3.2.2
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
filebuf::underflow discards characters that are already in the buffer, this causes those characters to be lost when reading from a pipe.
>How-To-Repeat:
See attachment.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="showmanycbug.cc"
Content-Disposition: inline; filename="showmanycbug.cc"
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fstream>
#undef NDEBUG
#include <cassert>
class Buf : public std::filebuf
{
public:
int_type pub_underflow()
{ return underflow(); }
std::streamsize pub_showmanyc()
{ return showmanyc(); }
};
int main()
{
using namespace std;
signal(SIGPIPE, SIG_IGN);
unlink("xxx");
if (0 != mkfifo("xxx", S_IRWXU))
{
assert(false);
}
int fval = fork();
if (fval == -1)
{
unlink("xxx");
assert(false);
}
else if (fval == 0)
{
filebuf fbout;
fbout.open("xxx", ios_base::out);
fbout.sputn("0123456789", 10);
fbout.pubsync();
sleep(2);
fbout.close();
exit(0);
}
Buf fb;
fb.open("xxx", ios_base::in);
sleep(1);
fb.sgetc();
streamsize n = fb.pub_showmanyc();
while (n > 0)
{
--n;
Buf::int_type c = fb.pub_underflow();
assert(c != Buf::traits_type::eof());
fb.sbumpc();
}
fb.close();
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-03-25 19:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-25 19:56 libstdc++/10097: filebuf::underflow drops characters paolo
-- strict thread matches above, loose matches on Subject: below --
2003-03-15 18:46 Pétur Runólfsson
2003-03-15 18:27 paolo
2003-03-15 10:56 peturr02
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).