Skip to content

luarocks opener: Call cfg.init() conditionally (fixes #29)#30

Draft
leso-kn wants to merge 1 commit intohishamhm:masterfrom
leso-kn:fix-cfg-double-init
Draft

luarocks opener: Call cfg.init() conditionally (fixes #29)#30
leso-kn wants to merge 1 commit intohishamhm:masterfrom
leso-kn:fix-cfg-double-init

Conversation

@leso-kn
Copy link
Copy Markdown

@leso-kn leso-kn commented Apr 4, 2026

This PR fixes #29.

@hishamhm I see there is some additional initialization of luarocks.core.cfg happening in line 38 (cfg.init_package_paths).

I grasp my implementation would conflict with this condition, as now cfg would always be initialized at this point?

if cfg then
if not cfg.lua_extension then -- cfg not initialized
if cfg.init then
local cfg_ok, err = cfg.init()
if cfg_ok and cfg.init_package_paths then
cfg.init_package_paths()
end
end
end
end

Should I move cfg.init_package_paths() up into the first if block?

@leso-kn leso-kn marked this pull request as draft April 4, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: cfg.init() called twice when used inside a luarocks build driver

1 participant