Bug #17809
closedRuby 2.6.7 backported C99 code that breaks older compilers
Description
Hey folks,
It looks like the 2.6.7 release inadvertently backported some C99 code from HEAD onto the Ruby 2.6 branch that shouldn't be requiring C99 compilers. This is causing us some pain and failures in our older versions of Chef that use Ruby 2.6 and are built without the C99 flag set on compilers.
Here's the patch we apply the 2.6.7 codebase to remove the C99 code:
https://github.com/chef/omnibus-software/blob/master/config/patches/ruby/ruby-2.6.7_c99.patch
Here's the commit that backported the C99 code:
https://github.com/ruby/ruby/commit/fe85a3d5271c4e3aeda42ec32e9c3f9ee02b6897
The particular line in the commit causing failures:
https://github.com/ruby/ruby/blob/fe85a3d5271c4e3aeda42ec32e9c3f9ee02b6897/hash.c#L5661
The failure we see while compiling:
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
compiling hash.c
compiling load.c
compiling marshal.c
Error:
hash.c: In function 'keylist_delete':
hash.c:5661: error: 'for' loop initial declarations are only allowed in C99 mode
hash.c:5661: note: use option -std=c99 or -std=gnu99 to compile your code
gmake: *** [Makefile:419: hash.o] Error 1
gmake: *** Waiting for unfinished jobs....`