Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2024-04-27 02:18:05 +0200
committerLevente Polyak <anthraxx@archlinux.org>2024-04-28 15:56:00 +0200
commit35b417d226fc3d11ac0015abdcb3594d2c696c2e (patch)
tree413a6d7847ebf5a8df554a465b61a2b8d0504a78 /src
parent1d433f600e6eecfe685650a06e58d1a8edae9b5d (diff)
fix(db): check valid target repo on db remove
Return an error and abort operation when an invalid target repo is passed. Component: pkgctl db remove Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/lib/db/remove.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/db/remove.sh b/src/lib/db/remove.sh
index 6ca091d..cddcc1d 100644
--- a/src/lib/db/remove.sh
+++ b/src/lib/db/remove.sh
@@ -12,6 +12,8 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/pacman.sh
# shellcheck source=src/lib/util/term.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/term.sh
+# shellcheck source=src/lib/valid-repos.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh
set -e
@@ -92,6 +94,11 @@ pkgctl_db_remove() {
PKGBASES+=("$@")
pkgnames=("${PKGBASES[@]}")
+ # check if the target repo is valid
+ if ! in_array "${REPO}" "${DEVTOOLS_VALID_REPOS[@]}"; then
+ die "Invalid repository target: %s" "${REPO}"
+ fi
+
# update pacman cache to query all pkgnames
if (( ! partial )); then
case ${REPO} in