Refer to C23 in place of C2X in glibc
[glibc.git] / scripts / process-advisories.sh
bloba520fab5e6f9a5ce5527fc755929ce23da7b7780
1 #!/bin/bash -e
2 # Copyright The GNU Toolchain Authors.
3 # This file is part of the GNU C Library.
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <https://www.gnu.org/licenses/>.
19 if ! [ -d advisories ]; then
20 echo "error: Run me from the toplevel directory of the glibc repository."
21 exit 1
24 command=$1
26 usage () {
27 cat >&2 <<EOF
28 usage: $0 {update|news}
29 EOF
30 exit 1
33 command="$1"
35 case "$command" in
36 update|news)
39 usage
41 esac
43 get_rel() {
44 rel=$(git describe $1 | sed 's/glibc-\([^g]\+\)-g.*/\1/')
45 # If the latest tag for the commit is the development tag, then increment
46 # the release version.
47 if echo $rel | grep -q "\.9000"; then
48 rel=$(echo $rel | sed 's/2\.\([0-9]\+\)\.9000.*/\1/')
49 rel="2.$((rel+1))"
51 echo $rel
54 advisories_update() {
55 advisory=$1
57 if [ -z $1 ]; then
58 echo "Usage: $0 update GLIBC-SA-YYYY-NNNN"
59 exit 1
62 advisory_file=advisories/$advisory
64 grep --color=none Commit $advisory_file | awk '{printf "%s %s\n", $1, $2}' |
65 while read t r; do
66 rel=$(get_rel $r)
67 echo "*** Updating: $t $r ($rel)"
68 sed -i "s/^$t $r.*/$t $r ($rel)/" $advisory_file
69 done
72 advisories_news() {
73 rel=$(get_rel "HEAD")
74 for f in $(grep -l "^Fix-Commit: .* ($rel)$" advisories/*); do
75 echo -e " $(basename $f):"
76 cve_id=$(sed -n 's/CVE-Id: \(.*\)/\1/p' $f)
77 echo "$(head -1 $f) ($cve_id)" | fold -w 68 -s |
78 while read line; do
79 echo " $line"
80 done
81 echo
82 done
85 advisories_$command $2