From: "ReiOdaira (Rei Odaira)" Date: 2021-10-01T16:39:26+00:00 Subject: [ruby-core:105520] [Ruby master Bug#18235] try_var in mkmf.rb recognizes a variable that is not declared Issue #18235 has been reported by ReiOdaira (Rei Odaira). ---------------------------------------- Bug #18235: try_var in mkmf.rb recognizes a variable that is not declared https://bugs.ruby-lang.org/issues/18235 * Author: ReiOdaira (Rei Odaira) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.0dev (2021-09-30T14:50:31Z master 529fc204af) [powerpc-aix7.2.0] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- In 524513be399e81bb170ec88aa0d501f33cbde8c3, `try_var` in mkmf.rb has been modified to recognize a variable that exists but is not declared. What was the rationale behind this change? In ext/date/extconf.rb, it checks `have_var("altzone", "time.h", opt)` . Strangely, in AIX, the variable `altzone` is not declared in `time.h` but does exist somewhere in the library. As a result, `extconf.rb` regards `altzone` as a valid variable, but compile fails because it is not declared. I think the library of AIX is weird, but the logic of `try_var` looks as weird to me. I thought the intent of `have_var`/`try_var` was to pre-check whether the compile succeeds if you use the variable, wasn't it? In any case, an ad-hoc solution to this particular issue in the date module is just adding `#if defined(_AIX)` to `ext/date/date_core.c`, but I'm curious if `try_var` could lead to other issues in the future. Thanks, -- https://bugs.ruby-lang.org/ Unsubscribe: