Project

General

Profile

Actions

Bug #18235

closed

try_var in mkmf.rb recognizes a variable that is not declared

Added by ReiOdaira (Rei Odaira) about 3 years ago. Updated about 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-09-30T14:50:31Z master 529fc204af) [powerpc-aix7.2.0]
[ruby-core:105520]

Description

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,

Actions

Also available in: Atom PDF

Like0
Like0