-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
lua: fix longstanding bug in lua envHook causing relative module imports to stop working #289135
Conversation
Fixes #113110 |
see extended commit message for more info |
Superceeds #273342 |
8f563ca
to
9260e79
Compare
Could you add a test of what you want in pkgs/development/interpreters/lua-5/tests please ?
output:
NB: this will eventually need to target staging considering the number of rebuilds |
the existing test for luajit basically already does this (it was broken before, and now it works), if i was to add more tests it would be to test the actual inclusion of modules instead of just checking the path. i don't mind writing some more unit tests for lua, as it could clearly use them, but i would want to do that as a separate PR as the scope would be larger than just this 1 thing that is already tested for.
do i need to do something about that? i'm fairly new to nixpkgs. |
also, my intent with this PR was to keep it as minimal as possible so that it can easily be reviewed. this is 4 year old bug that affects most multi-file lua projects, so my main priority was to just get it fixed. |
it fixes
|
@teto run |
Indeed sry ! when the number of rebuilds > 2000, we usually target the "staging" branch, which becomes available in nixos-unstable 1/2 weeks later. Can you target staging (convert the PR first to draft avoids pinging dozens of people when making a mistake so I recommand that) https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#rebasing-between-branches-ie-from-master-to-staging and then I will merge. |
previously, when the lua setup hook found a system lua module, it would simply add that library to LUA_PATH, meaning the default path would no longer be used. for luajit, this bug would always occur, due to it having several inbuilt libraries such as luabitop. lua5 still passed unit tests, simply because the test environment doesn't include any system lua libaries, but the bug would still occur if lua5 was used in a derivation with a buildInput from luaPackages, since that package would be found by the envHook and overwrite the default path. now, the setup hook will use any system module paths in addition to the default path, instead of overriding it.
9260e79
to
ca6452f
Compare
@teto rebased! |
ty |
Fyi, I believe the |
I now verified that this particular merge broke some lua* stuff (just reverting it fixes the builds), but I haven't investigated deeper. Examples:
/cc the corresponding staging-next PR #292500 |
@vcunat these errors look related to an invalid luarocks config. I've submitted some changes in that area so I'll have a look. EDIT still it's weird, I usually run in my fork whatever I submitted to staging and have no issue.. |
@teto: perhaps we should revert this PR for now, so that there's not so much time pressure on this? The staging-next PR is basically waiting for this now, delaying other changes including security fixes. |
I had a very quick look and yeah I could not find a link with my luarocks-related changes (might still be the case though, but I use these in my fork and it works well). If you are sure this is the responsible PR, let's revert it and put it back after more rigourous testing later. lolbinarycat has prompted us to look into lua issues and we will do so in a more orderly manner #286822 . I have some CPU capacity to run nixpkgs-review on the PRs but we will have to slow down binary cat :) anyway thanks for asking/letting us know about the status, maintaining staging-next is hard work and we'll try to be more careful on the next merge. |
…stem modules This reverts commit ca6452f. Regressions appeared and they need time to get resolved; see: #289135 (comment)
|
That sounds done wrong (well, maybe the tool could be blamed). Rebuilding together with staging changes. Either way, typical laptops aren't suitable for such things; it's good to have a remote more powerful machine at hand. |
@vcuncat yeah, that would be nice, but unless someone feels like giving me access to their personal build server, i think i'm fairly stuck with what i've got. |
Description of changes
originally thought to only affect luajit, this bug can also affect lua5, such as when running via
nix-shell -p lua luaPackages.toml
.this bug was caused by the lua envHook overriding the default package path whenever it found a module.
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.