Bug 623119

Summary: __isoc99_sscanf is used regardless of -std option
Product: [Fedora] Fedora Reporter: Stas Sergeev <stsp2>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: fweimer, jakub, schwab
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-11 12:09:36 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:

Description Stas Sergeev 2010-08-11 11:42:20 UTC
Description of problem:
All my programs have suddenly started to use
__isoc99_sscanf@@GLIBC_2.7, making it impossible
to run them on an older systems without recompiling.
The changelog of glibc says:
Redirect to __isoc99_* if strict ISO C99 or POSIX
	conformance requested.
But how to "unrequest" that strict conformance,
other than by defining _GNU_SOURCE? -std=gnu89
doesn't help.

Version-Release number of selected component (if applicable):
glibc-2.12-3.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Compile program with sscanf
2. Try to run it on another system with glibc <2.7
  
Actual results:
/lib/libc.so.6: version `GLIBC_2.7' not found

Expected results:
Program works

Additional info:

Comment 1 Jakub Jelinek 2010-08-11 12:09:36 UTC
glibc never pretended to be forward compatible, so if you want to run on system with older glibc, you should compile/link against the oldest glibc you want to support.

To use the non-standard version of sscanf, you need -D_GNU_SOURCE, or e.g. -D_POSIX_C_SOURCE=199506L, as POSIX 2008 mode is now the default.

Comment 2 Stas Sergeev 2010-08-11 12:28:03 UTC
Yes, I understand the forward-compat is
never guaranteed, but is the use of
__isoc99_sscanf really intentional when
-std=gnu89 is used?

Comment 3 Jakub Jelinek 2010-08-11 12:40:20 UTC
Yes.  -std=gnu89 doesn't have very big influence on the content of glibc headers, all it means is that __STRICT_ANSI__ isn't defined.  The Feature Test Macros is what matters.  And, in case of *scanf, it is actually better if the %ac/%as/%a[ GNU extensions are never used any more, and %mc/%ms/%m[ is used instead.  So, the more __isoc99_*scanf is used, the better.