-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
luajit: adjust defaults LUA_(C)PATH #286822
Conversation
0096288
to
3716a08
Compare
I havent pushed my latest changes so not to override the CI but turns out we had almost every LUA_PATH wrong.
Once this is fixed we are good to go. @lolbinarycat unrelated to this PR but mentioning this in case you haven't noticed but the propagatedBuildInputs are not added to LUA_PATH as it should. loadFromPropagatedInputs is never called pkgs/development/interpreters/lua-5/wrap.sh . This will be my next task since it's now hitting me when developing https://github.com/nvim-neorocks/rocks.nvim/ |
you shouldn't need to include |
yes, this was badly worded, what I meant is now that |
|
why are we even patching LUA_PATH_DEFAULT via luaconf.h? to remove the luajit explicitly says that patching |
3716a08
to
ff5bc1b
Compare
Yes and also to have
I've added LUA_ROOT to makeFlags after finding in the luajit source code an While fixing luajit and updating the golden test, I also noticed that the LUA_PATH contains |
arf and I wanted to update the release notes but seeing you duplicating the work I hurried up and forgot. Quite tired now but interested in your feedback/test. nixpkgs-review is great for that. |
what do you mean by "correctly" i'm not advocating for wrapping lua, i'm advocating for setting PREFIX for luajit and LUA_ROOT for lua5 we only need to patch it to find its own system libraries, other modules will be located by the envHook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason i started my own PR is because i wanted something more minimalist, this one makes a lot of changes, often without good reason (such as renaming variables)
i can't run it on my system, both due to the network of doing a full clone of nixpkgs, and due to the memory load of nix-build. |
thanks for not giving up with this old geezer and the good reviews ! Planning to merge tomorrow after CI passes. What's next:
|
of course! i just want my favorite programming language to have a functioning nixpkgs ecosystem :)
yep, as soon as this gets merged i'm planning on writing a bunch more unit tests, namely making sure LUA_PATH gets set correctly when there are propogatedBuildInputs.
this would actually be a regression! these need to be kept separate for the simple reason that they are often different. in lua 5.2 and below, only
deduplication is good, although we should make sure we don't break the
yep, and add unit tests for that. |
Looking forward to someone taking over the lua maintenance (after some "running-in" ofc, I hope google-translate did a good job on "running-in") ;) As you could tell I am not an avid lua user, I just maintained the ecosystem because I needed it for neovim.
so maybe not the default LUA_PATH but right now the lua setup hook looks at the My guess (going to sleep sry ^^') is that in: Feel free to ping me on matrix if you think this helps clear misunderstandings, my nickname is the same. |
i probably will set myself as a lua maintainer after this PR gets merged, although getting access to the community builder would let me actually perform real tests on the lua ecosystem.
as far as i know this is intended behavior. derivations (other than source derivations) generally should not put their files in the derivation root. if there are any derivations that do this, those derivations should be changed. |
In order to have the 'reset' LUA_PATH (aka `;;`) work, and for purity reasons(removing /usr paths) we(I) decided to patch the lua interpreters default LUA_PATH. Turns out the interpreters have different defaults and the patch was too coarse. There is smarter patching that can be done via LUA_ROOT. Also luajit doesn't need patching at all since LUA_ROOT is set via the build system.
when LUA_PATH contains `;;`, it is replaced by `;LUA_PATH_DEFAULT;` in lua 5.1: Updated https://github.com/lua/lua/blob/69ea087dff1daba25a2000dfb8f1883c17545b7a/loadlib.c#L599 More recent versions might be smarter ? https://github.com/lua/lua/blob/65b07dd53d7938a60112fc4473f5cad3473e3534/loadlib.c#L301
now that the lua interpreters include working directories with `./?.lua` in LUA_PATH, the current test includes every derivation which quickly becomes unreadable and unpractical. The test is adapted to add a folder only if it can find lua files in the subfolder.
explain why they are patched in nixpkgs.
with the lua patching
d0dcac9
to
99bb198
Compare
so lua starts getting smarter with lua5_4 and doesn't add separators if there is nothing before or after |
I see that some builds broke because of this PR (succeed when I revert it locally): I haven't investigated why, so far. |
it seems that buildLuarockPackage puts files in /share/lua/5.1, even withing luajitPackages. luajit doesn't check there by default, nix used to patch it to, but we just removed that behavior. we need to either reinstitute that, or change where files are installed (the latter feels more in line with how other lua*Packages work, but would at the very least need a changelog entry) |
to clarify my last point, it seems odd that luajitPackages and lua51Packages install to the same dir, but lua52Packages has a seperate dir. |
|
Looks like luarocks doesn't special case luajit https://github.com/luarocks/luarocks/blob/c16bdbc4cbb98c560fb7e8d4895d4d84afca2eb9/src/luarocks/core/cfg.lua#L194 so unless the system changes the default config lua_modules_path, it will install in 5.1 . I can't find any ticket of someone using luajit+luarocks with this issue that someone must have had ? anyway time to sleep |
@vcunat so I had a look at both builds. In knot-resolver logs, we see in the logs that LUA_PATH contains paths towards libraries but http. As the derivation was a bit convoluted, I chose to look at libpeas which looked simpler. There doesn't seem to be an issue with the lua hooks.
so the path looked correct (folders exist) ? |
Let me provide a trivial test case that regresses:
EDIT: it also broke with lua51Packages and lua52Packages, not just luajit. |
meson itself isn't able to do any lua-specific stuff. Of course, scripts written in meson can invoke lua/luajit, etc. |
Feel free to patch luajit not to inject such paths by default. I don't think it's closely related to this regression, though. |
thanks for the easy repro seemed like I used bash If you adapt the for loop in pkgs/development/interpreters/lua-5/hooks/setup-hook.sh with
it works. Gonna send a patch tomorrow, so dont revert if you can ;) |
I wasn't hasty because... touching the file causes a nontrivial rebuild. This bug is in master now, BTW. (because I don't like delaying security fixes too much) |
Ty. Opened a fix with its test at #300905 (test fails before the fix). Rebuilding my config with it |
Running in an ubuntu, I get:
so I've adjusted the paths accordingly
TODO target staging
Description of changes
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.