[Home]

Summary:ASTERISK-26104: Build: A Fedora GLIBC update to 2.22-17 causes a compile failure
Reporter:George Joseph (gjoseph)Labels:
Date Opened:2016-06-09 10:41:25Date Closed:2016-06-10 14:14:46
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:SVN 11.21.2 13.9.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:The Fedora update to GLIBC 2.22-17 change the order of the members in sockaddr_storage.  Unfortunately there are a few places where we use an initializer for ast_sockaddr like '\{ \{ 0, 0 } }' which now fail.

They need to be changed to memsets.
Comments:By: Alexander Traud (traud) 2016-06-10 01:22:18.136-0500

I have not tested this with Fedora, but instead of {{memset}} what happens when you go for just one zero, like the following:{noformat}{ {0,} };{noformat}

By: Richard Mudgett (rmudgett) 2016-06-10 11:57:19.584-0500

Unfortunately doing that still implies knowledge about the layout of the struct for that zero and also that there are sub-structs because of the other curly braces.  Memset is the only portable way to get that struct zero filled because you only have to know the size of the struct.

By: Alexander Traud (traud) 2016-06-10 13:37:31.104-0500

The curlies are because of ast_sockaddr which contains sockaddr_storage (and GCC is complaining about having to init both structs). The Zero is the standard initializer for a C struct. The rest of the Asterisk code does exactly this for ast_sockaddr:{noformat}{ {0,} };{noformat} and was not blamed by this issue here. The problem was this second zero. By the way, peercnt needs {noformat}{ { {0,} } };{noformat} because it is a struct with a struct with a struct.

By: Richard Mudgett (rmudgett) 2016-06-10 14:14:46.422-0500

And you make my point for me.  To use the struct initializer format, you still *need to know* something of the layout for the struct.  With memset() you only need to know the size of the struct.

The ast_sockaddr initializers identified by GCC for the issue were affected by the layout change of the struct in the GLIBC update.

https://gerrit.asterisk.org/#/c/2979/
https://gerrit.asterisk.org/#/c/2980/
https://gerrit.asterisk.org/#/c/2981/

By: Alexander Traud (traud) 2016-06-10 15:08:05.914-0500

You do not need to know the layout of {{sockaddr_storage}}. That is the point of this issue report. The rest of the code uses {noformat}{ {0,} }{noformat}as [recommended|http://www.ex-parrot.com/~chris/random/initialise.html]. If the Asterisk team wants to use memset, please add that to the Asterisk Coding Style Guides.