Bug 102454 - glibc 2.26 doesn't provide anymore xlocale.h
Summary: glibc 2.26 doesn't provide anymore xlocale.h
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-28 13:39 UTC by Laurent carlier
Modified: 2017-09-04 10:53 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
WIP patch (2.32 KB, patch)
2017-08-31 15:13 UTC, Laurent carlier
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent carlier 2017-08-28 13:39:46 UTC
As stated here: https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27 , glibc 2.26 doesn't provide anymore xlocale.h, so https://cgit.freedesktop.org/mesa/mesa/tree/src/util/strtod.c isn't build properly, and locale could be not properly defined, that could expose unexpected behavior.

See also  https://bugs.archlinux.org/task/55244#comment160599
Comment 1 Emil Velikov 2017-08-29 18:13:31 UTC
The patch in the bug report isn't quite right (aka remove the header and guards all together).

Instead one should add a configure check - AC_LINK_IFELSE() ... which:
 - includes xlocale.h reusing the HAVE_XLOCALE_H guard
 - references strtod_l w/o any guard, setting a macro HAVE_FOO
Then update the code
 - swap the __GNU_SOURCE guards through the file with HAVE_FOO
 - HAVE_XLOCALE_H should guard _only_ the header inclusion
Comment 2 Laurent carlier 2017-08-31 15:13:12 UTC
Created attachment 133909 [details] [review]
WIP patch

Work in progress patch
Comment 3 Emil Velikov 2017-08-31 16:03:47 UTC
The locale_t check does not seem like a good idea.

The struct is used by {new,free}locale API, which pulls locale.h.
Aka the struct may be available, even when strto{f,d}_l is not.
Comment 4 Eric Engestrom 2017-08-31 16:12:32 UTC
(In reply to Laurent carlier from comment #2)
> Created attachment 133909 [details] [review] [review]
> WIP patch
> 
> Work in progress patch

Your patch checks for `locale_t`, but I don't think this is the thing that might be missing; `strtod_l()` is.
I had also started working on this, I just pushed my WIP here:
https://github.com/1ace/mesa  wip/strtod-fix

(quick diff link:)
https://github.com/mesa3d/mesa/compare/master...1ace:wip/strtod-fix

I'm having a couple issues though, I'm on IRC if you want to work together :)
Comment 5 Eric Engestrom 2017-09-04 10:53:44 UTC
Fixed by:

commit 49b428470e28ae6ab22083e43fa41abf622f3b0d
Author: Eric Engestrom <eric.engestrom@imgtec.com>
Date:   Thu Aug 31 16:55:56 2017 +0000

    util: improve compiler guard
    
    Glibc 2.26 has dropped xlocale.h, but the functions needed (strtod_l()
    and strdof_l()) can be found in stdlib.h.
    Improve the detection method to allow newer builds to still make use of
    the locale-setting.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.