def owner.exec
import ezx@1.11.0.0/src/sha/nar.bend as Narimport Base
278# whether a file's owner may execute it, from the mode `find` prints as
279# `%M`, `-rwxr-xr-x`: the fourth character is `x`, or `s` when the setuid
280# bit is set as well. This is the mode bit nix's NAR dumper reads
281# (`S_IXUSR`), not an access check, so a file the owner may not execute is
282# not executable whoever weighs it.
283def owner.exec(mode: String) -> Bool:
284 match mode:
285 case SCon{_t, SCon{_r, SCon{_w, SCon{+x, _rest}}}}:
286 Bool.or(Char.is_eq(x, 'x'), Char.is_eq(x, 's'))
287 case _:
288 False{}