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

fix(app) require_here follow symlink'd main module #423

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

nwf
Copy link
Contributor

@nwf nwf commented Mar 12, 2022

If a Lua application has, say, a main.lua and a lib.lua side-by-side,
and someone symlinks main.lua into (e.g.) ~/bin, we'd like
require_here() to look in the original directory, not ~/bin.

Symlink-following behavior can be disabled using the (new) second
argument to resolve_here.

@nwf nwf force-pushed the 202203-require_here-symlink branch from de3644f to 544c543 Compare March 12, 2022 00:04
@Tieske
Copy link
Member

Tieske commented Mar 14, 2022

besides the failing tests, we'd also need an additional test case for this.

@nwf nwf force-pushed the 202203-require_here-symlink branch 3 times, most recently from f6611d6 to 5ea97c0 Compare April 16, 2022 12:15
@nwf
Copy link
Contributor Author

nwf commented Apr 16, 2022

Apologies for the delay in responding and for the noise in sorting out CI.

Please find here a corrected patch, which deals with non-existing script names (and so passes existing tests), and a new test that probes both the default and the nofollow behavior.

CI appears to be failing due to SSL certificate errors in the non-luajit arms, unrelated to this PR. (It also continues to use python2, which is by now well past its best-by date.)

@nwf
Copy link
Contributor Author

nwf commented Apr 27, 2022

Ping?

@Tieske
Copy link
Member

Tieske commented Jun 6, 2022

CI windows is broken, and especially symlinks are an incompatibility between unixes and windows, so need to test that first. Sorry for the delay.

nwf and others added 2 commits July 21, 2022 15:24
If a Lua application has, say, a main.lua and a lib.lua side-by-side,
and someone symlinks main.lua into (e.g.) ~/bin, we'd like
require_here() to look in the original directory, not ~/bin.

Symlink-following behavior can be disabled using the (new) second
argument to resolve_here.
@Tieske Tieske force-pushed the 202203-require_here-symlink branch from 293b5b5 to 4d27a01 Compare July 21, 2022 13:24
Copy link
Member

@Tieske Tieske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx @nwf finally got CI fixed. Merrging.

@Tieske Tieske changed the title app.require_here: follow symlink'd main module fix(app) require_here follow symlink'd main module Jul 21, 2022
@Tieske Tieske merged commit af60264 into lunarmodules:master Jul 21, 2022
bungle added a commit to Kong/kong that referenced this pull request Aug 8, 2022
### Summary

#### 1.13.1 (2022-Jul-22)
 - fix: `warn` unquoted argument
   [#439](lunarmodules/Penlight#439)

#### 1.13.0 (2022-Jul-22)
 - fix: `xml.parse` returned nonsense when given a file name
   [#431](lunarmodules/Penlight#431)
 - feat: `app.require_here` now follows symlink'd main modules to their directory
   [#423](lunarmodules/Penlight#423)
 - fix: `pretty.write` invalid order function for sorting
   [#430](lunarmodules/Penlight#430)
 - fix: `compat.warn` raised write guard warning in OpenResty
   [#414](lunarmodules/Penlight#414)
 - feat: `utils.enum` now accepts hash tables, to enable better error handling
   [#413](lunarmodules/Penlight#413)
 - feat: `utils.kpairs` new iterator over all non-integer keys
   [#413](lunarmodules/Penlight#413)
 - fix: `warn` use rawget to not trigger strict-checkers
   [#437](lunarmodules/Penlight#437)
 - fix: `lapp` provides the file name when using the default argument
   [#427](lunarmodules/Penlight#427)
 - fix: `lapp` positional arguments now allow digits after the first character
   [#428](lunarmodules/Penlight#428)
 - fix: `path.isdir` windows root directories (including drive letter) were not considered valid
   [#436](lunarmodules/Penlight#436)
bungle added a commit to Kong/kong that referenced this pull request Aug 8, 2022
### Summary

#### 1.13.1 (2022-Jul-22)
 - fix: `warn` unquoted argument
   [#439](lunarmodules/Penlight#439)

#### 1.13.0 (2022-Jul-22)
 - fix: `xml.parse` returned nonsense when given a file name
   [#431](lunarmodules/Penlight#431)
 - feat: `app.require_here` now follows symlink'd main modules to their directory
   [#423](lunarmodules/Penlight#423)
 - fix: `pretty.write` invalid order function for sorting
   [#430](lunarmodules/Penlight#430)
 - fix: `compat.warn` raised write guard warning in OpenResty
   [#414](lunarmodules/Penlight#414)
 - feat: `utils.enum` now accepts hash tables, to enable better error handling
   [#413](lunarmodules/Penlight#413)
 - feat: `utils.kpairs` new iterator over all non-integer keys
   [#413](lunarmodules/Penlight#413)
 - fix: `warn` use rawget to not trigger strict-checkers
   [#437](lunarmodules/Penlight#437)
 - fix: `lapp` provides the file name when using the default argument
   [#427](lunarmodules/Penlight#427)
 - fix: `lapp` positional arguments now allow digits after the first character
   [#428](lunarmodules/Penlight#428)
 - fix: `path.isdir` windows root directories (including drive letter) were not considered valid
   [#436](lunarmodules/Penlight#436)
StarlightIbuki pushed a commit to Kong/kong that referenced this pull request Aug 9, 2022
### Summary

#### 1.13.1 (2022-Jul-22)
 - fix: `warn` unquoted argument
   [#439](lunarmodules/Penlight#439)

#### 1.13.0 (2022-Jul-22)
 - fix: `xml.parse` returned nonsense when given a file name
   [#431](lunarmodules/Penlight#431)
 - feat: `app.require_here` now follows symlink'd main modules to their directory
   [#423](lunarmodules/Penlight#423)
 - fix: `pretty.write` invalid order function for sorting
   [#430](lunarmodules/Penlight#430)
 - fix: `compat.warn` raised write guard warning in OpenResty
   [#414](lunarmodules/Penlight#414)
 - feat: `utils.enum` now accepts hash tables, to enable better error handling
   [#413](lunarmodules/Penlight#413)
 - feat: `utils.kpairs` new iterator over all non-integer keys
   [#413](lunarmodules/Penlight#413)
 - fix: `warn` use rawget to not trigger strict-checkers
   [#437](lunarmodules/Penlight#437)
 - fix: `lapp` provides the file name when using the default argument
   [#427](lunarmodules/Penlight#427)
 - fix: `lapp` positional arguments now allow digits after the first character
   [#428](lunarmodules/Penlight#428)
 - fix: `path.isdir` windows root directories (including drive letter) were not considered valid
   [#436](lunarmodules/Penlight#436)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants