public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Paolo Carlini <pcarlini@unitus.it>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: [Fwd: Re: libstdc++/8504: ios::app + pipes]
Date: Fri, 22 Nov 2002 16:15:00 -0000	[thread overview]
Message-ID: <20021118143607.15299.qmail@sources.redhat.com> (raw)

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
 
 


                 reply	other threads:[~2002-11-18 14:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021118143607.15299.qmail@sources.redhat.com \
    --to=pcarlini@unitus.it \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /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).