Hi! On Tue, 2021-03-02 at 22:26:55 +0100, Andreas Beckmann wrote: > Control: reassign -1 dpkg 1.20.7.1 > Control: retitle -1 dpkg: dpkg-realpath is broken > Control: severity -1 grave > Control: affects -1 + golang-github-coreos-bbolt-dev > golang-github-xordataexchange-crypt-dev > Control: tag -1 - help
> The good thing is that it is easily reproducible ... > > # readlink /usr/share/gocode/src/go.etcd.io/bbolt > ../github.com/coreos/bbolt > # readlink -f /usr/share/gocode/src/go.etcd.io/bbolt > /usr/share/gocode/src/github.com/coreos/bbolt > # dpkg-realpath /usr/share/gocode/src/go.etcd.io/bbolt > /github.com/coreos/bbolt > > The output from dpkg-realpath is wrong, causing > dpkg-maintscript-helper to skip its job. > > Severity grave since I'm afraid that bug prepares for future upgrade > errors since several dpkg-maintscript-helper actions may have been > silently skipped without causing immediate trouble. Ah! Ok good thing I had not done the unblock request. :) Attached a patch that I think fixes this issue, and also fixes a problem with the symlink loop detection. Thanks, Guillem
diff --git i/scripts/dpkg-realpath.sh w/scripts/dpkg-realpath.sh index 5636ab3c7..bb7861038 100755 --- i/scripts/dpkg-realpath.sh +++ w/scripts/dpkg-realpath.sh @@ -69,10 +69,6 @@ canonicalize() { src=${src#/} done while [ -n "$src" ]; do - loop=$((loop + 1)) - if [ "$loop" -gt 25 ]; then - error "too many levels of symbolic links" - fi # Get the first directory component. prefix=${src%%/*} # Remove the first directory component from src. @@ -88,10 +84,14 @@ canonicalize() { elif [ "$prefix" = .. ]; then # Go up one directory. result=${result%/*} - if [ "${result#"$root"}" = "$result" ]; then + if [ -n "$root" ] && [ "${result#"$root"}" = "$result" ]; then result="$root" fi elif [ -h "$result/$prefix" ]; then + loop=$((loop + 1)) + if [ "$loop" -gt 25 ]; then + error "too many levels of symbolic links" + fi # Resolve the symlink within $result. dst=$(readlink "$result/$prefix") case "$dst" in