Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package liblockfile for openSUSE:Factory checked in at 2022-12-09 13:18:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/liblockfile (Old) and /work/SRC/openSUSE:Factory/.liblockfile.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "liblockfile" Fri Dec 9 13:18:04 2022 rev:2 rq:1041733 version:1.17 Changes: -------- --- /work/SRC/openSUSE:Factory/liblockfile/liblockfile.changes 2020-05-26 17:20:38.968146250 +0200 +++ /work/SRC/openSUSE:Factory/.liblockfile.new.1835/liblockfile.changes 2022-12-09 13:19:31.971560031 +0100 @@ -1,0 +2,9 @@ +Thu Dec 8 20:32:01 UTC 2022 - Dirk Müller <[email protected]> + +- udpate to 1.17: + * dotlockfile: '-i interval' option. + * dotlockfile: document -q + * add L_RMSTALE return status (failed to remove stale lock) + * remove cistron.nl email address + +------------------------------------------------------------------- Old: ---- liblockfile-1.16.tar.gz New: ---- liblockfile-1.17.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ liblockfile.spec ++++++ --- /var/tmp/diff_new_pack.HcKThE/_old 2022-12-09 13:19:32.391562262 +0100 +++ /var/tmp/diff_new_pack.HcKThE/_new 2022-12-09 13:19:32.395562284 +0100 @@ -1,6 +1,7 @@ # # spec file for package liblockfile # +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2020, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -15,13 +16,14 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # + %global sover 1 %global libname liblockfile%{sover} Name: liblockfile -Version: 1.16 +Version: 1.17 Release: 0 Summary: Library with NFS-safe locking functions -License: LGPL-2.0-or-later AND GPL-2.0-or-later +License: GPL-2.0-or-later AND LGPL-2.0-or-later Group: Development/Libraries/C and C++ URL: https://github.com/miquels/liblockfile Source: https://github.com/miquels/liblockfile/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz ++++++ liblockfile-1.16.tar.gz -> liblockfile-1.17.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/.gitignore new/liblockfile-1.17/.gitignore --- old/liblockfile-1.16/.gitignore 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/.gitignore 2021-01-28 17:08:20.000000000 +0100 @@ -1,2 +1,10 @@ .pc/ .nfs* +*.a +*.o +Makefile +autoconf.h +config.log +config.status +dotlockfile +maillock.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/Changelog new/liblockfile-1.17/Changelog --- old/liblockfile-1.16/Changelog 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/Changelog 2021-01-28 17:08:20.000000000 +0100 @@ -1,3 +1,15 @@ +liblockfile (1.17) + + * dotlockfile: '-P' option: allow passing through the child exit code + * dotlockfile: '-i interval' option. + * dotlockfile: document -q + * add L_RMSTALE return status (failed to remove stale lock) + * remove cistron.nl email address + + -- Miquel van Smoorenburg Wed, 27 Jan 2021 00:33:10 +0100 + + v1.16 + liblockfile (1.16) * lockfile.c: remove all the permission checking in the normal case. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/Makefile.in new/liblockfile-1.17/Makefile.in --- old/liblockfile-1.16/Makefile.in 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/Makefile.in 2021-01-28 17:08:20.000000000 +0100 @@ -32,16 +32,16 @@ liblockfile.a: lockfile.o $(AR) rv liblockfile.a lockfile.o -liblockfile.so: liblockfile.a +liblockfile.so: solockfile.o $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname,liblockfile.so.1 \ - -o liblockfile.so lockfile.o -lc + -o liblockfile.so solockfile.o -lc nfslock.so.$(NFSVER): nfslock.o $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname,nfslock.so.0 \ -o nfslock.so.$(NFSVER) nfslock.o -dotlockfile: dotlockfile.o xlockfile.o - $(CC) $(LDFLAGS) -o dotlockfile dotlockfile.o xlockfile.o +dotlockfile: dotlockfile.o dlockfile.o + $(CC) $(LDFLAGS) -o dotlockfile dotlockfile.o dlockfile.o dotlockfile.o: dotlockfile.c $(CC) $(CFLAGS) -DLOCKPROG=\"$(bindir)/dotlockfile\" \ @@ -49,11 +49,15 @@ lockfile.o: lockfile.c $(CC) $(CFLAGS) -DLIB -DLOCKPROG=\"$(bindir)/dotlockfile\" \ - -c lockfile.c + -DSTATIC -c lockfile.c -xlockfile.o: lockfile.c +solockfile.o: lockfile.c + $(CC) $(CFLAGS) -DLIB -DLOCKPROG=\"$(bindir)/dotlockfile\" \ + -c lockfile.c -o solockfile.o + +dlockfile.o: lockfile.c $(CC) $(CFLAGS) -DLOCKPROG=\"$(bindir)/dotlockfile\" \ - -c lockfile.c -o xlockfile.o + -c lockfile.c -o dlockfile.o install_static: static install_common install -d -m 755 -g root -p $(libdir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/README new/liblockfile-1.17/README --- old/liblockfile-1.16/README 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/README 2021-01-28 17:08:20.000000000 +0100 @@ -39,6 +39,3 @@ lockfile_check - lockfile_create.3 - - README 1.00 17-Apr-1999 Miquel van Smoorenburg <[email protected]> - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/dotlockfile.1 new/liblockfile-1.17/dotlockfile.1 --- old/liblockfile-1.16/dotlockfile.1 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/dotlockfile.1 2021-01-28 17:08:20.000000000 +0100 @@ -6,7 +6,10 @@ .B \-l .RB [ \-r .IR retries ] +.RB [ \-i +.IR interval ] .RB [ \-p ] +.RB [ \-q ] .RB < \-m \ | .IR lockfile > .br @@ -14,9 +17,13 @@ .B \-l .RB [ \-r .IR retries ] +.RB [ \-i +.IR interval ] .RB [ \-p ] +.RB [ \-q ] .RB < \-m \ | .IR lockfile > +.RB [ \-P ] .IR cmd "\ args \&...\&" .br .B dotlockfile @@ -59,8 +66,8 @@ .SH OPTIONS .IP "\fB\-l\fR" Create a lockfile if no preexisting valid lockfile is found, else wait and retry -according to option \fB\-r\fR. -This option is the default, so it can be left off. +according to option \fB\-r\fR. Retry interval can be explicitly set with option \fB\-i\fR. +This option (\fB-l\fR) is the default, so it can be left off. A lockfile is treated as valid, .br @@ -78,10 +85,12 @@ retries to acquire the lock if it failed the first time before giving up. The initial sleep after failing to acquire the lock is 5\ seconds. After each retry the sleep interval is increased incrementally by 5\ seconds -up to a maximum sleep of 60\ seconds between tries. +up to a maximum sleep of 60\ seconds between tries unless overridden by \fB\-i\fR. The default number of retries is 5. To try only once, use "\fB\-r 0\fR". To try indefinitely, use "\fB\-r \-1\fR". +.IP "\fB\-i interval\fR" +Sets a consistent retry interval. .IP "\fB\-u\fR" Remove a lockfile. .IP "\fB\-t\fR" @@ -111,6 +120,14 @@ is set, that is used instead. Then the string "\fI.lock\fR" is appended to get the name of the actual lockfile. +.IP "\fB\-q\fR" +Don't print warnings or errors to the standard error output. Used internally +by liblockfile when it spawns +.B dotlockfile +as a helper program. +.IP "\fB\-P\fR" +On successful "lock and spawn command", don't exit with status zero, but +pass through the exit value of the spawned command. .IP lockfile The lockfile to be created or removed. Must not be specified if the \fB\-m\fR option is given. @@ -126,10 +143,11 @@ .IR lockfile_create (3). Unlocking a non\-existent lockfile is not an error. .PP -If a command is executed, the return value does not correspond with that -of the command that was run. -If the locking and unlocking was successful, -the exit status is always zero. +Unless the +.B \-P +option was supplied, when a command is executed, the return value does not +correspond with that of the command that was run. If locking and unlocking +was successful, the exit status is zero. .SH NOTES The lockfile is created exactly as named on the command line. The extension "\fI.lock\fR" is \fInot\fR automatically appended. @@ -159,4 +177,4 @@ .IR lockfile_create (3), .IR maillock (3) .SH AUTHOR -Miquel van Smoorenburg, [email protected] +Miquel van Smoorenburg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/dotlockfile.c new/liblockfile-1.17/dotlockfile.c --- old/liblockfile-1.16/dotlockfile.c 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/dotlockfile.c 2021-01-28 17:08:20.000000000 +0100 @@ -3,9 +3,7 @@ * Runs setgid mail so is able to lock mailboxes * as well. Liblockfile can call this command. * - * Version: @(#)dotlockfile.c 1.14 17-Jan-2017 [email protected] - * - * Copyright (C) Miquel van Smoorenburg 1999-2017 + * Copyright (C) Miquel van Smoorenburg and contributors 1999-2021 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -44,7 +42,7 @@ extern int is_maillock(const char *lockfile); extern int lockfile_create_set_tmplock(const char *lockfile, - volatile char **tmplock, int retries, int flags); + volatile char **tmplock, int retries, int flags, struct __lockargs *); static volatile char *tmplock; static int quiet; @@ -83,18 +81,22 @@ } /* - * Sleep for an amout of time while regulary checking if + * Sleep for an amount of time while regulary checking if * our parent is still alive. */ -int check_sleep(int sleeptime) +int check_sleep(int sleeptime, int flags) { int i; + int interval = 5; static int ppid = 0; if (ppid == 0) ppid = getppid(); - for (i = 0; i < sleeptime; i += 5) { - sleep(5); + if (flags & __L_INTERVAL) + interval = 1; + + for (i = 0; i < sleeptime; i += interval) { + sleep(interval); if (kill(ppid, 0) < 0 && errno == ESRCH) return L_ERROR; } @@ -166,8 +168,8 @@ */ void usage(void) { - fprintf(stderr, "Usage: dotlockfile -l [-r retries] [-p] <-m|lockfile>\n"); - fprintf(stderr, " dotlockfile -l [-r retries] [-p] <-m|lockfile> command args...\n"); + fprintf(stderr, "Usage: dotlockfile -l [-r retries] [-i interval] [-p] [-q] <-m|lockfile>\n"); + fprintf(stderr, " dotlockfile -l [-r retries] [-i interval] [-p] [-q] <-m|lockfile> [-P] command args...\n"); fprintf(stderr, " dotlockfile -u|-t\n"); exit(1); } @@ -175,17 +177,20 @@ int main(int argc, char **argv) { struct passwd *pwd; + struct __lockargs args = { 0 }; gid_t gid, egid; char *lockfile = NULL; char **cmd = NULL; int c, r; int retries = 5; + int interval = 0; int flags = 0; int lock = 0; int unlock = 0; int check = 0; int touch = 0; int writepid = 0; + int passthrough = 0; /* * Remember real and effective gid, and @@ -209,7 +214,7 @@ /* * Process the options. */ - while ((c = getopt(argc, argv, "+qpNr:mluct")) != EOF) switch(c) { + while ((c = getopt(argc, argv, "+qpNr:mluci:tP")) != EOF) switch(c) { case 'q': quiet = 1; break; @@ -256,9 +261,21 @@ case 'c': check = 1; break; + case 'i': + interval = atoi(optarg); + if (interval <= 0 && strcmp(optarg, "0") != 0) { + fprintf(stderr, "dotlockfile: -i needs argument >= 0\n"); + return L_ERROR; + } + flags |= __L_INTERVAL; + args.interval = interval; + break; case 't': touch = 1; break; + case 'P': + passthrough = 1; + break; default: usage(); break; @@ -373,7 +390,7 @@ /* * No, lock. */ - r = lockfile_create_set_tmplock(lockfile, &tmplock, retries, flags); + r = lockfile_create_set_tmplock(lockfile, &tmplock, retries, flags, &args); if (r != 0 || !cmd) return r; @@ -431,6 +448,12 @@ alarm(0); lockfile_remove(lockfile); + if (passthrough) { + if (WIFEXITED(wstatus)) + return WEXITSTATUS(wstatus); + if (WIFSIGNALED(wstatus)) + return 128+WTERMSIG(wstatus); + } return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/lockfile.c new/liblockfile-1.17/lockfile.c --- old/liblockfile-1.16/lockfile.c 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/lockfile.c 2021-01-28 17:08:20.000000000 +0100 @@ -3,9 +3,7 @@ * This file also holds the implementation for * the Svr4 maillock functions. * - * Version: @(#)lockfile.c 1.06 04-Jun-2004 [email protected] - * - * Copyright (C) Miquel van Smoorenburg 1997,1998,1999,2004. + * Copyright (C) Miquel van Smoorenburg and contributors 1997-2021. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,6 +19,7 @@ #endif #include <sys/stat.h> #include <sys/wait.h> +#include <stdarg.h> #include <stdio.h> #include <string.h> #include <signal.h> @@ -42,7 +41,7 @@ #endif #ifndef LIB -extern int check_sleep(int); +extern int check_sleep(int, int); #endif #ifdef MAILGROUP @@ -229,7 +228,7 @@ static int lockfile_create_save_tmplock(const char *lockfile, char *tmplock, int tmplocksz, volatile char **xtmplock, - int retries, int flags) + int retries, int flags, struct __lockargs *args) { struct stat st, st1; char pidbuf[40]; @@ -241,6 +240,11 @@ int dontsleep = 1; int tries = retries + 1; + /* process optional flags that have arguments */ + if (flags & __L_INTERVAL) { + sleeptime = args->interval; + } + /* decide which PID to write to the lockfile */ if (flags & L_PID) pid = getpid(); @@ -289,14 +293,15 @@ * Now try to link the temporary lock to the lock. */ for (i = 0; i < tries && tries > 0; i++) { - if (!dontsleep) { - sleeptime += 5; + if (!(flags & __L_INTERVAL)) + sleeptime += 5; + if (sleeptime > 60) sleeptime = 60; #ifdef LIB sleep(sleeptime); #else - if ((e = check_sleep(sleeptime)) != 0) { + if ((e = check_sleep(sleeptime, flags)) != 0) { unlink(tmplock); tmplock[0] = 0; return e; @@ -314,7 +319,7 @@ * EXTRA FIX: the value of the nlink field * can't be trusted (may be cached). */ - (void)link(tmplock, lockfile); + (void)!link(tmplock, lockfile); if (lstat(tmplock, &st1) < 0) { tmplock[0] = 0; @@ -354,7 +359,13 @@ * remove the lockfile. */ if (lockfile_check(lockfile, flags) == -1) { - unlink(lockfile); + if (unlink(lockfile) < 0 && errno != ENOENT) { + /* + * we failed to unlink the stale + * lockfile, give up. + */ + return L_RMSTALE; + } dontsleep = 1; /* * If the lockfile was invalid, then the first @@ -374,7 +385,7 @@ #ifdef LIB static #endif -int lockfile_create_set_tmplock(const char *lockfile, volatile char **xtmplock, int retries, int flags) +int lockfile_create_set_tmplock(const char *lockfile, volatile char **xtmplock, int retries, int flags, struct __lockargs *args) { char *tmplock; int l, r, e; @@ -384,7 +395,7 @@ return L_ERROR; tmplock[0] = 0; r = lockfile_create_save_tmplock(lockfile, - tmplock, l, xtmplock, retries, flags); + tmplock, l, xtmplock, retries, flags, args); if (xtmplock) *xtmplock = NULL; e = errno; @@ -396,8 +407,41 @@ #ifdef LIB int lockfile_create(const char *lockfile, int retries, int flags) { - return lockfile_create_set_tmplock(lockfile, NULL, retries, flags); + /* check against unknown flags */ + if (flags & ~(L_PID|L_PPID)) { + errno = EINVAL; + return L_ERROR; + } + return lockfile_create_set_tmplock(lockfile, NULL, retries, flags, NULL); } + +#ifdef STATIC +int lockfile_create2(const char *lockfile, int retries, + int flags, struct __lockargs *args, int args_sz) +{ + + #define FLAGS_WITH_ARGS (__L_INTERVAL) + #define KNOWN_FLAGS (L_PID|L_PPID|__L_INTERVAL) + + /* check if size is the same (version check) */ + if (args != NULL && sizeof(struct __lockargs) != args_sz) { + errno = EINVAL; + return L_ERROR; + } + /* some flags _must_ have a non-null args */ + if (args == NULL && (flags & FLAGS_WITH_ARGS)) { + errno = EINVAL; + return L_ERROR; + } + /* check against unknown flags */ + if (flags & ~KNOWN_FLAGS) { + errno = EINVAL; + return L_ERROR; + } + return lockfile_create_set_tmplock(lockfile, NULL, retries, flags, args); +} +#endif + #endif /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/lockfile.h new/liblockfile-1.17/lockfile.h --- old/liblockfile-1.16/lockfile.h 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/lockfile.h 2021-01-28 17:08:20.000000000 +0100 @@ -30,12 +30,13 @@ */ #define L_SUCCESS 0 /* Lockfile created */ #define L_NAMELEN 1 /* Recipient name too long */ -#define L_TMPLOCK 2 /* Error creating tmp lockfile */ -#define L_TMPWRITE 3 /* Can't write pid int tmp lockfile */ +#define L_TMPLOCK 2 /* Error creating temp lockfile */ +#define L_TMPWRITE 3 /* Can't write pid into temp lockfile */ #define L_MAXTRYS 4 /* Failed after max. number of attempts */ #define L_ERROR 5 /* Unknown error; check errno */ #define L_MANLOCK 6 /* Cannot set mandatory lock on tempfile */ -#define L_ORPHANED 7 /* aksed for L_PPID but got orphaned */ +#define L_ORPHANED 7 /* Called with L_PPID but parent is gone */ +#define L_RMSTALE 8 /* Failed to remove stale lockfile */ /* * Flag values for lockfile_create() @@ -43,6 +44,20 @@ #define L_PID 16 /* Put PID in lockfile */ #define L_PPID 32 /* Put PPID in lockfile */ +/* + * Experimental. + */ +struct __lockargs { + int interval; /* Static interval between retries */ +}; +#define __L_INTERVAL 64 /* Specify consistent retry interval */ +#ifdef LOCKFILE_EXPERIMENTAL +#define lockargs __lockargs +#define L_INTERVAL __L_INTERVAL +int lockfile_create2(const char *lockfile, int retries, + int flags, struct lockargs *args, int args_sz); +#endif + #ifdef __cplusplus } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/lockfile_create.3 new/liblockfile-1.17/lockfile_create.3 --- old/liblockfile-1.16/lockfile_create.3 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/lockfile_create.3 2021-01-28 17:08:20.000000000 +0100 @@ -1,4 +1,4 @@ -.TH LOCKFILE_CREATE 3 "05 Januari 2017" "Linux Manpage" "Linux Programmer's Manual" +.TH LOCKFILE_CREATE 3 "27 Januari 2021" "Linux Manpage" "Linux Programmer's Manual" .SH NAME lockfile_create, lockfile_remove, lockfile_touch, lockfile_check \- manage lockfiles .SH SYNOPSIS @@ -6,14 +6,18 @@ .sp .BI "cc [ "flag " ... ] "file " ... -llockfile [ "library " ] " .sp -.BI "int lockfile_create( const char *" lockfile ", int " retrycnt ", int " flags " );" +.BI "int lockfile_create( const char *" lockfile ", int " retrycnt ", int " flags " [, struct lockargs " args " ] );" .br .BI "int lockfile_remove( const char *" lockfile " );" .br .BI "int lockfile_touch( const char *" lockfile " );" .br .BI "int lockfile_check( const char *" lockfile ", int " flags " );" +.br .SH DESCRIPTION +Functions to handle lockfiles in an NFS safe way. +.PP +.SS lockfile_create The .B lockfile_create function creates a lockfile in an NFS safe way. @@ -25,6 +29,7 @@ then lockfile_create will not only check for an existing lockfile, but it will read the contents as well to see if it contains a process id in ASCII. If so, the lockfile is only valid if that process still exists. +Otherwise, a lockfile older than 5 minutes is considered to be stale. .PP When creating a lockfile, if .B L_PID @@ -36,25 +41,25 @@ .B L_PPID flag instead. .PP +.SS lockfile_touch If the lockfile is on a shared filesystem, it might have been created by -a process on a remote host. Thus the process-id checking is useless and -the L_PID flag should not be set. In this case, -there is no good way to see if a lockfile is stale. Therefore if the lockfile -is older then 5 minutes, it will be removed. That is why the +a process on a remote host. So the L_PID or L_PPID method of deciding +if a lockfile is still valid or stale is incorrect and must not be used. +If you are holding a lock longer than 5 minutes, a call to +.B lockfile_create +by another process will consider the lock stale and remove it. +To prevent this, call .B lockfile_touch -function is provided: while holding the lock, it needs to be refreshed -regulary (every minute or so) by calling -.B lockfile_touch "() ". +to refresh the lockfile at a regular interval (every minute or so). .PP -The -.B -lockfile_check -function checks if a valid lockfile is already present without trying to +.SS lockfile_check +.PP +This function checks if a valid lockfile is already present without trying to create a new lockfile. .PP -Finally the -.B lockfile_remove -function removes the lockfile. +.SS lockfile_remove +.PP +Removes the lockfile. .SH RETURN VALUES .B lockfile_create @@ -62,12 +67,12 @@ .nf #define L_SUCCESS 0 /* Lockfile created */ - #define L_NAMELEN 1 /* Recipient name too long (> 13 chars) */ #define L_TMPLOCK 2 /* Error creating tmp lockfile */ #define L_TMPWRITE 3 /* Can't write pid int tmp lockfile */ #define L_MAXTRYS 4 /* Failed after max. number of attempts */ #define L_ERROR 5 /* Unknown error; check errno */ #define L_ORPHANED 7 /* Called with L_PPID but parent is gone */ + #define L_RMSTALE 8 /* Failed to remove stale lockfile */ .fi .PP .B lockfile_check @@ -112,7 +117,7 @@ seconds, but after every retry 5 extra seconds is added up to a maximum of 60 seconds (an incremental backoff). Then we go to step \fI2\fP up to \fIretries\fP times. - +.br .PP .SH REMOTE FILE SYSTEMS AND THE KERNEL ATTRIBUTE CACHE .PP @@ -218,7 +223,7 @@ /usr/lib/liblockfile.so.1 .SH AUTHOR -Miquel van Smoorenburg <[email protected]> +Miquel van Smoorenburg .SH "SEE ALSO" .BR dotlockfile "(1), " maillock "(3), " touchlock " (3), " mailunlock (3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/maillock.3 new/liblockfile-1.17/maillock.3 --- old/liblockfile-1.16/maillock.3 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/maillock.3 2021-01-28 17:08:20.000000000 +0100 @@ -48,7 +48,7 @@ #define L_TMPWRITE 3 /* Can't write pid int tmp lockfile */ #define L_MAXTRYS 4 /* Failed after max. number of attempts */ #define L_ERROR 5 /* Unknown error; check errno */ - + #define L_RMSTALE 8 /* Failed to remove stale lockfile */ .fi .SH NOTES @@ -74,7 +74,7 @@ /usr/lib/liblockfile.so.1 .SH AUTHOR -Miquel van Smoorenburg <[email protected]> +Miquel van Smoorenburg .SH "SEE ALSO" .BR lockfile_create "(3), " lockfile_touch " (3), " lockfile_remove (3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblockfile-1.16/run-tests.sh new/liblockfile-1.17/run-tests.sh --- old/liblockfile-1.16/run-tests.sh 2019-08-09 16:45:02.000000000 +0200 +++ new/liblockfile-1.17/run-tests.sh 2021-01-28 17:08:20.000000000 +0100 @@ -38,5 +38,23 @@ wait [ ! -f testlock.lock ] || { echo "lockfile still exists after running cmd"; exit 1; } +# test locking with given sleep interval +dotlockfile -l -r 0 testlock.lock +dotlockfile -l -i 4 testlock.lock /bin/true & + +time_start=$(date '+%s') + +sleep 4.5 +dotlockfile -u testlock.lock + +wait + +time_end=$(date '+%s') +time_elapsed=`expr $time_end - $time_start` + +# Time should equal 8 seconds +[ "$time_elapsed" = '8' ] || { echo "lockfile should take 8 seconds to be replaced. [$time_elapsed]"; exit 1; } +[ ! -f testlock.lock ] || { echo "lockfile still exists after running cmd"; exit 1; } + echo "tests OK"
