freebsd-update: Add some diagnositic information for a failure case

Users report freebsd-update failing with "The update metadata index is
correctly signed, but failed an integrity check."  Add a hint at which
of the cases is failing to help track down the issue.

PR:		264205
Reviewed by:	dch
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52222
This commit is contained in:
Ed Maste
2025-08-28 12:04:06 -04:00
parent 3c5ca68b9b
commit af4ba95daf
+8 -8
View File
@@ -1402,7 +1402,7 @@ fetch_metadata_index () {
fetch_metadata_bogus () {
echo
echo "The update metadata$1 is correctly signed, but"
echo "failed an integrity check."
echo "failed an integrity check ($2)."
echo "Cowardly refusing to proceed any further."
return 1
}
@@ -1413,7 +1413,7 @@ fetch_metadata_index_merge () {
for METAFILE in $@; do
if [ `grep -E "^${METAFILE}\|" ${TINDEXHASH} | wc -l` \
-ne 1 ]; then
fetch_metadata_bogus " index"
fetch_metadata_bogus " index" "${METAFILE} count not 1"
return 1
fi
@@ -1436,7 +1436,7 @@ fetch_metadata_index_merge () {
# specifically grepped out of ${TINDEXHASH}.
fetch_metadata_index_sanity () {
if grep -qvE '^[0-9A-Z.-]+\|[0-9a-f]{64}$' tINDEX.new; then
fetch_metadata_bogus " index"
fetch_metadata_bogus " index" "unexpected entry in tINDEX.new"
return 1
fi
}
@@ -1453,7 +1453,7 @@ fetch_metadata_sanity () {
# Check that the first four fields make sense.
if gunzip -c < files/$1.gz |
grep -qvE "^[a-z]+\|[0-9a-z-]+\|${P}+\|[fdL-]\|"; then
fetch_metadata_bogus ""
fetch_metadata_bogus "" "invalid initial fields"
return 1
fi
@@ -1464,28 +1464,28 @@ fetch_metadata_sanity () {
# Sanity check entries with type 'f'
if grep -E '^f' sanitycheck.tmp |
grep -qvE "^f\|${M}\|${H}\|${P}*\$"; then
fetch_metadata_bogus ""
fetch_metadata_bogus "" "invalid type f entry"
return 1
fi
# Sanity check entries with type 'd'
if grep -E '^d' sanitycheck.tmp |
grep -qvE "^d\|${M}\|\|\$"; then
fetch_metadata_bogus ""
fetch_metadata_bogus "" "invalid type d entry"
return 1
fi
# Sanity check entries with type 'L'
if grep -E '^L' sanitycheck.tmp |
grep -qvE "^L\|${M}\|${P}*\|\$"; then
fetch_metadata_bogus ""
fetch_metadata_bogus "" "invalid type L entry"
return 1
fi
# Sanity check entries with type '-'
if grep -E '^-' sanitycheck.tmp |
grep -qvE "^-\|\|\|\|\|\|"; then
fetch_metadata_bogus ""
fetch_metadata_bogus "" "invalid type - entry"
return 1
fi