GNU bug report logs

#25425 lua does not set search paths

PackageSource(s)Maintainer(s)
guix PTS Buildd Popcon
Full log

Message #23 received at 25425@debbugs.gnu.org (full text, mbox, reply):

Received: (at 25425) by debbugs.gnu.org; 24 Mar 2021 22:31:30 +0000
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 24 18:31:30 2021
Received: from localhost ([127.0.0.1]:36338 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1lPC2E-0000t2-9g
	for submit@debbugs.gnu.org; Wed, 24 Mar 2021 18:31:30 -0400
Received: from mail-wr1-f51.google.com ([209.85.221.51]:41844)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@gmail.com>) id 1lPC2C-0000so-Tz
 for 25425@debbugs.gnu.org; Wed, 24 Mar 2021 18:31:29 -0400
Received: by mail-wr1-f51.google.com with SMTP id b9so346865wrt.8
 for <25425@debbugs.gnu.org>; Wed, 24 Mar 2021 15:31:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=FHinleyZxpftRyTFcG97+4GF7F7g5DR31ciwnCcLL1M=;
 b=gUCUleCD2krW/msMPdAcOp9n9tN9mA6t07y7KmZhCMCywFNHOmiH0mOauV+96jQCs1
 tSve4+bFalMCN5f72z82uyrcH4ZUJ+IDvgFKCfpNAcoOa5BupsstowKr2oisJ2ffQzDQ
 Y2iEdbWpDQjqUB0i7wfRZZle3MkZysyODYM32f/pRkS1um6xJFY1PASaW6c26EnqhRSd
 qBkRjlvPOqaB5D+3a5/YeK75VqahTqV5qIaMlOISZ3sVoMoL32WhB1Sy2iim/xG9RV2p
 8wgO+VW9bKB+TII6qcTGTEYwlmBft5huNhyTjDDc3DlXyo6Del41d1AcuW39xKfjs03b
 KSag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=FHinleyZxpftRyTFcG97+4GF7F7g5DR31ciwnCcLL1M=;
 b=CZDtrF8HkxmPNwcCaVkrIMH9dGQzsewv3CPOhXrkVEJGaHuJe9CSw9v2Vj1HSJbSvu
 RwFa0aP16WzdqL9gLoEJVFs97i0UVHtr7IOMHzo0++LwUrjJLmtNEhKOCz2pW7RFo0OH
 udSs0ZJ/xCwySpwB6JQYSrbR2CkVYKtSH7n2zk0IXyto8xHuxgwJGqSuiAFG6Kc04tsS
 jJ0mp+fOdTpZUpSie2GFoJBBujnAkkYZ7mrXJKJ/1EWoJ7q7brR/K+rfEoGjnih9W3Os
 y3AA8aoYFWk19wHQGJoUY58T5JCsn8d7bEUejmOumtj52sOqOGGlOmcPAiiYHEJGD55W
 T6cQ==
X-Gm-Message-State: AOAM533RHpqoZFKFQWVmAcoLZUYJuX7TYCUcUs10BBku3q/WLzyLbVhy
 IqcMQ90/z4U2xmIwJOrGaOWwDqwCaPM=
X-Google-Smtp-Source: ABdhPJzE2wE1J0ZIoL+HprAC6Mtp8yKi0BiQ4skaceJ/ZbGbR8KjzywAeh9+3Prv8o103KN2V0p8iQ==
X-Received: by 2002:a5d:58c9:: with SMTP id o9mr5716703wrf.181.1616625083009; 
 Wed, 24 Mar 2021 15:31:23 -0700 (PDT)
Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e])
 by smtp.gmail.com with ESMTPSA id i17sm4878101wrp.77.2021.03.24.15.31.22
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 24 Mar 2021 15:31:22 -0700 (PDT)
From: zimoun <zimon.toutoune@gmail.com>
To: Ricardo Wurmus <rekado@elephly.net>
Subject: Re: bug#25425: cannot express search path
References: <87shoo7dgx.fsf@mdc-berlin.de> <87r34879o1.fsf@elephly.net>
 <87bmvc2vjn.fsf@gnu.org> <87lgug72vc.fsf@elephly.net>
 <87d1feep2q.fsf@gnu.org> <874m0q2087.fsf@elephly.net>
