minetest / minetest

Minetest is an open source voxel game-creation platform with easy modding and game creation

Home Page:https://www.minetest.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stacktraces reported by Minetest blame the wrong mod

appgurueu opened this issue · comments

Minetest version
5.5.0 and earlier; presumably 5.6-dev as well
Summary

See minetest-mods/wielded_light#21: The stacktrace clearly shows mesecons is responsible, but the error message blames the wielded_light mod.

Steps to reproduce
//lua table.insert(minetest.registered_globalsteps, function() _ = nil + nil end)

"From mod X" is saying the get_current_modname value - wielded_light is the mod that's currently loading. It's not based on stacktrace

It should probably say "error whilst loading mod" rather than "error from mod"

"From mod X" is saying the get_current_modname value - wielded_light is the mod that's currently loading. It's not based on stacktrace

It should probably say "error whilst loading mod" rather than "error from mod"

This should be after load time though, unless I misinterpret "in callback environment_Step()"?

On the other hand, the stacktrace clearly points to a chunk that would most likely be loaded at load time (although it could be reloaded at runtime); if this were at load time though, it should correctly detect mesecons as responsible as the mesecons initialization isn't loaded by the wielded light mod.

commented

core.run_callbacks sets the correct mod origin on a best effort basis:

local origin = core.callback_origins[callbacks[i]]
if origin then
core.set_last_run_mod(origin.mod)
end
local cb_ret = callbacks[i](...)

As you can see if a callback doesn't have a mod origin set the last one will stick around. But without a concrete reproducer there is nothing that can be done about this issue, since it generally works.

core.run_callbacks sets the correct mod origin on a best effort basis:

local origin = core.callback_origins[callbacks[i]]
if origin then
core.set_last_run_mod(origin.mod)
end
local cb_ret = callbacks[i](...)

As you can see if a callback doesn't have a mod origin set the last one will stick around. But without a concrete reproducer there is nothing that can be done about this issue, since it generally works.

That looks like an obvious bug to me. It should clear the "origin" using core.set_last_run_mod"??" or the like.

A simple way to reproduce this:

//lua table.insert(minetest.registered_globalsteps, function() _ = nil + nil end)

Screenshot 2022-04-28 11-32-12