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

Symbolic link issues on MacOS #96

Open
prgp opened this issue Jul 12, 2022 · 1 comment
Open

Symbolic link issues on MacOS #96

prgp opened this issue Jul 12, 2022 · 1 comment
Labels

Comments

@prgp
Copy link

prgp commented Jul 12, 2022

There appears to be a minor issue when luacov attempts to scan over a symbolic link - I suspect the issue is actually in lfs which should return a mode attribute of 'link' for a symbolic link, but instead it returns nil as the attributes table which causes a nil dereference:

lua: .../Cellar/luarocks/3.8.0/share/lua/5.4/luacov/reporter.lua:133: attempt to index a nil value (local 'attr')
stack traceback:
	.../Cellar/luarocks/3.8.0/share/lua/5.4/luacov/reporter.lua:133: in local 'add_empty_dir_coverage_data'
	.../Cellar/luarocks/3.8.0/share/lua/5.4/luacov/reporter.lua:141: in method 'new'
	.../Cellar/luarocks/3.8.0/share/lua/5.4/luacov/reporter.lua:489: in function 'luacov.reporter.report'
	...ew/Cellar/luarocks/3.8.0/share/lua/5.4/luacov/runner.lua:134: in function 'luacov.run_report'
	...ew/Cellar/luarocks/3.8.0/share/lua/5.4/luacov/runner.lua:147: in upvalue 'on_exit'
	...ew/Cellar/luarocks/3.8.0/share/lua/5.4/luacov/runner.lua:469: in function 'luaunit.oldOsExit'
	...homebrew/Cellar/luarocks/3.8.0/share/lua/5.4/luaunit.lua:132: in function 'os.exit'
	test/test_suite.lua:16: in main chunk
	[C]: in ?

I have a work-around which guards against this issue, but does not fix the underlying problem.

Build System Used

MacOS: 11.6.7 (M1)
Lua: 5.4
luarocks versions:
    luacov: 0.15.0-1
    luafilesystem: 1.8.0-1

Work-around patch to reporter.lua

Adding an extra guard attr and seems to "fix" the issue.

line 36:

if attr and attr.mode == "directory" then

line 133

if attr and attr.mode == "file" and fileMatches(filename, '.%.lua$') then
@hishamhm
Copy link
Member

Hi! Could you send a PR with the workaround? Thanks!

@hishamhm hishamhm added the bug label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants