aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-01-04 11:41:57 +0000
committermerakor <cem@ckyln.com>2021-01-04 11:41:57 +0000
commitbf988706fa4bdd863bdf1c6bf95e03bb68ab08c0 (patch)
treeb5c6b917b439f8959a82d2fcf5522ba3209bfd7b
parentf1e84e565fc534fd4795fadf6bafa0f30b0520ba (diff)
downloadcpt-bf988706fa4bdd863bdf1c6bf95e03bb68ab08c0.tar.gz
pkg_swap(): fix swap regular expression
This bug caused swapping prefix files to malfunction on manifest files. Example: swapping redo caused redo-* files to be swapped on the manifest with the name 'redo' without actually moving the files to the alternatives directory either. FossilOrigin-Name: 5966d079397154246173b94f53de83212c20edeb53f75089092cec352e6316f4
-rw-r--r--src/cpt-lib4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cpt-lib b/src/cpt-lib
index c75fbcf..6afd030 100644
--- a/src/cpt-lib
+++ b/src/cpt-lib
@@ -1281,7 +1281,7 @@ pkg_swap() {
# its manifest file to reflect this. We then resort this file
# so no issues arise when removing packages.
cp -Pf "$CPT_ROOT/$2" "$pkg_owns>${alt#*>}"
- sed "s#^$(regesc "$2")#${PWD#$CPT_ROOT}/$pkg_owns>${alt#*>}#" \
+ sed "s#^$(regesc "$2")\$#${PWD#$CPT_ROOT}/$pkg_owns>${alt#*>}#" \
"../installed/$pkg_owns/manifest" |
sort -r -o "../installed/$pkg_owns/manifest"
fi
@@ -1289,7 +1289,7 @@ pkg_swap() {
# Convert the desired alternative to a real file and rewrite
# the manifest file to reflect this. The reverse of above.
mv -f "$alt" "$CPT_ROOT/$2"
- sed "s#^${PWD#$CPT_ROOT}/$(regesc "$alt")#$2#" "../installed/$1/manifest" |
+ sed "s#^${PWD#$CPT_ROOT}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" |
sort -r -o "../installed/$1/manifest"
}