Fix package-verify false negatives: symlink traversal + prefix collision
Lint / ShellCheck (push) Successful in 13s
Lint / Validate .plg XML (push) Successful in 13s
Lint / EditorConfig (push) Successful in 5s

podman-verify-packages.sh/podman-update-packages.sh reported every
package as "not installed" right after a genuinely successful install.
Root cause: /var/log/packages is itself a symlink on Unraid (->
../lib/pkgtools/packages), and GNU find's default -P mode doesn't
descend into a symlinked starting path at all without -L — confirmed
live by running the exact same find both with and without -L against a
host where the packages had just installed successfully.

Fixing that alone surfaced a second, previously-masked bug: "podman"'s
own glob also matches podman-compose's file (a literal prefix
collision), and find's unsorted output let podman-compose's record
silently win podman's own check.

Both fixed once via a new shared podman_find_installed_package_record()
helper in podman-common.sh, rather than separately in each caller.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 22:10:44 +00:00
co-authored by Claude Sonnet 5
parent d931d8e9e9
commit 9d46547ef4
4 changed files with 74 additions and 2 deletions
+6 -1
View File
@@ -68,7 +68,12 @@ for name in $targets; do
continue
fi
installed_record=$(find /var/log/packages -maxdepth 1 -name "${name}-*" -print 2> /dev/null | head -n1)
# See podman-common.sh's podman_find_installed_package_record() for why
# this isn't just a plain `find ... -name "$name-*" | head -n1` — note
# it's given $ALL_PACKAGES (not $targets), since prefix-collision
# detection needs the full component universe even when only updating
# a subset of it.
installed_record=$(podman_find_installed_package_record "$name" $ALL_PACKAGES)
installed_basename=$(basename "${installed_record:-__none__}")
case "$installed_basename" in