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
F83399947: D27154.id82987.diff
Thu, May 9, 11:54 PM
F83399945: D27154.id79357.diff
Thu, May 9, 11:54 PM
F83399943: D27154.id.diff
Thu, May 9, 11:54 PM
F83362867: D27154.id82987.diff
Thu, May 9, 11:46 AM
Unknown Object (File)
Sun, May 5, 2:08 PM
Unknown Object (File)
Sat, May 4, 3:22 PM
Unknown Object (File)
Thu, May 2, 10:02 PM
Unknown Object (File)
Apr 9 2024, 8:11 PM
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.