Skip to content

Symbolic link issues on MacOS #96

Open
@prgp

Description

@prgp

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions