vsed: strip non-digest part before comparing
Accidentally, this change also fixs a potential bug if `XBPS_DIGEST_CMD` is changed to something other than its current value: `xbps-uhelper digest'. Because the old code compares: - non-stripped old digest; and - stripped new digest
This commit is contained in:
parent
c384f85d2b
commit
9374b6938e
1 changed files with 3 additions and 1 deletions
|
@ -47,6 +47,7 @@ vsed() {
|
|||
for rx in "${regexes[@]}"; do
|
||||
for f in "${files[@]}"; do
|
||||
olddigest="$($XBPS_DIGEST_CMD "$f")"
|
||||
olddigest="${olddigest%% *}"
|
||||
|
||||
sed -i "$f" -e "$rx" || {
|
||||
msg_red "$pkgver: vsed: sed call failed with regex \"$rx\" on file \"$f\"\n"
|
||||
|
@ -54,8 +55,9 @@ vsed() {
|
|||
}
|
||||
|
||||
newdigest="$($XBPS_DIGEST_CMD "$f")"
|
||||
newdigest="${newdigest%% *}"
|
||||
|
||||
if [ "$olddigest" = "${newdigest%% *}" ]; then
|
||||
if [ "$olddigest" = "$newdigest" ]; then
|
||||
msg_warn "$pkgver: vsed: regex \"$rx\" didn't change file \"$f\"\n"
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue