public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* [Fwd: Re: libstdc++/8504: ios::app + pipes]
@ 2002-11-22 16:15 Paolo Carlini
  0 siblings, 0 replies; only message in thread
From: Paolo Carlini @ 2002-11-22 16:15 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/8504; it has been noted by GNATS.

From: Paolo Carlini <pcarlini@unitus.it>
To: gcc-gnats@gcc.gnu.org,  gcc-bugs@gcc.gnu.org,  gcc-prs@gcc.gnu.org, 
 nobody@gcc.gnu.org
Cc:  
Subject: [Fwd: Re: libstdc++/8504: ios::app + pipes]
Date: Mon, 18 Nov 2002 15:31:36 +0100

 Here are some more details.
 
 
 Running my example in the debugger I found that the relevant code in
 source file libstdc++-v3/config/io/basic_file_stdio.cc from gcc 3.2
 looks like:
 
 115   __basic_file<char>* 
 116   __basic_file<char>::open(const char* __name, ios_base::openmode __mode, 
 117 			   int /*__prot*/)
 118   {
   [...]
 128 	if ((_M_cfile = fopen(__name, __c_mode)))
 
 
 In an attempt to reproduce the problem, I've written the following code:
 
 	#include <stdio.h>
 	int main() {
 	    if (!fopen("/tmp/pipe", "a"))
 	        perror("/tmp/pipe");
 	}
 
 
 This code fails on Solaris and IRIX. It succeeds on Linux:
 
 	$ uname -sr
 	SunOS 5.8
 	$ g++ -v
 	Reading specs from 
 /usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.8/3.2/specs
 	Configured with: ../gcc-3.2/configure --prefix=/usr/local/gcc-3.2 
 --with-as=/usr/local/binutils/bin/as --with-ld=/usr/local/binutils/bin/ld
 	Thread model: posix
 	gcc version 3.2
 	$ g++ -g -o foo foo.cc
 	$ ./foo
 	/tmp/pipe: Illegal seek
 	$ 
 
 	$ uname -sr
 	Linux 2.4.18-14
 	$ g++ -v
 	Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
 	Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
 --infodir=/usr/share/info --enable-shared --enable-threads=posix 
 --disable-checking --host=i386-redhat-linux --with-system-zlib 
 --enable-__cxa_atexit
 	Thread model: posix
 	gcc version 3.2 200020903 (Red Hat Linux 8.0 3.2-7)
 	$ g++ -g -o foo foo.cc
 	$ ./foo
 	$ 
 
 So it's really a question of fopen(..., "a") not working on pipes on
 Solaris and IRIX. Somehow gcc 2.95.3 used to work around this issue.
 
 Regards,
 --
 Dimitri
 
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8504
 
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-18 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-22 16:15 [Fwd: Re: libstdc++/8504: ios::app + pipes] Paolo Carlini

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