Bug 74800 - freopen() fails with SIGSEGV when linking with libstdc++-2.96
Summary: freopen() fails with SIGSEGV when linking with libstdc++-2.96
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 8.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-10-01 19:45 UTC by Steffen Persvold
Modified: 2016-11-24 14:56 UTC (History)
5 users (show)

Fixed In Version: 2.3-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-05 16:11:22 UTC
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 19:46 UTC, Steffen Persvold
no flags Details
workaround with g++(2.96) and with no guarantees..(freopen SEGV) (580 bytes, text/plain)
2003-03-26 17:31 UTC, Vamsi Nukala
no flags Details

Description Steffen Persvold 2002-10-01 19:45:11 UTC
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 19:46:30 UTC
Created attachment 77884 [details]
Test application

Comment 2 Vamsi Nukala 2003-03-26 17:31:42 UTC
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 16:11:22 UTC
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.