Expand description
Requirements: conditions on the player’s work that are always checked.
A level’s requirements run before its answer, unconditionally: a correct answer next to
a failed requirement is still a failure. That is what makes an answer impossible to
shortcut (submitting level-1 without having used pwd fails), and what lets a level
with no answer at all (a pure chmod task) be graded on the filesystem alone.
Each constructor (at, file(), content, …) returns a small builder with the
message overrides that make sense for it; every builder converts into a Requirement,
which is what Level::require takes. A requirement’s success text is never shown, so
none is kept.
All declared paths are relative to the level’s section root and go through the one
containment function. A path that passes through a symlink fails with
messages::PATH_ESCAPES_WORKSPACE rather than being followed.
Structs§
- At
- See
at. - File
Content - See
content. - Line
Count - See
line_count. - ModeIs
- See
modeanddir_mode. - Moved
- See
moved. - Perm
Bits - See
perm_bits. - Presence
- See
file(),dir,no_fileandno_dir. - Requirement
- A condition on the player’s work. Build one with the free functions of this module.
- Same
- See
same.
Functions§
- at
- The player must be standing in this section-relative directory.
- at_home
- The player must be standing in
$HOME(compared canonically). - cd_
evidence - This level’s own
cddrill must have been performed (Marker::Cd). Needs acdpolicy on the level, which is what writes the marker. - check
- An arbitrary check, for the rare condition nothing else expresses. Prefer the declarative requirements: they are checked by the catalog lint, this is not.
- content
- Conditions on a text file’s content.
- dir
- A directory must exist here.
- dir_
mode - A directory’s permission bits must be exactly
mode. - evidence
- The marker file must exist: the player did something only the shell could witness.
- fd_
evidence - This level’s own file-descriptor drill must have been performed (
Marker::Fd). Needs anon_fdrule on the level. - file
- A regular file must exist here.
- line_
count - The file must have exactly
expectedlines, counted like Python’sstr.splitlines(). - mode
- A file’s permission bits must be exactly
mode. - moved
sourcemust be gone anddestinationmust exist.- no_dir
- Nothing may remain here (a leftover symlink, even a dangling one, counts as remaining). The messages talk about a directory.
- no_file
- Nothing may remain here (a leftover symlink, even a dangling one, counts as remaining). The messages talk about a file.
- perm_
bits - Permission bits a file must have and must not have.
- same
destinationmust be an exact copy ofsource: same names, same bytes, dotfiles included, symlinks compared by their link target and never followed.