From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id J+kuCXpzsV9NAgAA0tVLHw (envelope-from ) for ; Sun, 15 Nov 2020 18:29:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id uMKFBHpzsV/0SgAA1q6Kng (envelope-from ) for ; Sun, 15 Nov 2020 18:29:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 277E59405D0 for ; Sun, 15 Nov 2020 18:29:13 +0000 (UTC) Received: from localhost ([::1]:37436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keMly-000362-Sg for larch@yhetil.org; Sun, 15 Nov 2020 13:29:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keMlr-00035k-1w for bug-guix@gnu.org; Sun, 15 Nov 2020 13:29:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1keMlq-0006MD-P7 for bug-guix@gnu.org; Sun, 15 Nov 2020 13:29:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1keMlq-0001k6-Li for bug-guix@gnu.org; Sun, 15 Nov 2020 13:29:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#44662: Lua search paths Resent-From: raingloom Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 15 Nov 2020 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44662 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 44662@debbugs.gnu.org X-Debbugs-Original-To: Guix Bugs Received: via spool by submit@debbugs.gnu.org id=B.16054649386673 (code B ref -1); Sun, 15 Nov 2020 18:29:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Nov 2020 18:28:58 +0000 Received: from localhost ([127.0.0.1]:54145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1keMlm-0001jY-7W for submit@debbugs.gnu.org; Sun, 15 Nov 2020 13:28:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:54424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1keMlh-0001jN-VZ for submit@debbugs.gnu.org; Sun, 15 Nov 2020 13:28:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keMlh-00033K-Pn for bug-guix@gnu.org; Sun, 15 Nov 2020 13:28:53 -0500 Received: from mx1.riseup.net ([198.252.153.129]:50906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keMlf-0006FF-Fs for bug-guix@gnu.org; Sun, 15 Nov 2020 13:28:53 -0500 Received: from capuchin.riseup.net (capuchin-pn.riseup.net [10.0.1.176]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4CZ11R4gt6zFdLq for ; Sun, 15 Nov 2020 10:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1605464923; bh=9/WT3W/T3et1SiHlf3wtF2jwClPljhIqyo5IUru/Iak=; h=Date:From:To:Subject:From; b=S3rHOlHiCRFuHPQRBvikOPbm9ctJf2JTfDB6/nXzTSRKiS/TRNZP0WCIhU80xawNe pH4V/tt96aVakKPdlIi2qTf/GWMpboihlXDXyvcF0D/4/6hZb8DEUF4KN8j9jQCw6f ZEj9pwkWE2AqCACZYFNQxPlpYNHdutHMWG19Fh0s= X-Riseup-User-ID: 789E0E0279DA6F68E23422F231FAEF6FB22A7D5A544FD981292EEB944FCF6168 Received: from [127.0.0.1] (localhost [127.0.0.1]) by capuchin.riseup.net (Postfix) with ESMTPSA id 4CZ11Q6PRsz8stX for ; Sun, 15 Nov 2020 10:28:32 -0800 (PST) Date: Sun, 15 Nov 2020 19:24:41 +0100 From: raingloom Message-ID: <20201115192441.0af831a5@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=198.252.153.129; envelope-from=raingloom@riseup.net; helo=mx1.riseup.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/15 13:28:45 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.4 (--) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=riseup.net header.s=squak header.b=S3rHOlHi; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: v22YO0ByqYvC I have a very WIP branch adding search paths to Lua. https://git.sr.ht/~raingloom/guix-source/tree/raingloom/lua The problem is that Lua uses a different path format compared to most packages. Instead of a list of directories, it is a list of path patterns, each potentially containing a question mark ('?'), which gets substituted for the module being searched. For pure Lua modules, this basically means /lib/lua/5.3/?.lua and /lib/lua/5.3/?/init.lua. I am not aware of any practical use of paths that do not contain a '?', so there is a relatively easy solution here: use the string.gsub function to expand every path component that does not contain a '?' into two components, the ?.lua and the ?/init.lua one. This means externally defined components are not expanded, only the ones defined by Guix. For C modules, it's a bit trickier, because there is a special component that looks into loadall.so, which I must admit I'm not familiar with. As far as I know, popular modules all define their own shared object file, never a loadall.so. Also, the path is separated by semicolons, not colons, but I think Guix can already handle that. The approaches I see: - patch loadlib.c in Lua to expand LUA_PATH and LUA_CPATH according to the above mentioned heuristics, or - patch Guix to support paths of this format - define something like GUIX_LUA_PATH that gets expanded on its own and only contains Lua modules defined in Guix, and then gets appended to package.path (and do the same for package.path) Solving this would open up access to the huge variety of Lua modules and make things like game development in L=C3=96VE much better integrated. Its users could even use `guix pack` to distribute their games.