Documentation
¶
Overview ¶
Package shell performs static syntax checking of egg installation scripts by delegating to the interpreter the egg declares as its entrypoint.
The panel runs the install script inside a container with a specific shell, so the only faithful check is the real interpreter's own parser (`sh -n`). Where that exact interpreter is unavailable a stand-in is used and the result is marked approximate — callers are expected to surface that, because a check that silently did not run is worse than no check at all.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownEntrypoint = errors.New("unknown install entrypoint")
ErrUnknownEntrypoint is returned for entrypoints egglint does not model.
var KnownEntrypoints = []string{"bash", "ash", "sh", "dash", "zsh"}
KnownEntrypoints lists the entrypoints the panel realistically uses.
Functions ¶
func IsKnownEntrypoint ¶
IsKnownEntrypoint reports whether the entrypoint is one egglint understands.
func NormalizeEntrypoint ¶
NormalizeEntrypoint reduces an entrypoint to its interpreter name. Eggs legitimately declare an absolute path such as "/bin/bash", which names exactly the same shell as "bash".
Types ¶
type Checker ¶
type Checker struct {
// Entrypoint is the entrypoint declared by the egg, e.g. "bash" or "ash".
Entrypoint string
// Argv is the command used to perform the check, empty when unavailable.
Argv []string
// Approximate is true when Argv is a stand-in for the declared interpreter
// (for example dash standing in for busybox ash).
Approximate bool
// Note explains an approximate or unavailable checker.
Note string
}
Checker syntax-checks scripts for one entrypoint.
func For ¶
For builds a Checker for the declared entrypoint, resolving the best available interpreter on this machine.
func (*Checker) Check ¶
Check runs the syntax check. It returns nil when the script parses cleanly.
Carriage returns are always normalised away first, because that is what the panel itself does: the endpoint wings fetches the install script from applies str_replace(["\r\n", "\n", "\r"], "\n", ...) before returning it, so the interpreter in the install container never sees a CRLF script.
This matters more than it sounds. CRLF genuinely breaks bash, dash and busybox ash — a trailing carriage return stops `then` being the `then` keyword — so checking the raw script would report a syntax error for the large majority of published eggs, none of which fail in practice. CRLF is still worth knowing about, and is reported separately by its own rule at an honest severity.