Date: Wed, 24 Mar 2021 23:27:16 +0100
In-Reply-To: <874m0q2087.fsf@elephly.net> (Ricardo Wurmus's message of "Sun,
 22 Jan 2017 23:34:00 +0100")
Message-ID: <86r1k49ohn.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25425
Cc: Ludovic Courtès <ludo@gnu.org>, 25425@debbugs.gnu.org
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi,

This is an old bug about Lua and search path.

  <http://issues.guix.gnu.org/issue/25425>

It is still unsolved:

--8<---------------cut here---------------start------------->8---
$ guix environment -C --ad-hoc lua lua-lpeg -- lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> require('lpeg')
stdin:1: module 'lpeg' not found:
	no field package.preload['lpeg']
	no file '/usr/local/share/lua/5.3/lpeg.lua'
	no file '/usr/local/share/lua/5.3/lpeg/init.lua'
	no file '/usr/local/lib/lua/5.3/lpeg.lua'
	no file '/usr/local/lib/lua/5.3/lpeg/init.lua'
	no file './lpeg.lua'
	no file './lpeg/init.lua'
	no file '/usr/local/lib/lua/5.3/lpeg.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './lpeg.so'
stack traceback:
	[C]: in function 'require'
	stdin:1: in main chunk
	[C]: in ?
>
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
$ guix environment -C --ad-hoc lua lua-lpeg
[env]$ export LUA_PATH="$GUIX_ENVIRONMENT/share/lua/5.3/?.lua;$GUIX_ENVIRONMENT/share/lua/5.3/?/?.lua"
[env]$ export LUA_CPATH="$GUIX_ENVIRONMENT/lib/lua/5.3/?.so;$GUIX_ENVIRONMENT/lib/lua/5.3/?/?.so"
[env]$ lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> require('lpeg')
table: 0x23fd510
>
--8<---------------cut here---------------end--------------->8---


On Sun, 22 Jan 2017 at 23:34, Ricardo Wurmus <rekado@elephly.net> wrote:
> Ludovic Courtès <ludo@gnu.org> writes:
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>> Ludovic Courtès <ludo@gnu.org> writes:
>>>
>>>> I think this should work:
>>>>
>>>>        (search-path-specification
>>>>          (variable "LUA_PATH")
>>>>          (separator ";")
>>>>          (files '("share/lua/5.3"))
>>>>          (file-pattern "\\.lua$")
>>>>          (file-type 'regular))
>>>
>>> I tried this very same thing but it doesn’t work because Lua expects
>>> placeholders (“?”) in the search paths.  The placeholders are replaced
>>> with the actual package names.  If the actual file name does not exist
>>> it will try the next pattern.  If the file *does* exist – which *will* be
>>> the case for any of the files on LUA_PATH that have been generated by
>>> the search-path-specification — Lua will try to load the package from
>>> that path.
>>>
>>> This will fail because a search for the “lpeg” module would be satisfied
>>> by the file “re.lua”, because that’s the first valid file on the
>>> LUA_PATH.  “re.lua” requires “lpeg” itself, so another lookup is
>>> performed, which will again result in “re.lua” to be loaded…
>>>
>>> AIUI we must generate a value for LUA_PATH that keeps the placeholders
>>> intact.
>>
>> So are you saying that it’s important for the question marks to remain
>> intact?
>
> Yes, that seems to be the case.
>
>> This sounds terrible.  I’m not sure how to address it, and I don’t feel
>> like stretching the search path mechanism this much.
>>
>> Thoughts?
>
> I agree.  It’s a really odd special case.  On the other hand, not
> extending the search path mechanism would mean that we have to find
> other ways to fix “guix environment”, build phases, and profiles when
> Lua packages are involved.
>
> Build phases are easy to fix (by using a procedure that sets the
> appropriate environment variables depending on the build inputs), but I
> don’t know how to make profiles behave the way they should.  Maybe it
> would be fine to set a single value for LUA_PATH (and LUA_CPATH) that
> assumes a single prefix (the profile path) and contains the necessary
> placeholders.

Is it fixable?


All the best,
simon






Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Tue Sep 9 11:31:58 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.