Page MenuHomeFreeBSD

Add error checks to @shell
ClosedPublic

Authored by andrew_tao173.riddles.org.uk on Nov 9 2020, 7:58 PM.

Details

Summary

As shown by the recent issue with pkg not initializing rootfd, errors from Lua io.* library calls were not being checked for and resulted in incomprehensible failures such as "attempt to index a nil value".

This patches Keywords/shell.ucl to report the error via assert() (which is the Lua idiom for this).

Discussed with bapt on IRC.

Test Plan

Tested by taking advantage of the pkg bug to induce an error. Also tested that it still works in the non-error case.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

This revision is now accepted and ready to land.Dec 14 2020, 11:57 AM

I also hit this issue: https://github.com/freebsd/pkg/issues/1919

Is there any issue in this patch?

FWIW, pkg 1.6 seems to have this fixed (in a better way?)

TL;DR This revealed what has been fixed in pkg 1.16 ;)
no, this is a way to have better printing of what is going wrong when things goes wrong. To be honnest I haven't reviewed it yet because I want to explore the idea of catching properly the error, but maybe that is a wrong idea ;)

This revision was automatically updated to reflect the committed changes.