public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21286] New: GNU extension stdio_filebuf problems when reading from pipe
@ 2005-04-29 15:54 ralfixx at gmx dot de
2005-07-18 18:40 ` [Bug libstdc++/21286] [3.4/4.0/4.1 Regression] filebuf::xsgetn vs pipes pcarlini at suse dot de
2005-07-18 18:51 ` pcarlini at suse dot de
0 siblings, 2 replies; 3+ messages in thread
From: ralfixx at gmx dot de @ 2005-04-29 15:54 UTC (permalink / raw)
To: gcc-bugs
Attach stdin (or any other FILE*) to an iostream via the rdbuf() created from a
FILE* by using the GNU extension stdio_filebuf() (see attached C++-File).
Input is just some big file with +11MB:
% wc -c big_file
11601584 big_file
This reads incorrect number of bytes when stdin is a pipe and using an block
size which is not some power of 2. The number of bytes read differs from run to run.
% cat big_file | ./t400 8687
total bytes read 9347072, blocks 1076
% cat big_file | ./t400 8687
total bytes read 978944, blocks 113
% cat big_file | ./t400 8687
total bytes read 8679424, blocks 1000
% cat big_file | ./t400 8687
total bytes read 3424256, blocks 395
% cat big_file | ./t400 8687
total bytes read 11601584, blocks 1336
% cat big_file | ./t400 2048
total bytes read 11601584, blocks 5665
% cat big_file | ./t400 2048
total bytes read 11601584, blocks 5665
No errors when stdin is redirected directly to the file.
% ./t400 8676 < big_file
total bytes read 11601584, blocks 1338
% ./t400 8676 < big_file
total bytes read 11601584, blocks 1338
% ./t400 8676 < big_file
total bytes read 11601584, blocks 1338
% ./t400 8676 < big_file
total bytes read 11601584, blocks 1338
Also no problems when reading in 2048 or 4096 blocks:
% cat big_file | ./t400 2048
total bytes read 11601584, blocks 5665
% cat big_file | ./t400 2048
total bytes read 11601584, blocks 5665
% cat big_file | ./t400 2048
total bytes read 11601584, blocks 5665
% cat big_file | ./t400 4096
total bytes read 11601584, blocks 2833
% cat big_file | ./t400 4096
total bytes read 11601584, blocks 2833
% cat big_file | ./t400 4096
total bytes read 11601584, blocks 2833
Same problem on HP-UX 10.20 with gcc-4.0.0 (and 3.4.3 if it matters).
The same program runs w/o problems in gcc-3.4.1 and gcc-3.3.3 on the same platforms.
I actually had a shell loop trying block sizes from 1 to 10000 to find the
problematic ones, so if 8687 does not reproduce the bug, try the follwoing shell
loop:
i=8000
while test $i -lt 9000 ; do
echo -e "$i: \\c"
cat big_file | ./t400 $i
i=`echo $i+1 | bc`
done
R'
--
Summary: GNU extension stdio_filebuf problems when reading from
pipe
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ralfixx at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21286
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-14 19:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-21286-658@http.gcc.gnu.org/bugzilla/>
2006-04-14 19:31 ` [Bug libstdc++/21286] [3.4/4.0/4.1 Regression] filebuf::xsgetn vs pipes pcarlini at suse dot de
2005-04-29 15:54 [Bug c++/21286] New: GNU extension stdio_filebuf problems when reading from pipe ralfixx at gmx dot de
2005-07-18 18:40 ` [Bug libstdc++/21286] [3.4/4.0/4.1 Regression] filebuf::xsgetn vs pipes pcarlini at suse dot de
2005-07-18 18:51 ` pcarlini at suse dot de
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).