You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
as the way to "vendor install" a plugin, but actually results in the following error:
src/lpm.lua:1621: attempt to index a nil value (field 'integer index')
stack traceback:
src/lpm.lua:1621: in method 'all_addons'
src/lpm.lua:1697: in method 'get_addon'
src/lpm.lua:1927: in field 'retrieve_addons'
src/lpm.lua:2007: in field 'install'
src/lpm.lua:2317: in field 'command'
src/lpm.lua:2340: in field 'run'
src/lpm.lua:2859: in function <src/lpm.lua:2858>
[C]: in field 'flock'
src/lpm.lua:555: in upvalue 'engage_locks'
src/lpm.lua:2858: in function <src/lpm.lua:2374>
[C]: in function 'xpcall'
src/lpm.lua:2374: in main chunk
When we have a default plugin (let's say language_css), it would be picked up in USERDIR and added to hash. When we loop over DATADIR (which is set to the same directory), the plugin is picked up again, and since it is found in hash, the code assumes that it has valid repository metadata at index 1, which it does not. I am not sure of the exact logic, but this is my best guess.
To fix this, we could:
check if hash[id][1] is really available
remove duplicate paths in addon_paths, since it obviously won't work
add --vendor flag to tell lpm that we are vendor installing stuff
I have a partial implementation of (3) that only works for this particular use case:
diff --git a/src/lpm.lua b/src/lpm.lua
index 111fcc3..040d56a 100644
--- a/src/lpm.lua+++ b/src/lpm.lua@@ -1588,10 +1588,10 @@ function Bottle:all_addons()
if self.all_addons_cache then return self.all_addons_cache end
local t, hash = get_repository_addons()
for _, addon_type in ipairs({ "plugins", "libraries", "fonts", "colors" }) do
- local addon_paths = {- (self.local_path and (self.local_path .. PATHSEP .. "user") or USERDIR) .. PATHSEP .. addon_type,- self.lite_xl.datadir_path .. PATHSEP .. addon_type- }+ local addon_paths = { (self.local_path and (self.local_path .. PATHSEP .. "user") or USERDIR) .. PATHSEP .. addon_type }+ if not ARGS["vendor"] then+ table.insert(addon_paths, self.lite_xl.datadir_path .. PATHSEP .. addon_type)+ end
for i, addon_path in ipairs(addon_paths) do
if system.stat(addon_path) then
for j, v in ipairs(system.ls(addon_path)) do
@@ -2374,7 +2374,7 @@ end
xpcall(function()
rawset(_G, "ARGS", ARGV)
ARGS = common.args(ARGS, {
- json = "flag", userdir = "string", cachedir = "string", version = "flag", verbose = "flag",+ json = "flag", userdir = "string", cachedir = "string", version = "flag", verbose = "flag", vendor = "flag",
quiet = "flag", version = "flag", ["mod-version"] = "string", remotes = "flag", help = "flag",
["ssl-certs"] = "string", force = "flag", arch = "array", ["assume-yes"] = "flag",
["no-install-optional"] = "flag", datadir = "string", binary = "string", trace = "flag", progress = "flag",
The issue here is that get_repository_addons is returning t, hash, and it's not actually consistent how hash is being treated. In one place, it's a hash of arrays, in another, it's a hash of objects.
I need to investigate this and shunt it to one or the other.
This is highlighted in https://github.com/lite-xl/lite-xl/blob/de13b6da2b36e47fbfadf3c491da1f2769e8234d/scripts/build.sh#L222
as the way to "vendor install" a plugin, but actually results in the following error:
The error is caused by this block here:
lite-xl-plugin-manager/src/lpm.lua
Line 1591 in d1a84c7
and here:
lite-xl-plugin-manager/src/lpm.lua
Line 1625 in d1a84c7
When we have a default plugin (let's say language_css), it would be picked up in
USERDIR
and added tohash
. When we loop over DATADIR (which is set to the same directory), the plugin is picked up again, and since it is found inhash
, the code assumes that it has valid repository metadata at index1
, which it does not. I am not sure of the exact logic, but this is my best guess.To fix this, we could:
hash[id][1]
is really availableaddon_paths
, since it obviously won't work--vendor
flag to tell lpm that we are vendor installing stuffI have a partial implementation of (3) that only works for this particular use case:
This patch will be used in https://github.com/lite-xl/playground to bundle plugins.
The text was updated successfully, but these errors were encountered: