aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-02 14:14:41 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-02 14:14:41 +0200
commitd8a5c423c4481b0d31a58c10ea476193432a1037 (patch)
tree8a45c1a3adc9e200065d474a27730a5b0f04bf9f
parentbb6a308a1de5eb2ed0aefdd187270a4103e0aa3d (diff)
downloadvulns-d8a5c423c4481b0d31a58c10ea476193432a1037.tar.gz
bippy: properly set the git ids to 12 characters
When picking up fix ids from "Fixes:" tags, the id was never "unified" causing all sorts of unknown sizes of git ids to end up in records (bigger and smaller.) Unify them by using the standard 12 characters. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rwxr-xr-xscripts/bippy27
1 files changed, 25 insertions, 2 deletions
diff --git a/scripts/bippy b/scripts/bippy
index b4257b67..1e70cc10 100755
--- a/scripts/bippy
+++ b/scripts/bippy
@@ -293,6 +293,14 @@ find_mainline_git_id()
echo "${stable_git}"
}
+#############################
+# git_full_id()
+# returns the "FULL" sha1 of the short git id passed in
+# arguments
+# "git id"
+# returns
+# "full git id" if found, "" if not found
+#############################
git_full_id()
{
local short_id=${1}
@@ -300,6 +308,21 @@ git_full_id()
echo "${long_id}"
}
+#############################
+# git_short_id()
+# returns the "SHORT" sha1 of the short git id passed in
+# arguments
+# "git id"
+# returns
+# "short git id" if found, "" if not found
+#############################
+git_short_id()
+{
+ local id=${1}
+ local short_id
+ short_id=$(cd "${KERNEL_TREE}" && git log -1 --abbrev=12 --format="%h" "${id}" 2> /dev/null)
+ echo "${short_id}"
+}
# =======
@@ -723,8 +746,8 @@ for entry in "${fixed_pairs[@]}"; do
x=(${entry//:/ })
vuln=${x[0]}
fix=${x[1]}
- vuln_git=${x[2]}
- fix_git=${x[3]}
+ vuln_git=$(git_short_id "${x[2]}") # unify the git id
+ fix_git=$(git_short_id "${x[3]}") # unify the git id
dbg " vuln=${vuln} fix=${fix} vuln_git=${vuln_git} fix_git=${fix_git}"
if [[ "${fix}" == "0" ]]; then