Bug 623119 - __isoc99_sscanf is used regardless of -std option
Summary: __isoc99_sscanf is used regardless of -std option
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Andreas Schwab
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-11 11:42 UTC by Stas Sergeev
Modified: 2017-10-09 13:48 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-11 12:09:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


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