modules/programs: sane-sandboxed: fix but that --sane-sandbox-path / wasnt being canonicalized

This commit is contained in:
Colin 2024-02-18 13:53:53 +00:00
parent 55c305812d
commit 95cb5624ca

View File

@ -645,8 +645,9 @@ canonicalizePaths() {
for _path in "${_normPaths[@]}"; do
_isSubpath=
for _other in "${_normPaths[@]}"; do
if [[ "$_path" =~ ^$_other/.* ]]; then
if [[ "$_path" =~ ^$_other/.* ]] || [ "$_other" = "/" ] && [ "$_path" != "/" ]; then
# N.B.: $_path lacks a trailing slash, so this never matches self.
# UNLESS $_path or $_other is exactly `/`, which we special-case.
_isSubpath=1
fi
done