Hello, This is not really a bug since calcurse states what to do. However, the behavior is still present in the 2.8 version of calcurse.
You will find in attachment a patch which I believe fix the problem. If there is a .calcurse.pid file. The patch reads the pid from the file and tries to see if it can sends signals to it. If kill states the process does not exist, then the existance of the lock is ignored. In any other case, the error message is displayed. If you believe the patch is reasonnable, I will send it upstream. I hope it is helpful. Best,
diff --git a/src/io.c b/src/io.c index f57e329..47bdccd 100755 --- a/src/io.c +++ b/src/io.c @@ -40,6 +40,7 @@ #include <string.h> #include <sys/stat.h> #include <sys/types.h> +#include <signal.h> #include <time.h> #include <math.h> #include <unistd.h> @@ -2952,7 +2953,7 @@ io_stop_psave_thread (void) * This sets a lock file to prevent from having two different instances of * calcurse running. * If the lock cannot be obtained, then warn the user and exit calcurse. - * Else, create a .calcurse.lock file in the user defined directory, which + * Else, create a .calcurse.pid file in the user defined directory, which * will be removed when calcurse exits. * * Note: when creating the lock file, the interactive mode is not initialized @@ -2961,9 +2962,25 @@ io_stop_psave_thread (void) void io_set_lock (void) { - FILE *lock; + FILE *lock = fopen (path_cpid, "r"); - if ((lock = fopen (path_cpid, "r")) != NULL) + int proc_exist = 0; + + if (lock != NULL) + { + /*if lock file exist, check whether the process exists*/ + int pid; + if (fscanf(lock, "%d", &pid) != 1) + proc_exist = 1; + else + { + int ret = kill(pid,0); + proc_exist = (!(ret != 0 && errno == ESRCH)); + } + fclose(lock); + } + + if (lock != NULL && proc_exist) { (void)fprintf (stderr, _("\nWARNING: it seems that another calcurse instance is "