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, May 19, 10:27 PM
Unknown Object (File)
Fri, May 10, 6:55 PM
Unknown Object (File)
Thu, May 9, 11:54 PM
Unknown Object (File)
Thu, May 9, 11:54 PM
Unknown Object (File)
Thu, May 9, 11:54 PM
Unknown Object (File)
Thu, May 9, 11:46 AM
Unknown Object (File)
Sun, May 5, 2:08 PM
Unknown Object (File)
Sat, May 4, 3:22 PM
Subscribers

Details

Reviewers
bapt
kevans
manu
Group Reviewers
portmgr
O5: Ports Framework(Owns No Changed Paths)
Commits
rP563097: Add error checks to @shell
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 Skipped
Unit
Tests Skipped

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.