Package: zutils
Version: 1.14-4
Severity: serious
Justification: piuparts failure breaks testing migration
Tags: patch
X-Debbugs-Cc: jspri...@debian.org
User: helm...@debian.org
Usertags: dep17

Hi,

Jochen made me aware that zutils didn't pass piuparts. When I came up
with the previous patch, I foolishly concluded that I'd be better than
piuparts at coming up with tests and wrote tests that didn't cover the
obvious. I ran everything through my tests and didn't bother running
piuparts in the end. Now piuparts fails.

I introduced a logic inversion. When moving the diverted files on a
fresh installation, the .usr-is-merged suffix is appended whenever it
should not be and vice versa. It is the ${GZIP_PREFIX:+.usr-is-merged}
interpolation that is wrong.

For some reason beyond my comprehension, I ruled out dpkg --verify as a
tool for testing. Don't task me why. It finds this issue. Additionally,
I've also implemented manual verification of diverted files. The updated
tools now also fail with current unstable.

I'm attaching updated test cases as well as another patch. Let me know
if you prefer me to handle the upload. The patch now also handles
upgrading from the broken -4 version that never reached trixie. This
scenario is not covered by the attached tests, but I manually verified
that the wrongly moved files get corrected.

Last but not least, the attached version passes piuparts this time.

I'll also follow up with the unblock request.

I really hope that this is the last iteration for zutils.

Helmut
diff --minimal -Nru zutils-1.14/debian/changelog zutils-1.14/debian/changelog
--- zutils-1.14/debian/changelog        2025-05-02 04:32:33.000000000 +0200
+++ zutils-1.14/debian/changelog        2025-05-12 12:45:18.000000000 +0200
@@ -1,3 +1,10 @@
+zutils (1.14-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix moving of diverted files again. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 12 May 2025 12:45:18 +0200
+
 zutils (1.14-4) sid; urgency=medium
 
   * Applying patch from Helmut Grohne <hel...@subdivi.de> to fix broken
diff --minimal -Nru zutils-1.14/debian/zutils.preinst 
zutils-1.14/debian/zutils.preinst
--- zutils-1.14/debian/zutils.preinst   2025-05-02 04:30:28.000000000 +0200
+++ zutils-1.14/debian/zutils.preinst   2025-05-12 12:45:18.000000000 +0200
@@ -25,7 +25,11 @@
                # We cannot run between gzip.preinst and gzip unpack.
                GZIP_VERSION=$(dpkg-query -f '${Version}' -W gzip)
                GZIP_PREFIX=/usr
-               dpkg --compare-versions "$GZIP_VERSION" lt 1.12-1.1~ && 
GZIP_PREFIX=
+               GZIP_SUFFIX=
+               dpkg --compare-versions "$GZIP_VERSION" lt 1.12-1.1~ && {
+                       GZIP_PREFIX=
+                       GZIP_SUFFIX=.usr-is-merged
+               }
                for FILE in zcat zcmp zdiff zegrep zfgrep zgrep
                do
                        TRUENAME=$(dpkg-divert --truename "/usr/bin/${FILE}")
@@ -42,7 +46,7 @@
                        # on the gzip version.
                        dpkg-divert --package zutils --quiet --add --no-rename 
--divert "/usr/bin/${FILE}.gzip" "/usr/bin/${FILE}"
                        dpkg-divert --package zutils --quiet --add --no-rename 
--divert "/bin/${FILE}.gzip.usr-is-merged" "/bin/${FILE}"
-                       mv "${DPKG_ROOT:-}${TRUENAME}" 
"${DPKG_ROOT:-}${GZIP_PREFIX}/bin/${FILE}.gzip${GZIP_PREFIX:+.usr-is-merged}"
+                       mv "${DPKG_ROOT:-}${TRUENAME}" 
"${DPKG_ROOT:-}${GZIP_PREFIX}/bin/${FILE}.gzip${GZIP_SUFFIX}"
                        dpkg-divert --package zutils --quiet --add --rename 
--divert /usr/share/man/man1/${FILE}.gzip.1.gz /usr/share/man/man1/${FILE}.1.gz
                done
                ;;
@@ -85,8 +89,14 @@
                                                mv "${DPKG_ROOT}${TRUENAME}" 
"${DPKG_ROOT}/bin/${FILE}.gzip.usr-is-merged"
                                        fi
                                fi
-                       elif [ "${TRUENAME}" != "/usr/bin/${FILE}.gzip" ]
+                       elif [ "${TRUENAME}" = "/usr/bin/${FILE}.gzip" ]
                        then
+                               # 1.14-4 wrongly moved files. Fix.
+                               if [ -e 
"${DPKG_ROOT:-}/usr/bin/${FILE}.gzip.usr-is-merged" ] && ! [ -e 
"${DPKG_ROOT:-}/usr/bin/${FILE}.gzip" ]
+                               then
+                                       mv 
"${DPKG_ROOT:-}/usr/bin/${FILE}.gzip.usr-is-merged" 
"${DPKG_ROOT:-}/usr/bin/${FILE}.gzip"
+                               fi
+                       else
                                die "unexpected diversion of /usr/bin/${FILE} 
to ${TRUENAME}"
                        fi
                done

Attachment: testcase.sh
Description: Bourne shell script

TESTS= \
        unpgzip-confgzip-unpzutils-confzutils-rmzutils \
        unpgzip-confgzip-unpzutils-rmzutils \
        unpgzip-unpzutils-confgzip-confzutils-rmzutils \
        unpgzip-unpzutils-confgzip-rmzutils \
        unpgzip-unpzutils-confzutils-confgzip-rmzutils \
        unpgzip-unpzutils-confzutils-rmzutils-confgzip \
        unpgzip-unpzutils-rmzutils-confgzip \
        unpzutils-unpgzip-confgzip-confzutils-rmzutils \
        unpzutils-unpgzip-confgzip-rmzutils \
        unpzutils-unpgzip-confzutils-confgzip-rmzutils \
        unpzutils-unpgzip-confzutils-rmzutils-confgzip \
        unpzutils-unpgzip-rmzutils-confgzip \
        unpzutils-confzutils-unpgzip-confgzip-rmzutils \
        unpzutils-confzutils-rmzutils \
        unpzutils-rmzutils-unpgzip-confgzip \
        withzutils-deinstzutils-unpgzip-rmzutils-confgzip \
        
withzutils-deinstzutils-unpgzip-rmzutils-unpzutils-confgzip-confzutils-rmzutils 
\
        
withzutils-deinstzutils-unpgzip-rmzutils-unpzutils-confzutils-confgzip-rmzutils 
\
        withzutils-unpzutils-unpgzip-confgzip-confzutils-rmzutils \
        withzutils-unpzutils-unpgzip-confzutils-confgzip-rmzutils \
        withzutils-unpzutils-unpgzip-rmzutils-confgzip \
        withzutils-unpzutils-confzutils-unpgzip-confgzip-rmzutils \


all: $(foreach t,$(TESTS),testout/$(t))

testout/%:
        ./testcase.sh "$*" >"$@" 2>&1; echo $$? >> "$@"

Reply via email to