[pacman-dev] [PATCH] repo-add: Remove lock on SIG{TERM, HUP, QUIT, INT, ERR}

Lukas Fleischer archlinux at cryptocrack.de
Tue Oct 11 12:13:17 EDT 2011


There's no need to keep the lock file if we interrupt repo-{add,remove}
using ^C (same applies to other signals).

In contrast to a clean exit, we do not `rm -rf` the temporary directory
here, so that it's still possible to analyze what went wrong.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
Hrm. Second time I had to manually remove
"/srv/ftp/community/os/$arch/community.db.tar.gz.lck" on sigurd in order
not to lock the whole database after interrupting `/arch/db-update`.

I hope I didn't miss anything here but this should hopefully not cause
any other unforeseen issues...

 scripts/repo-add.sh.in |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 29b150c..753200b 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -522,6 +522,9 @@ remove() {
 trap_exit() {
 	echo
 	error "$@"
+
+	(( CLEAN_LOCK )) && [[ -f $LOCKFILE ]] && rm -f "$LOCKFILE"
+
 	exit 1
 }
 
-- 
1.7.7



More information about the pacman-dev mailing list