Skip to content
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

awesome: refactor LUA_PATH env var and don't expose it at runtime (19.03 branch) #61043

Merged
merged 1 commit into from May 7, 2019
Merged

Conversation

stefano-m
Copy link
Contributor

Cherry-picked c973e15 to fix #60232 in the 19.03 branch. Hope this is the right way to do it. Thanks.

This commit partly reinstates changes from 5465d6f that had been somehow
reverted in 17d3eb2. Also, a comment has been added in the hope that future
changes won't do the same.

Additionally, refactor the LUA_PATH env var to ensure that the internal lgi lua
files can't be required explicitly and to avoid possible name clashes (this
fixes issue #60232).

Finally, rather than using prepending ?.lua append ;; to LUA_PATH. Quoting
@psychon:

This is interpreted by Lua as "add the default search path here" (which does
indeed contain ?.lua, but also contains more).

Testing done:

  • Build with nix-build -I /path/to/repo -A awesome
  • Start an X session with xterm only
  • Start xephyr, e.g. Xephyr :1 -name xephyr -screen 512x384 -ac -br -noreset &
  • Run awesome like DISPLAY=:1.0 ./result/bin/awesome. Additionally, add
    --search options to expose lua modules that have a name clash with lgi's
    internal ones (see NixOS 19.03: Awesome Window Manager exposes lgi incorrectly in its LUA_PATH (regression) #60232 for more details) and require them in rc.lua to
    prove that they are loaded correctly
Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This commit partly reinstates changes from 5465d6f that had been somehow
reverted in 17d3eb2.  Also, a comment has been added in the hope that future
changes won't do the same.

Additionally, refactor the LUA_PATH env var to ensure that the internal lgi lua
files can't be required explicitly and to avoid possible name clashes (this
fixes issue #60232).

Finally, rather than using prepending `?.lua` append `;;` to LUA_PATH. Quoting
@psychon:

> This is interpreted by Lua as "add the default search path here" (which does
> indeed contain ?.lua, but also contains more).

Testing done:

- Build with `nix-build -I /path/to/repo -A awesome`
- Start an X session with xterm only
- Start xephyr, e.g. `Xephyr :1 -name xephyr -screen 512x384 -ac -br -noreset &`
- Run awesome like `DISPLAY=:1.0 ./result/bin/awesome`. Additionally, add
  `--search` options to expose lua modules that have a name clash with lgi's
  internal ones (see #60232 for more details) and `require` them in `rc.lua` to
  prove that they are loaded correctly
@stefano-m stefano-m changed the title awesome: refactor LUA_PATH env var and don't expose it at runtime awesome: refactor LUA_PATH env var and don't expose it at runtime (19.03 branch) May 6, 2019
@ofborg ofborg bot requested review from lovek323 and rasendubi May 6, 2019 11:10
@rasendubi rasendubi merged commit 3e7300c into NixOS:release-19.03 May 7, 2019
@rasendubi
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants