Bug 232953

Summary: mail/opendkim does not compile with lua > 5.2. Patch included.
Product: Ports & Packages Reporter: pr
Component: Individual Port(s)Assignee: Steve Wills <swills>
Status: Closed FIXED    
Severity: Affects Some People CC: freebsd-ports, milios
Priority: --- Flags: bugzilla: maintainer-feedback? (freebsd-ports)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patches mail/opendkim to depend on lua 5.1 or 5.2
none
patch which marks port broken with lua53
freebsd-ports: maintainer-approval+
svn diff from /usr/ports
none
patch to fix build with lua52 and lua53 swills: maintainer-approval? (freebsd-ports), koobs: maintainer-approval+

Description pr 2018-11-04 11:01:03 UTC
Created attachment 198932 [details]
Patches mail/opendkim to depend on lua 5.1 or 5.2

opendkim depends on lua (any version) but it does not compile with lua > 5.2, so if you set default lua version to, say, 5.3 the port breaks:
cc -DHAVE_CONFIG_H -I. -I..  -I./../libopendkim -I/usr/include -I/usr/local/include/lua53 -DCONFIG_BASE=\"/usr/local/etc\"  -O2 -pipe  -fstack-protector -fno-strict-aliasing -MT miltertest-miltertest.o -MD -MP -MF .deps/miltertest-miltertest.Tpo -c -o miltertest-miltertest.o `test -f 'miltertest.c' || echo './'`miltertest.c
miltertest.c:4016:2: warning: implicit declaration of function 'luaL_register' is invalid in C99 [-Wimplicit-function-declaration]
        luaL_register(l, "mt", mt_library);
        ^
miltertest.c:4171:54: error: too few arguments to function call, expected 5, have 4
                         script == NULL ? "(stdin)" : script))
                                                            ^
/usr/local/include/lua53/lua.h:280:1: note: 'lua_load' declared here
LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
^
/usr/local/include/lua53/luaconf.h:254:18: note: expanded from macro 'LUA_API'
#define LUA_API         extern
                        ^
1 warning and 1 error generated.
*** Error code 1

Stop.
make[3]: stopped in /wrkdirs/usr/ports/mail/opendkim/work/opendkim-2.10.3/miltertest
*** Error code 1

Stop.
make[2]: stopped in /wrkdirs/usr/ports/mail/opendkim/work/opendkim-2.10.3
*** Error code 1

Stop.
make[1]: stopped in /wrkdirs/usr/ports/mail/opendkim/work/opendkim-2.10.3
*** Error code 1

Stop.
make: stopped in /usr/ports/mail/opendkim


Note that the port relays on default lua version:
OPTIONS_DEFAULT=       FILTER LUA UNBOUND

The attached patch addresses the issue.
Comment 1 Steve Wills freebsd_committer freebsd_triage 2018-11-23 16:49:21 UTC
Created attachment 199487 [details]
patch which marks port broken with lua53

I'm not sure the syntax of that patch is correct and I think it would be better to not change the default options.

We can't disable the lua option in the lua 5.3 case because we can't check the lua version without enabling the lua option, as far as I know.

So, here's an updated patch which just marks the port broken in the Lua 5.3 case. Users who have changed their default Lua version can change the option for this port.
Comment 2 Daniel Austin 2018-11-23 18:07:55 UTC
Comment on attachment 199487 [details]
patch which marks port broken with lua53

Looks good to me :)
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-11-23 20:18:28 UTC
A commit references this bug:

Author: swills
Date: Fri Nov 23 20:17:42 UTC 2018
New revision: 485703
URL: https://svnweb.freebsd.org/changeset/ports/485703

Log:
  mail/opendkim: mark broken with Lua 5.3 and higher

  PR:		232953
  Reported by:	pr@aoek.com
  Approved by:	Daniel Austin <freebsd-ports@dan.me.uk> (maintainer)

Changes:
  head/mail/opendkim/Makefile
Comment 4 Steve Wills freebsd_committer freebsd_triage 2018-11-23 20:20:39 UTC
Committed, thanks!
Comment 5 Chad Jacob Milios 2018-11-27 23:13:24 UTC
Created attachment 199619 [details]
svn diff from /usr/ports

This fixes the problem rather than forbids lua53. been using successfully for over a year. muh bad not sharing
Comment 6 Steve Wills freebsd_committer freebsd_triage 2018-11-28 01:42:09 UTC
Re-opening
Comment 7 Chad Jacob Milios 2018-11-28 03:25:42 UTC
ok i see why i didnt share this now. there's calls to lua_dump() in the patch im using which change the signature to a lua53-only call. u probably already figured that out by now. i look forward to the more general solution from a better ninja
Comment 8 Steve Wills freebsd_committer freebsd_triage 2018-12-09 05:06:05 UTC
Created attachment 199968 [details]
patch to fix build with lua52 and lua53

This seems to build with both lua52 and lua53. Please test.
Comment 9 Chad Jacob Milios 2018-12-09 16:28:57 UTC
Comment on attachment 199968 [details]
patch to fix build with lua52 and lua53

awesome! thanks. i didnt know the right c pre processor syntax to use (i know, how have i possibly made it to 37 years?). havent had a chance to test this yet but i dont have any doubt that youve got this all set now. i only use 11.2-RELEASE/amd64 w/ lua53 so my testing will be limited. my further silence then means that as of tonight [or no later than tomorrow] this will be working perfectly for me as well.
Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2018-12-17 04:14:07 UTC
Comment on attachment 199487 [details]
patch which marks port broken with lua53

This patch was committed (thus not obsolete)
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2018-12-17 04:16:42 UTC
Comment on attachment 199968 [details]
patch to fix build with lua52 and lua53

Approved by: portmgr (blanket: build/package/run fix)
Comment 12 commit-hook freebsd_committer freebsd_triage 2018-12-31 20:51:37 UTC
A commit references this bug:

Author: swills
Date: Mon Dec 31 20:51:17 UTC 2018
New revision: 488837
URL: https://svnweb.freebsd.org/changeset/ports/488837

Log:
  mail/opendkim: fix build with lua52 and lua53

  PR:		232953
  Submitted by:	Chad Jacob Milios <milios@ccsys.com> (with slight changes)
  Reported by:	pr@aoek.com
  Approved by:	maintainer timeout (freebsd-ports@dan.me.uk, >2 weeks)

Changes:
  head/mail/opendkim/Makefile
  head/mail/opendkim/distinfo
  head/mail/opendkim/files/patch-miltertest_miltertest.c
  head/mail/opendkim/files/patch-opendkim_opendkim-lua.c
Comment 13 Steve Wills freebsd_committer freebsd_triage 2018-12-31 20:53:11 UTC
Committed, thanks!