Bug 1204129
Summary: | Enable compatibility with lua 5.2 | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Kalev Lember <kalevlember> | ||||
Component: | lua | Assignee: | Tim Niemueller <tim> | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 22 | CC: | athmanem, michel, tcallawa, thomas.moschny, tim | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | cardpeek-0.8.4-1.fc22 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2015-03-23 07:08:13 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Kalev Lember
2015-03-20 12:55:07 UTC
Created attachment 1004480 [details]
[PATCH] Define LUA_COMPAT_5_2 in addition to LUA_COMPAT_5_1
13:58 < kalev> spot: hey, ok to commit the lua patch in https://bugzilla.redhat.com/show_bug.cgi?id=1204129 ? 13:59 < spot> kalev: definitely. cardpeek-0.8.4-1.fc22,lua-5.3.0-2.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/cardpeek-0.8.4-1.fc22,lua-5.3.0-2.fc22 Package cardpeek-0.8.4-1.fc22, lua-5.3.0-2.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing cardpeek-0.8.4-1.fc22 lua-5.3.0-2.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-4397/cardpeek-0.8.4-1.fc22,lua-5.3.0-2.fc22 then log in and leave karma (feedback). cardpeek-0.8.4-1.fc22, lua-5.3.0-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. Now, while compatibility is good, this change creates a problem with code like this: #if LUA_VERSION_NUM >= 503 #define luaL_checkunsigned(L,n) ((lua_Unsigned)luaL_checkinteger(L,n)) #endif throwing a "luaL_checkunsigned" redefined" error. What is the proper way to handle this? Variant 1: #if LUA_VERSION_NUM >= 503 #ifndef LUA_COMPAT_APIINTCASTS #define luaL_checkunsigned(L,n) ((lua_Unsigned)luaL_checkinteger(L,n)) #endif #endif Variant 2: #include <lua.h> #if LUA_VERSION_NUM >= 503 #define LUA_COMPAT_APIINTCASTS #endif #include <lauxlib.h> I am a bit confused. I'll try to answer. lua 5.3 says (in lauxlib.h) /* ** {============================================================ ** Compatibility with deprecated conversions ** ============================================================= */ #if defined(LUA_COMPAT_APIINTCASTS) #define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) ... This means that if Lua is compiled with LUA_COMPAT_APIINTCASTS, you can safely use the deprecated luaL_checkunsigned(L,a) function instead of using the new luaL_checkinteger. Of your two proposed versions, Variant 1 is a correct way to handle this case. Variant 2 is incorrect, because LUA_COMPAT_APIINTCASTS is defined in luaconf.h, so you're asking for trouble. (It also changes lua in ways deeper than the headers.) |