Addresses: https://sourceware.org/pipermail/cygwin/2025-August/258736.html

--
Regards,
Christian

From f1f39b5f61c2560151f8b6594eee20c957481e83 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.fra...@t-online.de>
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

Reply via email to