def path.safe
import ezx@1.11.0.0/src/fetch/plan.bend as Planimport Base
import ezx@1.11.0.0/src/pkg/pkg.bend as K
import ezx@1.11.0.0/src/pkg/path.bend as Path
183# whether a path stays inside the tree it is laid in: written the way the
184# path walk writes it, so no `.` or `//` in it, not empty, not absolute and
185# not climbing out with `..`. A lock is not trusted with where it writes.
186def path.safe(+at: String) -> Bool:
187 Bool.and(String.eq(Path.norm(at), at),
188 Bool.not(Bool.or(K.escapes(at), String.eq(at, "."))))