Bug 74800

Summary: freopen() fails with SIGSEGV when linking with libstdc++-2.96
Product: [Retired] Red Hat Linux Reporter: Steffen Persvold <sp>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: chris.ricker, fweimer, kevin, pwatson, vamsi.nukala
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 2.3-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-05 16:11:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test application
none
workaround with g++(2.96) and with no guarantees..(freopen SEGV) none

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):
compat-libstdc++-7.3-2.96.110

How reproducible:
Always

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.