repo-add: ensure path to LOCKFILE is always absolute
Given our semi-frequent use of pushd/popd, if we are in any directory but the original and the database path given was relative, we won't unlock the database file when cleaning up after an error. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
2752932d19
commit
6a9ed33055
|
@ -411,13 +411,8 @@ elephant() {
|
||||||
check_repo_db() {
|
check_repo_db() {
|
||||||
local repodir
|
local repodir
|
||||||
|
|
||||||
# ensure the path to the DB exists
|
# ensure the path to the DB exists; $LOCKFILE is always an absolute path
|
||||||
if [[ "$LOCKFILE" == /* ]]; then
|
repodir=${LOCKFILE%/*}/
|
||||||
repodir=${LOCKFILE%/*}/
|
|
||||||
else
|
|
||||||
repodir=$PWD/$LOCKFILE
|
|
||||||
repodir=${repodir%/*}/
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "$repodir" ]]; then
|
if [[ ! -d "$repodir" ]]; then
|
||||||
error "$(gettext "%s does not exist or is not a directory.")" "$repodir"
|
error "$(gettext "%s does not exist or is not a directory.")" "$repodir"
|
||||||
|
@ -624,7 +619,11 @@ if [[ -z $REPO_DB_FILE ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LOCKFILE=$REPO_DB_FILE.lck
|
if [[ $REPO_DB_FILE == /* ]]; then
|
||||||
|
LOCKFILE=$REPO_DB_FILE.lck
|
||||||
|
else
|
||||||
|
LOCKFILE=$PWD/$REPO_DB_FILE.lck
|
||||||
|
fi
|
||||||
|
|
||||||
verify_repo_extension "$REPO_DB_FILE" >/dev/null
|
verify_repo_extension "$REPO_DB_FILE" >/dev/null
|
||||||
check_repo_db
|
check_repo_db
|
||||||
|
|
Loading…
Reference in New Issue