Page MenuHomeFreeBSD

Add error checks to @shell
ClosedPublic

Authored by andrew_tao173.riddles.org.uk on Nov 9 2020, 7:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 11:35 PM
Unknown Object (File)
Mon, Dec 9, 3:31 AM
Unknown Object (File)
Oct 9 2024, 11:19 PM
Unknown Object (File)
Oct 9 2024, 11:19 PM
Unknown Object (File)
Oct 9 2024, 11:19 PM
Unknown Object (File)
Oct 9 2024, 10:47 PM
Unknown Object (File)
Oct 3 2024, 9:42 PM
Unknown Object (File)
Sep 30 2024, 2:13 AM
Subscribers

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
Lint Not Applicable
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.