Release managers, I would like to upload to 12.1 a new package to fix 
this (and other minor issues).


On Jun 22, Andreas Beckmann <a...@debian.org> wrote:

> Package: usrmerge
> Version: 35
> Severity: important
> Tags: patch
> 
> bootstrapping a merged-/usr system or earlier conversions may have
> created empty biarch directories and links to them, e.g.
>   /usr/libx32
>   /libx32 -> /usr/libx32
> 
> Since glibc 2.35-4 this is handled by the respective glibc packages
> and usrmerge has stopped creating them.
> 
> So let's clean them up (once) on upgrades of the usrmerge/usr-is-merged
> packages if they are not owned by any package according to the dpkg
> database. Otherwise they might suddenly disappear after installation and
> removal of a package "owning" them.
> 
> While the existence/disappearance of these directories and links is
> harmless for a regular system, it is nasty for doing QA testing since
> that may trigger an error on sudden disappearance of files/directories
> (at non-volatile locations). Ignoring these locations is not a good
> idea, since it might hide actual bugs mishandling the biarc locations.
> 
> I've been running piuparts bullseye -> bookworm upgrade tests with this
> patch applied and that solved all the unexpected disappearance of biarch
> directories and links.
> 
> 
> Andreas

> >From 6a07b047055ef2d05ab3381f9f7ce64c21f6b60b Mon Sep 17 00:00:00 2001
> From: Andreas Beckmann <a...@debian.org>
> Date: Sun, 28 May 2023 14:20:21 +0200
> Subject: [PATCH] postinst: Clean up the unused empty biarch directories
> 
> bootstrapping or earlier conversions may have created empty biarch
> directories and links. glibc 2.35-4 or later will create them if
> needed, so clean up the unused (and unowned) ones
> 
> Closes: #
> ---
>  debian/usr-is-merged.postinst | 28 ++++++++++++++++++++++++++++
>  debian/usrmerge.postinst      | 22 +++++++++++++++++++++-
>  2 files changed, 49 insertions(+), 1 deletion(-)
>  create mode 100644 debian/usr-is-merged.postinst
> 
> diff --git a/debian/usr-is-merged.postinst b/debian/usr-is-merged.postinst
> new file mode 100644
> index 0000000..3d0e0c5
> --- /dev/null
> +++ b/debian/usr-is-merged.postinst
> @@ -0,0 +1,28 @@
> +#!/bin/sh
> +set -e
> +
> +cleanup_biarch_dirs() {
> +  # bootstrapping or earlier conversions may have created empty biarch
> +  # directories and links. glibc 2.35-4 or later will create them if needed,
> +  # so clean up the unused (and unowned) ones
> +  local arch_directories="/lib64 /lib32 /libo32 /libx32"
> +  for dir in $arch_directories; do
> +    [ -e "$dir" ] || continue
> +    if ! dpkg-query -S $dir >/dev/null 2>&1; then
> +      rm -v $dir
> +      if [ -e /usr$dir ] && ! dpkg-query -S /usr$dir >/dev/null 2>&1 ; then
> +        rmdir --ignore-fail-on-non-empty -v /usr$dir
> +      fi
> +    fi
> +  done
> +}
> +
> +case "$1" in
> +    configure)
> +      if dpkg --compare-versions "$2" lt "36~" ; then
> +        cleanup_biarch_dirs
> +      fi
> +    ;;
> +esac
> +
> +#DEBHELPER#
> diff --git a/debian/usrmerge.postinst b/debian/usrmerge.postinst
> index 257f0e5..057b7f1 100644
> --- a/debian/usrmerge.postinst
> +++ b/debian/usrmerge.postinst
> @@ -1,4 +1,5 @@
> -#!/bin/sh -e
> +#!/bin/sh
> +set -e
>  
>  is_fs() {
>    local fs_type
> @@ -49,6 +50,22 @@ END
>    /usr/lib/usrmerge/convert-usrmerge || return $?
>  }
>  
> +cleanup_biarch_dirs() {
> +  # bootstrapping or earlier conversions may have created empty biarch
> +  # directories and links. glibc 2.35-4 or later will create them if needed,
> +  # so clean up the unused (and unowned) ones
> +  local arch_directories="/lib64 /lib32 /libo32 /libx32"
> +  for dir in $arch_directories; do
> +    [ -e "$dir" ] || continue
> +    if ! dpkg-query -S $dir >/dev/null 2>&1; then
> +      rm -v $dir
> +      if [ -e /usr$dir ] && ! dpkg-query -S /usr$dir >/dev/null 2>&1 ; then
> +        rmdir --ignore-fail-on-non-empty -v /usr$dir
> +      fi
> +    fi
> +  done
> +}
> +
>  case "$1" in
>      configure)
>       # Skip the conversion for buildds.
> @@ -59,6 +76,9 @@ case "$1" in
>         echo "W: /etc/unsupported-skip-usrmerge-conversion exists." >&2
>       else
>         maybe_convert "$@" || { echo "E: usrmerge failed." >&2; exit 1; }
> +       if dpkg --compare-versions "$2" lt "36~" ; then
> +         cleanup_biarch_dirs
> +       fi
>         /usr/lib/usrmerge/convert-etc-shells
>       fi
>      ;;
> -- 
> 2.20.1
> 


-- 
ciao,
Marco

Attachment: signature.asc
Description: PGP signature

Reply via email to