Bug 116972 - freopen causes SIGSEGV on process exit
freopen causes SIGSEGV on process exit
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: compat-gcc (Show other bugs)
3.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-02-26 17:16 EST by Quentin Armitage
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-11 23:33:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Quentin Armitage 2004-02-26 17:16:10 EST
Description of problem:
With the compat-gcc compiler and libraries, freopen causes a SIGSEGV 
when the process exits (i.e. not at the time of calling freopen, but 
when exit (0) is called.
The problem does not occur when using gcc version 3.2.3.

Source code of fred.c:
======================================================
#include <stdio.h>


main ( int argc, char **argv )
{
        if ( argc > 1 )
        {
                if ( freopen ( argv[1], "r", stdin ) == NULL )
                {
                        fprintf ( stderr, "Unable to open %s\n", argv
[1] ) ;
                        exit ( 2 ) ;
                }
        }
        printf ( "Exitting\n" ) ;
}
==========================================
makefile:
==========================================
CC296=gcc296 -I /usr/lib/i386-redhat-linux7/include -B /usr/lib/i386-
redhat-linux7/lib/ -g

fred:   fred.c

fred296:        fred.c
        $(CC296) -O -o fred296 fred.c
==========================================

Running with the various options produces the following results:
> fred fred.c
Exitting
> fred296 fred.c
Exitting
Segmentation fault
> fred296 <fred.c
Exitting
>


Please note that we need to use the compat-gcc and libraries due to 
using the Informix SDK version 2.81 whose libraries where built on 
RedHat version 7.1 (using the following versions: 1. The Informix 
product was built and tested on Red Hat 7.1 (Linux 2.4.2-5.0-MVFS #3 
SMP i686, Glibc 2.2.2-10) using gcc version  egcs - 2.95.3 20010315.



Version-Release number of selected component (if applicable):
compat-gcc-7.3-2.96.123


How reproducible:
Every time


Steps to Reproduce:
1. Build fred296 with command "make fred296"
2. Execute command "fred fred.c"
3.
  
Actual results:
> fred296 fred.c
Exitting
Segmentation fault

Expected results:
> fred296 fred.c
Exitting


Additional info:
Comment 1 Jakub Jelinek 2004-03-03 07:28:14 EST
The reason seems to be a bug in compat-glibc which doesn't have
STB_WEAK SHN_UNDEF _IO_stdin_used symbol in libc_real.so's .dynsym.
This means that the resulting program is not marked as using glibc 2.1+
libio.
Comment 2 Jakub Jelinek 2004-03-03 11:12:54 EST
Should be fixed in compat-glibc-7.x-2.2.4.32.6.
Comment 3 Jakub Jelinek 2004-03-08 03:34:05 EST
It will be part of RHEL3 Update 2.
Here are the changes:
begin 664 compat-glibc.spec.diff
M+2TM(&-O;7!A="UG;&EB8RYS<&5C+GAX"3(P,#,M,#8M,#,@,#8Z,3`Z-3$N
M,#`P,#`P,#`P("TP-#`P"BLK*R!C;VUP870M9VQI8F,N<W!E8PDR,#`T+3`S
M+3`S(#`V.C,Y.C$S+C`P,#`P,#`P,"`M,#4P,`I`0"`M,2PU("LQ+#4@0$`*
M("5D969I;F4@7W5N<&%C:V%G961?9FEL97-?=&5R;6EN871E7V)U:6QD(#`*
M+25D969I;F4@9VQI8F-R96QE87-E(#(N,BXT+C,R+C4**R5D969I;F4@9VQI
M8F-R96QE87-E(#(N,BXT+C,R+C8*(%-U;6UA<GDZ($-O;7!A=&EB:6QI='D@
M0R!L:6)R87)Y"B!.86UE.B!C;VUP870M9VQI8F,*(%9E<G-I;VXZ(#<N>`I`
M0"`M,C`U+#8@*S(P-2PQ-"!`0"!F;W(@;&EB<&%T:"!I;B`D4E!-7T)524Q$
M7U)/3U0E>U]P<F5F:7A]"B`@(')E861E;&8@+5=S("1L:6)P871H('P@87=K
M("<*("]<+F1Y;G-Y;2XJ(&-O;G1A:6YS+R![('-T87)T/3$@?0H@+UXD+R![
M('-T87)T/3`@?0HK+R`@5T5!2RXJ("!53D0@6UY`72HD+R![(&EF("AS=&%R
M="D@>PHK("!P<FEN="`B+F1A=&$B.R!P<FEN="`B+G=E86L@(B`D.#L@<')I
M;G0@(BYB86QI9VX@."(**R5I9F%R8V@@)7MI>#@V?2!S,SDP('!P8R!S<&%R
M8R!S<&%R8W8Y(`HK("!P<FEN="`B+C1B>71E("(@)#@**R5E;'-E"BL@('!R
M:6YT("(N.&)Y=&4@(B`D.`HK)65N9&EF"BM]('T*("\@(%5.1"`O('L@;F5X
M="!]"B`O0"\@>R!I9B`H<W1A<G0I('L*("`@9FX])#@*0$`@+3(U-RPV("LR
M-C4L.2!`0"!R;2`M<F8@(B124$U?0E5)3$1?4D]/5"(*("5[7W!R969I>'TO
M;&EB+R5[7W1A<F=E=%]C<'5]+7)E9&AA="UL:6YU>#<O)7M?;&EB?2\J+G-O
M"B`*("5C:&%N9V5L;V<**RH@5V5D($UA<B`@,R`R,#`T($IA:W5B($IE;&EN
M96L@/&IA:W5B0')E9&AA="YC;VT^(#<N>"TR+C(N-"XS,BXV"BLM(&%D9"!3
M5$)?5T5!2R!32$Y?54Y$148@7TE/7W-T9&EN7W5S960@=&\@;&EB8U]R96%L
M+G-O("@C,3$V.3<R*0HK"B`J(%1U92!*=6X@(#,@,C`P,R!*86MU8B!*96QI
M;F5K(#QJ86MU8D!R961H870N8V]M/B`W+G@M,BXR+C0N,S(N-0H@+2!U<&1A
1=&4@9&5S8W)I<'1I;VX*(`H`
`
end
Comment 4 John Flanagan 2004-05-11 23:33:36 EDT
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-141.html

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