Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 74800 - freopen() fails with SIGSEGV when linking with libstdc++-2.96
freopen() fails with SIGSEGV when linking with libstdc++-2.96
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2002-10-01 15:45 EDT by Steffen Persvold
Modified: 2016-11-24 09:56 EST (History)
5 users (show)

See Also:
Fixed In Version: 2.3-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-05 12:11:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test application (279 bytes, text/plain)
2002-10-01 15:46 EDT, Steffen Persvold
no flags Details
workaround with g++(2.96) and with no guarantees..(freopen SEGV) (580 bytes, text/plain)
2003-03-26 12:31 EST, Vamsi Nukala
no flags Details

  None (edit)
Description Steffen Persvold 2002-10-01 15:45:11 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513

Description of problem:
When compiling and linking an example application on a gcc-2.96 (or earlier)
platform (e.g RH 7.3), and then running it on a RH-8.0 platform, freopen() fails
with SIGSEGV in freopen.c:71. The reason is that the stdout and stderr objects
doesn't have the _wide_data field initialized (i.e it is NULL).

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile and link test program with g++ on a gcc-2.96 platform
2. Run test program on a RH 8.0 platform

Actual Results:  Application is terminated with SIGSEGV at freopen.c line 71

Expected Results:  Normal termination

Additional info:

The SIGSEGV can be avoided if the application is not linked with libstdc++, or
if libc is linked explicitly before libstdc++ like this :

# g++ -O2 -c freopentst.cpp
# gcc freopentst.o -lc -lstdc++
Comment 1 Steffen Persvold 2002-10-01 15:46:30 EDT
Created attachment 77884 [details]
Test application
Comment 2 Vamsi Nukala 2003-03-26 12:31:42 EST
Created attachment 90727 [details]
workaround with g++(2.96) and with no guarantees..(freopen SEGV)

I am not sure if this is a reliable workaround, since std{in,out,err} are
#defined macros on majority of OSes. 

Compiled on RH7.3 and executed on RH8.0: Worked fine. 

We really need a solution to tell the customer to fetch/upgrade a package
before running our product.
Comment 3 Jakub Jelinek 2003-08-05 12:11:22 EDT
Should be fixed in glibc-2.3-1 and later.

Note You need to log in before you can comment on or make changes to this bug.