ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:103490] [Ruby master Bug#17809] Ruby 2.6.7 backported C99 code that breaks older compilers
@ 2021-04-16 21:46 tsmith84
  2021-04-19  1:00 ` [ruby-core:103509] " nobu
  2021-04-20 16:42 ` [ruby-core:103525] " merch-redmine
  0 siblings, 2 replies; 3+ messages in thread
From: tsmith84 @ 2021-04-16 21:46 UTC (permalink / raw)
  To: ruby-core

Issue #17809 has been reported by tas50 (Tim Smith).

----------------------------------------
Bug #17809: Ruby 2.6.7 backported C99 code that breaks older compilers
https://bugs.ruby-lang.org/issues/17809

* Author: tas50 (Tim Smith)
* Status: Open
* Priority: Normal
* ruby -v: 2.6.7
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
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....`
```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:103509] [Ruby master Bug#17809] Ruby 2.6.7 backported C99 code that breaks older compilers
  2021-04-16 21:46 [ruby-core:103490] [Ruby master Bug#17809] Ruby 2.6.7 backported C99 code that breaks older compilers tsmith84
@ 2021-04-19  1:00 ` nobu
  2021-04-20 16:42 ` [ruby-core:103525] " merch-redmine
  1 sibling, 0 replies; 3+ messages in thread
From: nobu @ 2021-04-19  1:00 UTC (permalink / raw)
  To: ruby-core

Issue #17809 has been updated by nobu (Nobuyoshi Nakada).

Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONTNEED

Is this only?

```diff
diff --git a/hash.c b/hash.c
index 63b228f501e..f6555a09dd4 100644
--- a/hash.c
+++ b/hash.c
@@ -6115,10 +6115,10 @@ env_invert(VALUE _)
 static void
 keylist_delete(VALUE keys, VALUE key)
 {
-    long keylen, elen;
+    long keylen, elen, i;
     const char *keyptr, *eptr;
     RSTRING_GETMEM(key, keyptr, keylen);
-    for (long i=0; i<RARRAY_LEN(keys); i++) {
+    for (i=0; i<RARRAY_LEN(keys); i++) {
         VALUE e = RARRAY_AREF(keys, i);
         RSTRING_GETMEM(e, eptr, elen);
         if (elen != keylen) continue;
```

----------------------------------------
Bug #17809: Ruby 2.6.7 backported C99 code that breaks older compilers
https://bugs.ruby-lang.org/issues/17809#change-91607

* Author: tas50 (Tim Smith)
* Status: Open
* Priority: Normal
* ruby -v: 2.6.7
* Backport: 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONTNEED
----------------------------------------
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....`
```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [ruby-core:103525] [Ruby master Bug#17809] Ruby 2.6.7 backported C99 code that breaks older compilers
  2021-04-16 21:46 [ruby-core:103490] [Ruby master Bug#17809] Ruby 2.6.7 backported C99 code that breaks older compilers tsmith84
  2021-04-19  1:00 ` [ruby-core:103509] " nobu
@ 2021-04-20 16:42 ` merch-redmine
  1 sibling, 0 replies; 3+ messages in thread
From: merch-redmine @ 2021-04-20 16:42 UTC (permalink / raw)
  To: ruby-core

Issue #17809 has been updated by jeremyevans0 (Jeremy Evans).

Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONTNEED to 2.6: REQUIRED, 2.7: DONTNEED, 3.0: DONTNEED
Status changed from Open to Closed

I think this is only required for 2.6, since we switched to C99 before 2.7, so I've updated the backport field.

----------------------------------------
Bug #17809: Ruby 2.6.7 backported C99 code that breaks older compilers
https://bugs.ruby-lang.org/issues/17809#change-91625

* Author: tas50 (Tim Smith)
* Status: Closed
* Priority: Normal
* ruby -v: 2.6.7
* Backport: 2.6: REQUIRED, 2.7: DONTNEED, 3.0: DONTNEED
----------------------------------------
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....`
```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-20 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 21:46 [ruby-core:103490] [Ruby master Bug#17809] Ruby 2.6.7 backported C99 code that breaks older compilers tsmith84
2021-04-19  1:00 ` [ruby-core:103509] " nobu
2021-04-20 16:42 ` [ruby-core:103525] " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).