diff -Nru ucf-3.0043/debian/changelog ucf-3.0043ubuntu1/debian/changelog --- ucf-3.0043/debian/changelog 2020-06-16 07:37:53.000000000 +0200 +++ ucf-3.0043ubuntu1/debian/changelog 2024-04-24 16:09:16.000000000 +0200 @@ -1,3 +1,10 @@ +ucf (3.0043ubuntu1) jammy; urgency=medium + + * Respect any diversions by dpkg-divert and fix syntax + errors in ucf in handling diversions (LP: #2061825) + + -- Ponnuvel Palaniyappan Wed, 24 Apr 2024 15:09:16 +0100 + ucf (3.0043) unstable; urgency=high * The argument to dpkg-divert needs to be the actual file name, not the diff -Nru ucf-3.0043/debian/control ucf-3.0043ubuntu1/debian/control --- ucf-3.0043/debian/control 2020-06-16 07:37:53.000000000 +0200 +++ ucf-3.0043ubuntu1/debian/control 2024-04-24 16:09:16.000000000 +0200 @@ -3,7 +3,8 @@ VCS-Browser: https://salsa.debian.org/srivasta/ucf Section: utils Priority: standard -Maintainer: Manoj Srivastava +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Manoj Srivastava Build-Depends: debhelper-compat (=12) Build-Depends-Indep: po-debconf, gettext Standards-Version: 4.3.0 diff -Nru ucf-3.0043/ucf ucf-3.0043ubuntu1/ucf --- ucf-3.0043/ucf 2020-06-16 07:37:53.000000000 +0200 +++ ucf-3.0043ubuntu1/ucf 2024-04-24 16:09:16.000000000 +0200 @@ -439,16 +439,10 @@ fi # Follow dpkg-divert as though we are installed as part of $opt_package -divert_line=$(dpkg-divert --list "$dest_file") +divert_line=$(dpkg-divert --listpackage "$dest_file") if [ -n "$divert_line" ]; then - if [ echo "$divert_line" | grep "^local" ]; then - # local diversion; pick something not in the package namespace - divert_package="LOCAL" - else - # extract the name of the diverted package. - # The fact that this requires output parsing is bug #485012 - divert_package=$(dpkg-divert --listpackage "$dest_file") - fi + # name of the package or 'LOCAL' for a local diversion + divert_package="$divert_line" if [ "$divert_package" != "$opt_package" ]; then dest_file=$(dpkg-divert --truename "$dest_file") diff -Nru ucf-3.0043/ucfr ucf-3.0043ubuntu1/ucfr --- ucf-3.0043/ucfr 2020-06-16 07:37:53.000000000 +0200 +++ ucf-3.0043ubuntu1/ucfr 2024-04-24 16:09:16.000000000 +0200 @@ -112,10 +112,18 @@ awk '{print $1;}' ); if [ "$pkg" != "$old_pkg" ]; then - if [ "X$FORCE" = "X" ]; then - echo >&2 "$progname: Attempt from package $pkg to take ${real_conf_file} away from package $old_pkg"; - echo >&2 "ucfr: Aborting."; - exit 4; + divert_package=$(dpkg-divert --listpackage "$conf_file") + if [ -n "$divert_package" ]; then + if [ "X$VERBOSE" != "X" ]; then + echo >&2 "$progname: Package $pkg will not take away diverted ${conf_file} from package $divert_package"; + fi + exit 0; + else + if [ "X$FORCE" = "X" ]; then + echo >&2 "$progname: Attempt from package $pkg to take ${real_conf_file} away from package $old_pkg"; + echo >&2 "ucfr: Aborting."; + exit 4; + fi fi else if [ "X$VERBOSE" != "X" ]; then