From nobody Sat Jun 25 14:29:41 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F344986651A; Sat, 25 Jun 2022 14:29:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LVbwj6Tqpz4XbV; Sat, 25 Jun 2022 14:29:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656167381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZI6sIup0/gke+uTBFbZuqGgbm/D5h5GORu+ivuLG+qU=; b=EVyF6M06F4SO8s+JpOB+Klj42RcMC0rY0MSmEkPO1b5vYv4qdS9x8YM74qJ00jTuPlhjOQ o92ziSQn5ySNjcynTObLBKOCtE2ANZ1WGIgc14q0P6c2f7SGwXDsaych5u0GIO/mnCf+29 sx8Oo4Fb48WX6BiZaQJL4ruyfFiuceGJKGh25KyhjCWjEr295hE7Ebmmvm37QmV4YzUfFz lJwKlpUM+y/97YdRmbehFGa9fCMOd+JqKV5j6Bd8EKINK80kubtAqDeSnMlfeMcMjrvCPc 5RAoyfCmimRNhZ2rmp9+gzoGFdFS+wgr2v4MKINfpMeamprTl9MED9500PnNsA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA11B25DCE; Sat, 25 Jun 2022 14:29:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25PETfo2022950; Sat, 25 Jun 2022 14:29:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25PETfjT022949; Sat, 25 Jun 2022 14:29:41 GMT (envelope-from git) Date: Sat, 25 Jun 2022 14:29:41 GMT Message-Id: <202206251429.25PETfjT022949@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 4f055dad0314 - main - games/xnethack: fix behaviour with mismatched lua version List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f055dad0314f34264ccc320846b49340bd27dd0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656167381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZI6sIup0/gke+uTBFbZuqGgbm/D5h5GORu+ivuLG+qU=; b=gROdgs83tr8V4PWAUKQccg2FrCxId8L9srDh4d/sPTES3yKXSx3G6+DYljvFHC0iZFT3ws KycgafCUfhNjoU5k7lTISWPepOVnuDNCakDlXPneoZXk2tuC7vg8CsXsx/I6YPeK1d6pzP 1sc86gkxBpbXK1rvtlkEPCZULYvWBazl6FueP5PdDGUjt+uLS26qKxCX53n0LxULHoO5q/ 5KYMX3MkpxKRUeaF4oXfDZZlA9VePZrae+1tRhGNgIWbZK+bpFlhzpJ//NGlhTfBvJcyZ2 iMg0nVMwot2FKQ+cB5YYJKkkc8zjvbW//jlVc2uNZd47fnwpu4rgZma5IQsE8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656167381; a=rsa-sha256; cv=none; b=PhUQlFDNxyTJwz7y8JiFxuq3jtQIah8MC/nP6a1kFDTatO2yPRM4WI4d/pp3vtpfuTtfeU ZGlcX3+KxOCj2SS48nKXiyJS30uy/9d7hGNOgglM2uQPc7lw7j/s29Wu5TU8VMcOeOVg4e 3Rs4jRgdCXyAYMAQTX6g8ZQmuM4iR5FC8EzHvck76QjKxBtPFsnQtEYq4VU0WLfq1M//R/ heVc7ZP0GFR7PujoD8iPJ3WM1eJ26SuscTCtA7KYzA3UIkkqy/iBN7NCRBhBn5hjX2tsHM 0/6W0gJVYZsj/x+JJeHZc3gaW0fy2vbXQptGLGkkS2pZ0E6mW8EJ/iTbJisY9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/ports/commit/?id=4f055dad0314f34264ccc320846b49340bd27dd0 commit 4f055dad0314f34264ccc320846b49340bd27dd0 Author: Robert Clausecker AuthorDate: 2022-06-25 04:58:18 +0000 Commit: Li-Wen Hsu CommitDate: 2022-06-25 14:28:19 +0000 games/xnethack: fix behaviour with mismatched lua version The latest version of the package has introduced a "lua sandbox" that comes with a version check against the bundled lua version. As we unbundle lua, we cannot ensure that this version check succeeds. Removal of the version check allows us to build a working binary, but it is uncertain if there are any residual effects from the version mismatch. To rule out that possibility, the sandbox code is left disabled by default but can be enabled if desired through the SANDBOX option. PR: 264882 --- games/xnethack/Makefile | 9 ++++++- games/xnethack/files/patch-include-config.h | 9 +++++++ games/xnethack/files/patch-src_nhlua.c | 40 +++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/games/xnethack/Makefile b/games/xnethack/Makefile index b5665934f18e..7f621cab17ae 100644 --- a/games/xnethack/Makefile +++ b/games/xnethack/Makefile @@ -1,6 +1,7 @@ PORTNAME= xNetHack DISTVERSIONPREFIX= xnh DISTVERSION= 7.1 +PORTREVISION= 1 CATEGORIES= games MAINTAINER= fuz@fuz.su @@ -49,7 +50,13 @@ GRAPHICS= QT_GRAPHICS CFLAGS+= -DNOMAIL -DCURSES_GRAPHICS -OPTIONS_DEFINE= DOCS +# nhlua.c has a (patched out) version check for lua when the sandbox +# is used. As I cannot ascertain whether using the system's different +# lua version could cause problems, I'll leave the sandbox disabled by +# default. +OPTIONS_DEFINE= DOCS SANDBOX +SANDBOX_DESC= Run lua in a sandbox (untested) +SANDBOX_CFLAGS= -DNHL_SANDBOX .include diff --git a/games/xnethack/files/patch-include-config.h b/games/xnethack/files/patch-include-config.h index 26f78d8821aa..8be26e04924d 100644 --- a/games/xnethack/files/patch-include-config.h +++ b/games/xnethack/files/patch-include-config.h @@ -34,3 +34,12 @@ /* DUMPLOG_FILE allows following placeholders: %% literal '%' %v version (eg. "3.6.3-0") +@@ -697,7 +697,7 @@ typedef unsigned char uchar; + + /* TEMPORARY - MAKE UNCONDITIONAL BEFORE RELEASE */ + /* undef this to check if sandbox breaks something */ +-#define NHL_SANDBOX ++/* #define NHL_SANDBOX */ + + /* End of Section 4 */ + diff --git a/games/xnethack/files/patch-src_nhlua.c b/games/xnethack/files/patch-src_nhlua.c new file mode 100644 index 000000000000..4df225a11834 --- /dev/null +++ b/games/xnethack/files/patch-src_nhlua.c @@ -0,0 +1,40 @@ +As we unbundle lua, we cannot ensure that this version check succeeds. +Removal of the version check allows us to build a working binary, but +it is uncertain if there are any residual effects from the version +mismatch. + +To rule out that possibility, the sandbox code is left disabled by +default but can be enabled if desired through the SANDBOX option. + +--- src/nhlua.c.orig 2022-06-25 04:31:43 UTC ++++ src/nhlua.c +@@ -1652,20 +1652,6 @@ DISABLE_WARNING_CONDEXPR_IS_CONSTANT + lua_State * + nhl_init(nhl_sandbox_info *sbi) + { +- /* It would be nice to import EXPECTED from each build system. XXX */ +- /* And it would be nice to do it only once, but it's cheap. */ +-#ifndef NHL_VERSION_EXPECTED +-#define NHL_VERSION_EXPECTED 50404 +-#endif +- +-#ifdef NHL_SANDBOX +- if(NHL_VERSION_EXPECTED != LUA_VERSION_RELEASE_NUM){ +- panic( +- "sandbox doesn't know this Lua version: this=%d != expected=%d ", +- LUA_VERSION_RELEASE_NUM, NHL_VERSION_EXPECTED); +- } +-#endif +- + lua_State *L = nhlL_newstate(sbi); + + iflags.in_lua = TRUE; +@@ -2348,7 +2334,7 @@ nhlL_newstate (nhl_sandbox_info *sbi) { + } + + lua_State *L = lua_newstate(nhl_alloc, nud); +-#if LUA_VERSION_NUM == 503 ++#ifndef luai_likely + # define luai_likely(x) (x) + #endif + if (luai_likely(L)) {