gamax92-Programs icon indicating copy to clipboard operation
gamax92-Programs copied to clipboard

Update the blacklist for unrequire

Open skyem123 opened this issue 8 years ago • 3 comments
trafficstars

When testing the unrequire tool on OpenOS 1.6.1, I found that it could unload things that broke OpenOS, so I used a process of elimination to find out what not to unload. It seems to work.

Since this involves (removing) the guts of OpenOS (while it's running), maybe @payonel (hopefully this isn't rude) could give his opinion on what is likely to cause issues?

What was odd was that if you unload both term and keyboard, key combinations stopped working, but if you only unloaded one of them it still worked (until you unloaded the other).

skyem123 avatar May 10 '17 11:05 skyem123

There is a keyboard service with key event listeners that updates some keyboard state of pressed keys needed for key combo stuff. This keyboard service holds a ref to the original keyboard library, thus if the keyboard library is unloaded the service will still be updating the old lib. And code using the new lib would not be getting key state updates. This is probably why you have to unload term and keyboard together to see kb state failures. It would probably be a bit nicer to NOT blacklist term from unrequire, but instead blacklist keyboard only.

unicode, computer, component, table, string, and math are not provided in /lib but are part of bootstrap though it is strange you have to unrequire blacklist table, string, and math -- as those are in _G and do not require require

payonel avatar May 10 '17 16:05 payonel

Well... apparently in Lua, you can require things like table, string and math and a whole lot of other stuff that's already in the default environment. So I've added what I could think of.

skyem123 avatar May 10 '17 19:05 skyem123

Oops... I misread, corrected now.

skyem123 avatar May 10 '17 20:05 skyem123