pacdiff: don't assume the DBPath has a trailing slash

Message ID 20181211045144.13256-1-eschwartz@archlinux.org
State Accepted, archived
Headers show
Series pacdiff: don't assume the DBPath has a trailing slash | expand

Commit Message

Eli Schwartz Dec. 11, 2018, 4:51 a.m. UTC
If pacman-conf returns a DBPath without a trailing slash, then the
script will error out with:

ERROR: unable to read pacman database /var/lib/pacmanlocal

Which is obviously wrong.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 src/pacdiff.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/src/pacdiff.sh.in b/src/pacdiff.sh.in
index 2702451..dbe94ec 100644
--- a/src/pacdiff.sh.in
+++ b/src/pacdiff.sh.in
@@ -142,7 +142,7 @@  if (( USE_PACDB )); then
 		error "unable to read @sysconfdir@/pacman.conf"
 		usage; exit 1
 	fi
-	pac_db="${DBPath:-@localstatedir@/lib/pacman/}local"
+	pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
 	if [[ ! -d "${pac_db}" ]]; then
 		error "unable to read pacman database %s". "${pac_db}"
 		usage; exit 1