[PATCH 2/4] scripts: add "scan" mode to process-advisories.sh to find more backports

Rolf Eike Beer <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization emlix GmbH
Message-ID <[email protected]>
This will look through the stable branches to find additional backports of 
the fix for the given advisory.

Signed-off-by: Rolf Eike Beer <[email protected]>
---
 scripts/process-advisories.sh | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/scripts/process-advisories.sh b/scripts/process-advisories.sh
index a520fab5e6..00a8cd9416 100755
--- a/scripts/process-advisories.sh
+++ b/scripts/process-advisories.sh
@@ -25,7 +25,7 @@ command=$1
 
 usage () {
     cat >&2 <<EOF
-usage: $0 {update|news}
+usage: $0 {update|news|scan}
 EOF
     exit 1
 }
@@ -33,7 +33,7 @@ EOF
 command="$1"
 
 case "$command" in
-    update|news)
+    update|news|scan)
     ;;
     *)
         usage
@@ -69,6 +69,36 @@ advisories_update() {
     done
 }
 
+advisories_scan() {
+  advisory=$1
+
+  if [ -z $1 ]; then
+    echo "Usage: $0 update GLIBC-SA-YYYY-NNNN"
+    exit 1
+  fi
+
+  advisory_file=advisories/$advisory
+
+  FIX=$(sed -nr '/^Fix-Commit: /s/Fix-Commit: *([0-9a-fA-F]+) *\(2\.[0-9]+\).*/\1/p' $advisory_file)
+
+  if [ -z "${FIX}" ]; then
+    echo "No Fix-Commit found in $advisory_file"
+    exit 1
+  fi
+
+  for n in $(seq 20 44); do
+    BACKPORT=($(git log ..origin/release/2.${n}/master --grep "cherry picked from commit ${FIX}"   --format=%H))
+    if [ ${#BACKPORT[@]} -eq 0 ]; then
+      continue
+    fi
+    if [ ${#BACKPORT[@]} -ne 1 ]; then
+      echo "Multiple matches for backport of ${FIX} found in branch 2.${n}"
+      continue
+    fi
+    grep -q "^Fix-Commit: ${BACKPORT[0]} " $advisory_file || echo "Fix-Commit: ${BACKPORT[0]} ($(get_rel ${BACKPORT[0]}))" >> $advisory_file
+  done
+}
+
 advisories_news() {
   rel=$(get_rel "HEAD")
   for f in $(grep -l "^Fix-Commit: .* ($rel)$" advisories/*); do
-- 
2.55.0

-- 
Save the date!

Embedded Linux for Safe and Secure Applications

eLSA Symposium
October 1 and 2, 2026
Eden Hotel Göttingen
e-mail:[email protected]
https://elsa-symposium.com/

emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail [email protected]
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
Office München: Am Knie 16, 81241 München, Germany
http://www.emlix.com

emlix - your embedded Linux partner
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.