[PATCH cygport] autotools: gnuconfigize: prevent downgrade of config.{guess,sub}

Christian Franke via Cygwin-apps <[email protected]>
Newsgroups gmane.os.cygwin.applications
Message-ID <[email protected]>
Addresses: https://sourceware.org/pipermail/cygwin/2025-August/258736.html

-- 
Regards,
Christian
0001-autotools-gnuconfigize-prevent-downgrade-of-config.-.patch (text/plain, 1.4 KB)
From f1f39b5f61c2560151f8b6594eee20c957481e83 Mon Sep 17 00:00:00 2001
From: Christian Franke <[email protected]>
Date: Mon, 1 Sep 2025 12:12:26 +0200
Subject: [PATCH] autotools: gnuconfigize: prevent downgrade of
 config.{guess,sub}

---
 cygclass/autotools.cygclass | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass
index 55be6709..69cced56 100644
--- a/cygclass/autotools.cygclass
+++ b/cygclass/autotools.cygclass
@@ -191,12 +191,25 @@ __parse_aclocal_amflags() {
 #****
 
 gnuconfigize() {
+	local d f ts_old ts_new
+
 	(( $# >= 1 )) || error "gnuconfigize: no destinations specified"
 
 	for d in $@
 	do
-		[ -f $d/config.guess ] || error "gnuconfigize: $d: not a gnuconfig directory"
-		cp -f ${_privgnuconfigdir}/config.{guess,sub} $d/
+		for f in config.{guess,sub}
+		do
+			[ -f ${d}/${f} ] || error "gnuconfigize: $d: not a gnuconfig directory"
+			ts_old=$(sed -n "s/^timestamp='\([-0-9]*\)'.*$/\1/p" ${d}/${f})
+			ts_new=$(sed -n "s/^timestamp='\([-0-9]*\)'.*$/\1/p" ${_privgnuconfigdir}/${f})
+			if ! [ "${ts_old}" '<' "${ts_new}" ]
+			then
+				inform "${f}: not downgraded from '${ts_old}' to '${ts_new}'"
+				continue
+			fi
+			cp -f ${_privgnuconfigdir}/${f} ${d}/
+			inform "${f}: updated from '${ts_old}' to '${ts_new}'"
+		done
 	done
 }
 
-- 
2.45.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.