Bug 135 - Typo in locking code for nsdc
Typo in locking code for nsdc
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
2.3.x
All All
: P2 minor
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-10 12:58 CEST by Stephane Bortzmeyer
Modified: 2006-07-25 13:49 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Bortzmeyer 2006-07-10 12:58:41 CEST
--- nsdc.sh.in.orig     2006-07-10 12:55:04.298458274 +0200
+++ nsdc.sh.in  2006-07-10 12:55:12.585261093 +0200
@@ -54,7 +54,7 @@
 
 lock() {
         (umask 222; echo "database locked by PID: $$" >${lockfile}) ||
-                (cat ${lockfile} ; "echo aborting..." ; exit 1)
+                (cat ${lockfile} ; echo "aborting..." ; exit 1)
 }
 
 unlock() {
Comment 1 Stephane Bortzmeyer 2006-07-10 14:05:17 CEST
A better patch:

diff -u nsdc.sh.in.orig nsdc.sh.in
--- nsdc.sh.in.orig     2006-07-10 12:55:04.298458274 +0200
+++ nsdc.sh.in  2006-07-10 14:04:23.372813022 +0200
@@ -54,7 +54,8 @@
 
 lock() {
         (umask 222; echo "database locked by PID: $$" >${lockfile}) ||
-                (cat ${lockfile} ; "echo aborting..." ; exit 1)
+                (cat ${lockfile} ; echo "aborting..." ; exit 1)
+        [ $? = 0 ] || exit 1
 }
 
 unlock() {

Because exit 1 makes you get out of the subshell, not out of nsdc...

(The patch is running on a production machine, ns2.nic.fr)
Comment 2 Wouter Wijngaards 2006-07-25 13:49:52 CEST
Fixed, thanks for the patch.