pub(crate) fn resolve_symlink(
start: &Path,
legal_symlink_paths: &[&LoadPath],
) -> Result<ResolvedSymlink, Error>Expand description
Resolves an arbitrarily long chain of symlinks and checks its validity.
Ensures that all intermediate and final paths are located within the set of paths in
legal_symlink_paths and that the symlink chain does not contain a cycle.
For results with the variants ResolvedSymlink::File or ResolvedSymlink::Dir, the
returned PathBuf contains a fully canonicalized path.
Symlinks that point to /dev/null (including in multiple hops) signal masking in VOA.
The variant ResolvedSymlink::Masked is returned for such symlinks.
ยงErrors
Returns an error if
- a cycle is detected in a symlink chain (
Error::CyclicSymlinks), - or a symlink points to a path outside
legal_symlink_paths(Error::IllegalSymlinkTarget).