Bug #18235
closedtry_var in mkmf.rb recognizes a variable that is not declared
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,
Updated by nobu (Nobuyoshi Nakada) about 3 years ago
- Status changed from Open to Closed
Applied in changeset git|ea64e742f5feddbdfb6526cd0a54a9986097a34d.
Revert "mkmf.rb: try linking at try_var" [Bug #18235]
This reverts commit 524513be399e81bb170ec88aa0d501f33cbde8c3,
which can return false positive by existing but unusable symbol,
including functions.