commit: b1d0c6687812ce83f4bfd431322274ba8b47c7f5 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon May 12 19:14:21 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon May 12 19:16:34 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1d0c668
app-portage/cfg-update: fix uninitialised value The patch is from Phil and Kerin kindly reviewed it. I haven't looked to see if this fixes bug #650806 as well, but it may. Bug: https://bugs.gentoo.org/650806 Closes: https://bugs.gentoo.org/829993 Thanks-to: Phil Stracchino (Unix Ronin) <phils <AT> caerllewys.net> Thanks-to: Kerin Millar <kfm <AT> plushkava.net> Signed-off-by: Sam James <sam <AT> gentoo.org> app-portage/cfg-update/cfg-update-1.8.9-r3.ebuild | 106 +++++++++++++++++++++ .../files/cfg-update-1.8.9-uninit-value.patch | 16 ++++ 2 files changed, 122 insertions(+) diff --git a/app-portage/cfg-update/cfg-update-1.8.9-r3.ebuild b/app-portage/cfg-update/cfg-update-1.8.9-r3.ebuild new file mode 100644 index 000000000000..f4abb70f8e13 --- /dev/null +++ b/app-portage/cfg-update/cfg-update-1.8.9-r3.ebuild @@ -0,0 +1,106 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Easy to use GUI & CLI alternative for etc-update" +HOMEPAGE="https://github.com/rich0/cfg-update" +SRC_URI="https://github.com/rich0/cfg-update/archive/${PV}.tar.gz -> ${P}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86" +IUSE="X" + +RDEPEND=" + dev-perl/TermReadKey + X? ( + >=x11-misc/sux-1.0 + x11-apps/xhost + )" + +S="${WORKDIR}/rich0-cfg-update-2f10786" + +PATCHES=( + "${FILESDIR}"/${PN}-1.8.9-uninit-value.patch +) + +pkg_prerm() { + if [[ -z ${ROOT} ]] + then + ebegin "Disabling portage hook" + cfg-update --ebuild --disable-portage-hook + eend $? + ebegin "Disabling paludis hook" + cfg-update --ebuild --disable-paludis-hook + eend $? + fi +} + +pkg_postrm() { + echo + ewarn "If you want to permanently remove cfg-update from your system" + ewarn "you should remove the index file /var/lib/cfg-update/checksum.index" + echo +} + +src_install() { + dobin \ + cfg-update emerge_with_indexing_for_cfg-update \ + emerge_with_indexing_for_cfg-update_phphelper \ + cfg-update_phphelper emerge_with_indexing_for_cfg-update_bashhelper + insinto /usr/lib/cfg-update + doins cfg-update cfg-update_indexing test.tgz + dodoc ChangeLog + doman *.8 + insinto /etc + doins cfg-update.conf cfg-update.hosts + keepdir /var/lib/cfg-update +} + +pkg_postinst() { + if [[ ! -e "${ROOT}"/var/lib/cfg-update/checksum.index \ + && -e "${ROOT}"/var/lib/cfg-update/checksum.index ]] + then + ebegin "Moving checksum.index from /usr/lib/cfg-update to /var/lib/cfg-update" + mv "${ROOT}"/usr/lib/cfg-update/checksum.index \ + "${ROOT}"/var/lib/cfg-update/checksum.index + eend $? + fi + + if [[ -e "${ROOT}"/usr/bin/paludis ]] + then + echo + ewarn "If you have used Paludis version <0.20.0 on your system, chances are" + ewarn "that you have some corrupted CONTENTS files on your system..." + echo + ewarn "Please run: cfg-update --check-packages" + echo + ewarn "The above command will check all packages installed with Paludis and" + ewarn "will output a list of packages that need to be re-installed with" + ewarn "Paludis 0.20.0 or higher. If you do not re-install these packages" + ewarn "you risk losing your custom settings when updating configuration" + ewarn "files, that belong to these packages, with cfg-update!" + echo + fi + + if [[ -z ${ROOT} ]] + then + ebegin "Moving backups to /var/lib/cfg-update/backups" + /usr/bin/cfg-update --ebuild --move-backups + eend $? + fi + + echo + einfo "If this is a first time install, please check the configuration" + einfo "in /etc/cfg-update.conf before using cfg-update:" + echo + einfo "If your system does not have an X-server installed you need to" + einfo "change the MERGE_TOOL to sdiff, imediff2 or vimdiff." + einfo "If you have X installed, set MERGE_TOOL to your favorite GUI tool:" + einfo "xxdiff, beediff, kdiff3, meld (default), gtkdiff, gvimdiff, tkdiff" + echo + einfo "TIP: to maximize the chances of future automatic updates, run:" + einfo "cfg-update --optimize-backups" + echo +} diff --git a/app-portage/cfg-update/files/cfg-update-1.8.9-uninit-value.patch b/app-portage/cfg-update/files/cfg-update-1.8.9-uninit-value.patch new file mode 100644 index 000000000000..51f1e000da4d --- /dev/null +++ b/app-portage/cfg-update/files/cfg-update-1.8.9-uninit-value.patch @@ -0,0 +1,16 @@ +https://bugs.gentoo.org/829993 +--- a/cfg-update ++++ b/cfg-update +@@ -995,11 +995,11 @@ + if ($opt_d >= 1) { print "$tab"." grep \"$file1_without_host \" $host_path$index_file $debug | cut -d\" \" -f2 $debug\n"; } + local $ENV{LC_ALL}="C"; + chomp ($md5sum_index = `grep "$file1_without_host " "$host_path$index_file" $debug | cut -d" " -f2 $debug`); + if ($opt_d >= 1) { print "$tab"." MD5 checksum in the checksum-index : $md5sum_index\n"; } + if ($md5sum_index =~ /.+/) { +- if ($md5sum_index !~ $md5sum_file) { ++ if (length($md5sum_file) && $md5sum_index !~ $md5sum_file) { + $state = $state1; $vstate = $vstate1; # 1 = MF = Modified File - checksum differs from index + if (-B "$file1") { $state = $state2; $vstate = $vstate2; } # 2 = MB = Modified Binary - you probably replaced the binary file so replace not allowed + } else { + $state = $state3; $vstate = $vstate3; # 3 = UF = Unmodified File - checksum matches with index + if (-B "$file1") { $state = $state4; $vstate = $vstate4; } # 4 = UB = Unmodified Binary - unmodified binary file so replace always allowed
