Hello community,

here is the log from the commit of package withlock for openSUSE:Factory 
checked in at 2015-06-15 17:50:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/withlock (Old)
 and      /work/SRC/openSUSE:Factory/.withlock.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "withlock"

Changes:
--------
--- /work/SRC/openSUSE:Factory/withlock/withlock.changes        2014-08-18 
11:23:53.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.withlock.new/withlock.changes   2015-06-15 
17:50:59.000000000 +0200
@@ -1,0 +2,11 @@
+Mon Jun 15 00:27:25 UTC 2015 - po...@cmdline.net
+
+- update to 0.4
+- lockfile cleanup fix upstream (Thanks Martin Caj and Martin Vidner. Good
+  Catch!) (cosmetical bug which didn't affect the locking strategy)
+- man page added
+- license file added
+- use the now provided Makefile
+- moved to github.com
+
+-------------------------------------------------------------------

Old:
----
  got-lock.patch
  withlock-0.3.tar.gz
  withlock-README.SuSE

New:
----
  withlock-0.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ withlock.spec ++++++
--- /var/tmp/diff_new_pack.uBTITZ/_old  2015-06-15 17:51:00.000000000 +0200
+++ /var/tmp/diff_new_pack.uBTITZ/_new  2015-06-15 17:51:00.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package withlock
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,17 +17,14 @@
 
 
 Name:           withlock
-Version:        0.3
+Version:        0.4
 Release:        0
 Summary:        A locking wrapper script
 License:        Apache-2.0
 Group:          System/Management
-Url:            http://code.google.com/p/withlock/
+Url:            https://github.com/poeml/withlock
 Requires:       python
 Source0:        http://mirrorbrain.org/files/releases/%{name}-%{version}.tar.gz
-Source1:        %name-README.SuSE
-# fixed trouble with not removed lock file bacuse got-lock was not global 
variable.
-Patch0:         got-lock.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildArch:      noarch
 
@@ -43,14 +40,10 @@
 %prep
 %setup
 
-%patch0 -p1
-
 %build
 #
 %install
-install -Dm755 withlock %{buildroot}%{_bindir}/%{name}
-install -Dm644 %{SOURCE1} %{buildroot}%{_defaultdocdir}/%{name}/README.SuSE
-sed -i "s|/usr/bin/env python|%{_bindir}/python|g" 
%{buildroot}%{_bindir}/%{name}
+make DESTDIR=%{buildroot} prefix=%{_prefix} install 
 
 %clean
 rm -rf %{buildroot}
@@ -59,5 +52,6 @@
 %defattr(-, root, root)
 %doc %{_defaultdocdir}/%{name}
 %{_bindir}/%{name}
+%doc %{_mandir}/man1/*
 
 %changelog

++++++ withlock-0.3.tar.gz -> withlock-0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/LICENSE-2.0.txt 
new/withlock-0.4/LICENSE-2.0.txt
--- old/withlock-0.3/LICENSE-2.0.txt    1970-01-01 01:00:00.000000000 +0100
+++ new/withlock-0.4/LICENSE-2.0.txt    2015-06-15 02:24:25.000000000 +0200
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/Makefile new/withlock-0.4/Makefile
--- old/withlock-0.3/Makefile   1970-01-01 01:00:00.000000000 +0100
+++ new/withlock-0.4/Makefile   2015-06-15 02:24:25.000000000 +0200
@@ -0,0 +1,29 @@
+prefix      = /usr/local
+exec_prefix = $(prefix)
+bindir      = $(exec_prefix)/bin
+mandir      = $(prefix)/share/man
+sysconfdir  = $(prefix)/etc
+datadir     = $(prefix)/share
+docdir      = $(datadir)/doc/packages
+
+BINDIR =       $(PREFIX)/bin
+MANDIR =       $(PREFIX)/share/man
+
+INSTALL =      install
+RONN =         ronn-1.9
+
+BIN =          withlock
+MANPAGE =      withlock.1
+
+$(MANPAGE): $(MANPAGE).ronn
+       $(RONN) --roff $<
+       $(RONN) --html $<
+
+install: $(BIN) $(MANPAGE)
+       $(INSTALL) -d $(DESTDIR)$(bindir) 
+       $(INSTALL) $(BIN) $(DESTDIR)$(bindir)
+       $(INSTALL) -d $(DESTDIR)$(mandir)/man1
+       $(INSTALL) -m 0644 $(MANPAGE) $(DESTDIR)$(mandir)/man1
+       $(INSTALL) -d $(DESTDIR)$(docdir)/withlock
+       $(INSTALL) -m 0644 withlock.1.html README.md LICENSE-2.0.txt 
$(DESTDIR)$(docdir)/withlock
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/README.md new/withlock-0.4/README.md
--- old/withlock-0.3/README.md  1970-01-01 01:00:00.000000000 +0100
+++ new/withlock-0.4/README.md  2015-06-15 02:24:25.000000000 +0200
@@ -0,0 +1,159 @@
+# withlock
+
+## About
+
+`withlock` is a locking wrapper script to make sure that some program isn't run
+more than once. It is ideal to prevent periodic jobs spawned by cron from
+stacking up.
+
+The locks created are valid only while the wrapper is running, and thus will
+*never* require additional cleanup, even after a reboot. This makes the wrapper
+safe and easy to use, and much better than implementing half-hearted locking
+within scripts.
+
+The wrapper is used in production since summer 2009, and proved to work
+reliably since then. In testing, it had showed to be free of race conditions
+when used concurrently while the author tried very hard to break it. I guess
+there is always some remaining corner for a race, and wouldn't claim a "100%",
+but it's definitely good enough and fit for the purpose.
+
+
+## Features
+
+* locks that never need a cleanup, whatever happens
+* can wait a defined time for a lock to become "free"
+* disallows lock files in unsafe locations (to prevent symlink attacks)
+* easily installed, as portable as Python
+
+
+## Supported Platforms
+
+withlock has been tested on the following platforms:
+
+* **Debian** Lenny (5.0) and later
+* **Ubuntu** Jaunty Jackalope (9.04), Karmic Koala (9.10) and later
+* **openSUSE** 10.1, 11.0, 11.1 and later
+* **CentOS** 5.4
+* **FreeBSD** 8.0
+* **OSX** Leopard (10.5), Snow Leopard (10.6)
+* **OpenCSW Solaris** http://www.opencsw.org/packages/withlock/
+
+Quite likely, more platforms are supported. Please provide feedback if you 
know about one.
+
+withlock should run on every platform that has a Python interpreter of version 
2.4 or newer. The requirement on Python 2.4 is for the subprocess module, which 
was introduced with that version.
+
+The most extensive testing has been performed on openSUSE with XFS and ext3 as 
underlying filesystems. On the other listed platforms, basic functionality has 
been verified.
+
+## Download
+
+wget http://mirrorbrain.org/files/releases/withlock-0.4.tar.gz
+
+
+## Simple install of the latest script from git master
+
+    sudo su -
+    wget https://raw.githubusercontent.com/poeml/withlock/master/withlock
+    chmod +x withlock
+    mv withlock /usr/local/bin/
+
+
+## Usage
+
+Usage is simple. Instead of your command 
+
+    CMD ARGS...
+
+you simply use
+
+    withlock LOCKFILE CMD ARGS...
+
+
+
+**Note: the lockfile LOCKFILE must not be placed in a publicly writable
+directory, because that would allow a symlink attack. For that reason, withlock
+disallows lockfiles in such locations.**
+
+Run `withlock --help` to see more options. Here's an overview:
+
+     # withlock --help
+    Usage: withlock [options] LOCKFILE CMD ARGS...
+    
+    Options:
+      --version             show program's version number and exit
+      -h, --help            show this help message and exit
+      -w SECONDS, --wait=SECONDS
+                            wait for maximum SECONDS until the lock is acquired
+      -q, --quiet           if lock can't be acquired immediately, silently 
quit
+                            without error
+      -v, --verbose         print debug messages to stderr
+
+
+
+## cron Examples
+
+Here's an example for cron jobs run under withlock:
+
+
+    -*/10 * * * *   root     withlock LOCK-serverstatus 
/usr/bin/log_server_status2
+    43 5,17 * * *   mirror   withlock LOCK-rsync-edu-isos rsync -rlptoH 
--no-motd rsync.opensuse-education.org::download/ISOs/ 
/srv/mirrors/opensuse-education/ISOs -hi
+
+
+
+## History
+
+This wrapper was implemented because no comparable solution was found even 
after looking around for a long time (and suffering problems caused by missing 
or insufficient locking for years). The only solution that comes close is 
with-lock-ex.c, an implementation in C, which was written by Ian Jackson and 
placed in the public domain by him. with-lock-ex.c is traditionally available 
on Debian in a package named chiark-utils-bin. Parts of withlock's locking 
strategy and parts of the usage semantics were inspired from that program. This 
implementation was chosen to be done in Python because it's universally 
available, easy to adapt, and doesn't require to be compiled.
+
+Then, somebody pointed out to me that there's `flock(1)`, a small tool written 
in C that does the same. Indeed, I had apparently managed to miss that tool 
during a decade's worth of Linux hacking (you discover something new every day, 
don't you?). The functionality is mainly the same indeed. 
+
+However, withlock has some advantages:
+
+* withlock ist a little easier and logical to use than `flock(1)`. The 
semantics are more suited for sysadmins.
+* withlock always cleans up it's lock files. `flock(1)` always lets them lying 
around. I admit that I like the fact that with withlock I can always see by the 
presence of the lock files which jobs are running.
+* `flock(1)` doesn't prevent using unsafe directories
+* withlock is easily extensible
+* it could be used as a Python module (but that's not implemented)
+* `flock(1)` doesn't exist on Solaris and OSX
+
+
+## Possible Features for the Future
+
+* maybe add `--insecure` option to override disallowance lockfiles in publicly
+  writable directories
+* functionality from withlock(1) that's missing in flock(1) could be
+  implemented in the latter
+* it would be conceivable to extend the script to allow starting *n* instances
+  of a job. That would probably bring about a different locking strategy
+  though.
+* the script could (should) be packaged for the platforms, or integrated into 
the base system. Package maintainers, please grab it!
+
+
+Please provide feedback!
+Thanks!
+
+
+## Revision history
+
+
+0.4, 2015:
+
+- fix lockfile cleanup (Thanks Martin Caj and Martin Vidner. Good Catch!)
+  (cosmetical bug which didn't affect the locking strategy)
+- man page added
+- license file added
+- moved to github.com
+
+0.3, 2014:
+
+- At exit, unlink the lock file only if a lock was actually obtained.
+  When waiting for a lock (using -w option) and timing out, the file
+  was removed nevertheless. Thanks Bernhard Wiedemann for finding this
+  bug and providing such a good test case, so the fix was easy.
+
+0.2, 2010:
+
+- prevent possible symlink attacks by disallowing lockfiles in directories
+  where users other than the caller have write permissions
+
+0.1, 2009:
+
+- initial release
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/withlock new/withlock-0.4/withlock
--- old/withlock-0.3/withlock   2014-03-20 22:17:53.000000000 +0100
+++ new/withlock-0.4/withlock   2015-06-15 02:24:25.000000000 +0200
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2009-2014 Peter Poeml
+# Copyright 2009-2015 Peter Poeml
 # 
 #    Licensed under the Apache License, Version 2.0 (the "License");
 #    you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
 #
 #
 #
-# withlock -- http://code.google.com/p/withlock/
+# withlock -- https://github.com/poeml/withlock
 #
 #
 # A locking wrapper that make sure that a program isn't run more than once.
@@ -36,7 +36,7 @@
 # See --help output for more options.
 
 
-__version__ = '0.3'
+__version__ = '0.4'
 
 import os
 import os.path
@@ -64,8 +64,12 @@
     if num: signal.signal(num, catchterm)
 
 
-def cleanup(lockfile):
+def cleanup(lockfile, verbose):
+    global got_lock
     if got_lock:
+        if verbose:
+            sys.stderr.write('removing lockfile: %r\n' % lockfile)
+
         try:
             os.unlink(lockfile)
         except:
@@ -132,6 +136,7 @@
 
     lock = open(lockfile, 'w')
 
+    global got_lock
     while 1 + 1 == 2:
 
         try:
@@ -174,7 +179,7 @@
                             % lockfile)
 
 
-    atexit.register(cleanup, lockfile)
+    atexit.register(cleanup, lockfile, options.verbose)
     os.umask(prev_umask)
 
     import subprocess
@@ -185,9 +190,6 @@
     if options.verbose:
         sys.stderr.write('command terminated with exit code %s\n' % rc)
 
-    if options.verbose:
-        sys.stderr.write('removing lockfile\n')
-
     sys.exit(rc)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/withlock.1 new/withlock-0.4/withlock.1
--- old/withlock-0.3/withlock.1 1970-01-01 01:00:00.000000000 +0100
+++ new/withlock-0.4/withlock.1 2015-06-15 02:24:25.000000000 +0200
@@ -0,0 +1,134 @@
+.\" generated with Ronn/v0.7.3
+.\" http://github.com/rtomayko/ronn/tree/0.7.3
+.
+.TH "WITHLOCK" "1" "June 2015" "" ""
+.
+.SH "NAME"
+\fBwithlock\fR \- locking wrapper script
+.
+.SH "SYNOPSIS"
+\fBwithlock\fR \fIlockfile\fR \fIcommand\fR [\fIargs\fR\.\.\.]
+.
+.br
+\fBwithlock\fR [\fB\-w <seconds>\fR|\fB\-\-wait\fR=\fIseconds\fR] 
[\fB\-q\fR|\fB\-\-quiet\fR] [\fB\-v\fR|\fB\-\-verbose\fR] \fIlockfile\fR 
\fIcommand\fR [\fIargs\fR\.\.\.]
+.
+.br
+\fBwithlock\fR [\fB\-h\fR|\fB\-\-help\fR]
+.
+.br
+\fBwithlock\fR [\fB\-\-version\fR]
+.
+.SH "DESCRIPTION"
+withlock(1) is a wrapper script to make sure that some program isn\'t run more 
than once\. It is ideal to prevent periodic jobs spawned by cron(8) from 
stacking up\.
+.
+.P
+It uses locks that are valid only while the wrapper is running, and thus will 
\fInever\fR require additional cleanup, even after a system crash or reboot\. 
This makes the wrapper safe and easy to use, and better than implementing 
half\-hearted locking within scripts\.
+.
+.P
+The script can wait a defined time for a lock to become "free"\.
+.
+.SH "SECURITY"
+Lockfiles, generally, MUST NOT be placed in a publicly writable directory, 
because that would allow for a symlink attack\. For that reason, withlock(1) 
simply disallows lockfiles in such locations\.
+.
+.SH "OPTIONS"
+.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Print debug messages to stderr\.
+.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+If lock can\'t be acquired immediately, silently quit without error\.
+.
+.TP
+\fB\-\-version\fR
+Show program\'s version number and exit\.
+.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Show command synopsis and exit\.
+.
+.TP
+\fB\-w\fR \fIseconds\fR, \fB\-\-wait\fR=\fIseconds\fR
+Wait for maximum \fIseconds\fR for the lock to be acquired\.
+.
+.SH "EXAMPLES"
+Instead of your command
+.
+.IP "" 4
+.
+.nf
+
+<command> [<args>\.\.\.]
+.
+.fi
+.
+.IP "" 0
+.
+.P
+you simply use
+.
+.IP "" 4
+.
+.nf
+
+withlock <lockfile> <command> [<args>\.\.\.]
+.
+.fi
+.
+.IP "" 0
+.
+.P
+cron(8) jobs, especially long running ones, are frequently run under 
withlock(1)\. Here\'s an example:
+.
+.IP "" 4
+.
+.nf
+
+\-*/10 * * * *   root     withlock LOCK\-serverstatus 
/usr/bin/log_server_status2
+43 5,17 * * *   mirror   withlock LOCK\-rsync\-edu\-isos rsync \-rlptoH 
\-\-no\-motd rsync\.opensuse\-education\.org::download/ISOs/ 
/srv/mirrors/opensuse\-education/ISOs \-hi
+.
+.fi
+.
+.IP "" 0
+.
+.SH "HISTORY"
+This wrapper was implemented because no comparable solution was found even 
after looking around for a long time (and suffering problems caused by missing 
or insufficient locking for years)\. The only solution that comes close is 
with\-lock\-ex\.c, an implementation in C, which was written by Ian Jackson and 
placed in the public domain by him\. with\-lock\-ex\.c is traditionally 
available on Debian in a package named chiark\-utils\-bin\. Parts of 
withlock\'s locking strategy and parts of the usage semantics were inspired 
from that program\. This implementation was chosen to be done in Python because 
it\'s universally available, easy to adapt, and doesn\'t require to be 
compiled\.
+.
+.P
+Then, somebody pointed out to me that there\'s flock(1), a small tool written 
in C that does the same\. Indeed, I had apparently managed to miss that tool 
during a decade\'s worth of Linux hacking (you discover something new every 
day, don\'t you?)\. The functionality is mainly the same indeed\.
+.
+.P
+However, withlock(1) has some advantages:
+.
+.IP "\(bu" 4
+withlock(1) ist a little easier and logical to use than flock(1)\. The 
semantics are more suited for sysadmins\.
+.
+.IP "\(bu" 4
+withlock(1) always cleans up it\'s lock files\. flock(1) always lets them 
lying around\. I admit that I like the fact that with withlock(1) I can always 
see by the presence of the lock files which jobs are running\.
+.
+.IP "\(bu" 4
+flock(1) doesn\'t prevent using unsafe directories
+.
+.IP "\(bu" 4
+withlock(1) is easily extensible
+.
+.IP "\(bu" 4
+it could be used as a Python module (not implemented so far)
+.
+.IP "\(bu" 4
+flock(1) doesn\'t exist on Solaris and OSX
+.
+.IP "" 0
+.
+.SH "BUGS"
+withlock(1) has been tested on many platforms, including Debian, Ubuntu, 
openSUSE, CentOS, Fedora, FreeBSD, OSX, OpenCSW Solaris and is in production 
use since 2009\. There don\'t seem to be race conditions (the author tried very 
hard to break it) but there are no guarantees\.
+.
+.SH "AUTHOR"
+This program was written by Peter Pöml \fIpeter@poeml\.de\fR in 2009\.
+.
+.SH "SEE ALSO"
+flock(1)
+.
+.br
+with\-lock\-ex(1) from Debian package chiark\-utils\-bin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/withlock.1.html 
new/withlock-0.4/withlock.1.html
--- old/withlock-0.3/withlock.1.html    1970-01-01 01:00:00.000000000 +0100
+++ new/withlock-0.4/withlock.1.html    2015-06-15 02:24:25.000000000 +0200
@@ -0,0 +1,192 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv='content-type' value='text/html;charset=utf8'>
+  <meta name='generator' value='Ronn/v0.7.3 
(http://github.com/rtomayko/ronn/tree/0.7.3)'>
+  <title>withlock(1) - locking wrapper script</title>
+  <style type='text/css' media='all'>
+  /* style: man */
+  body#manpage {margin:0}
+  .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
+  .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
+  .mp h2 {margin:10px 0 0 0}
+  .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
+  .mp h3 {margin:0 0 0 4ex}
+  .mp dt {margin:0;clear:left}
+  .mp dt.flush {float:left;width:8ex}
+  .mp dd {margin:0 0 0 9ex}
+  .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
+  .mp pre {margin-bottom:20px}
+  .mp pre+h2,.mp pre+h3 {margin-top:22px}
+  .mp h2+pre,.mp h3+pre {margin-top:5px}
+  .mp img {display:block;margin:auto}
+  .mp h1.man-title {display:none}
+  .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 
{font-family:monospace;font-size:14px;line-height:1.42857142857143}
+  .mp h2 {font-size:16px;line-height:1.25}
+  .mp h1 {font-size:20px;line-height:2}
+  .mp {text-align:justify;background:#fff}
+  .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
+  .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
+  .mp u {text-decoration:underline}
+  .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
+  .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
+  .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a 
samp {color:#0000ff}
+  .mp b.man-ref {font-weight:normal;color:#434241}
+  .mp pre {padding:0 4ex}
+  .mp pre code {font-weight:normal;color:#434241}
+  .mp h2+pre,h3+pre {padding-left:0}
+  ol.man-decor,ol.man-decor li {margin:3px 0 10px 
0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
+  ol.man-decor {width:100%}
+  ol.man-decor li.tl {text-align:left}
+  ol.man-decor li.tc {text-align:center;letter-spacing:4px}
+  ol.man-decor li.tr {text-align:right;float:right}
+  </style>
+</head>
+<!--
+  The following styles are deprecated and will be removed at some point:
+  div#man, div#man ol.man, div#man ol.head, div#man ol.man.
+
+  The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
+  .man-navigation should be used instead.
+-->
+<body id='manpage'>
+  <div class='mp' id='man'>
+
+  <div class='man-navigation' style='display:none'>
+    <a href="#NAME">NAME</a>
+    <a href="#SYNOPSIS">SYNOPSIS</a>
+    <a href="#DESCRIPTION">DESCRIPTION</a>
+    <a href="#SECURITY">SECURITY</a>
+    <a href="#OPTIONS">OPTIONS</a>
+    <a href="#EXAMPLES">EXAMPLES</a>
+    <a href="#HISTORY">HISTORY</a>
+    <a href="#BUGS">BUGS</a>
+    <a href="#AUTHOR">AUTHOR</a>
+    <a href="#SEE-ALSO">SEE ALSO</a>
+  </div>
+
+  <ol class='man-decor man-head man head'>
+    <li class='tl'>withlock(1)</li>
+    <li class='tc'></li>
+    <li class='tr'>withlock(1)</li>
+  </ol>
+
+  <h2 id="NAME">NAME</h2>
+<p class="man-name">
+  <code>withlock</code> - <span class="man-whatis">locking wrapper 
script</span>
+</p>
+
+<h2 id="SYNOPSIS">SYNOPSIS</h2>
+
+<p><code>withlock</code> <var>lockfile</var> <var>command</var> 
[<var>args</var>...]<br />
+<code>withlock</code> [<code>-w 
&lt;seconds></code>|<code>--wait</code>=<var>seconds</var>] 
[<code>-q</code>|<code>--quiet</code>] [<code>-v</code>|<code>--verbose</code>] 
<var>lockfile</var> <var>command</var> [<var>args</var>...]<br />
+<code>withlock</code> [<code>-h</code>|<code>--help</code>]<br />
+<code>withlock</code> [<code>--version</code>]</p>
+
+<h2 id="DESCRIPTION">DESCRIPTION</h2>
+
+<p><a class="man-ref" href="withlock.1.html">withlock<span 
class="s">(1)</span></a> is a wrapper script to make sure that some program 
isn't run
+more than once. It is ideal to prevent periodic jobs spawned by <span 
class="man-ref">cron<span class="s">(8)</span></span> from
+stacking up.</p>
+
+<p>It uses locks that are valid only while the wrapper is running, and thus 
will
+<em>never</em> require additional cleanup, even after a system crash or 
reboot. This
+makes the wrapper safe and easy to use, and better than implementing
+half-hearted locking within scripts.</p>
+
+<p>The script can wait a defined time for a lock to become "free".</p>
+
+<h2 id="SECURITY">SECURITY</h2>
+
+<p>Lockfiles, generally, MUST NOT be placed in a publicly writable directory,
+because that would allow for a symlink attack. For that reason, <a 
class="man-ref" href="withlock.1.html">withlock<span class="s">(1)</span></a>
+simply disallows lockfiles in such locations.</p>
+
+<h2 id="OPTIONS">OPTIONS</h2>
+
+<dl>
+<dt><code>-v</code>, <code>--verbose</code></dt><dd><p>Print debug messages to 
stderr.</p></dd>
+<dt><code>-q</code>, <code>--quiet</code></dt><dd><p>If lock can't be acquired 
immediately, silently quit without error.</p></dd>
+<dt><code>--version</code></dt><dd><p>Show program's version number and 
exit.</p></dd>
+<dt><code>-h</code>, <code>--help</code></dt><dd><p>Show command synopsis and 
exit.</p></dd>
+<dt><code>-w</code> <var>seconds</var>, 
<code>--wait</code>=<var>seconds</var></dt><dd><p>Wait for maximum 
<var>seconds</var> for the lock to be acquired.</p></dd>
+</dl>
+
+
+<h2 id="EXAMPLES">EXAMPLES</h2>
+
+<p>Instead of your command</p>
+
+<pre><code>&lt;command> [&lt;args>...]
+</code></pre>
+
+<p>you simply use</p>
+
+<pre><code>withlock &lt;lockfile> &lt;command> [&lt;args>...]
+</code></pre>
+
+<p><span class="man-ref">cron<span class="s">(8)</span></span> jobs, 
especially long running ones, are frequently run under <a class="man-ref" 
href="withlock.1.html">withlock<span class="s">(1)</span></a>.
+Here's an example:</p>
+
+<pre><code>-*/10 * * * *   root     withlock LOCK-serverstatus 
/usr/bin/log_server_status2
+43 5,17 * * *   mirror   withlock LOCK-rsync-edu-isos rsync -rlptoH --no-motd 
rsync.opensuse-education.org::download/ISOs/ 
/srv/mirrors/opensuse-education/ISOs -hi
+</code></pre>
+
+<h2 id="HISTORY">HISTORY</h2>
+
+<p>This wrapper was implemented because no comparable solution was found even
+after looking around for a long time (and suffering problems caused by missing
+or insufficient locking for years). The only solution that comes close is
+with-lock-ex.c, an implementation in C, which was written by Ian Jackson and
+placed in the public domain by him. with-lock-ex.c is traditionally available
+on Debian in a package named chiark-utils-bin. Parts of withlock's locking
+strategy and parts of the usage semantics were inspired from that program. This
+implementation was chosen to be done in Python because it's universally
+available, easy to adapt, and doesn't require to be compiled.</p>
+
+<p>Then, somebody pointed out to me that there's <span 
class="man-ref">flock<span class="s">(1)</span></span>, a small tool written in
+C that does the same. Indeed, I had apparently managed to miss that tool during
+a decade's worth of Linux hacking (you discover something new every day, don't
+you?). The functionality is mainly the same indeed.</p>
+
+<p>However, <a class="man-ref" href="withlock.1.html">withlock<span 
class="s">(1)</span></a> has some advantages:</p>
+
+<ul>
+<li><a class="man-ref" href="withlock.1.html">withlock<span 
class="s">(1)</span></a> ist a little easier and logical to use than <span 
class="man-ref">flock<span class="s">(1)</span></span>. The
+semantics are more suited for sysadmins.</li>
+<li><a class="man-ref" href="withlock.1.html">withlock<span 
class="s">(1)</span></a> always cleans up it's lock files. <span 
class="man-ref">flock<span class="s">(1)</span></span> always lets them lying
+around. I admit that I like the fact that with <a class="man-ref" 
href="withlock.1.html">withlock<span class="s">(1)</span></a> I can always see
+by the presence of the lock files which jobs are running.</li>
+<li><span class="man-ref">flock<span class="s">(1)</span></span> doesn't 
prevent using unsafe directories</li>
+<li><a class="man-ref" href="withlock.1.html">withlock<span 
class="s">(1)</span></a> is easily extensible</li>
+<li>it could be used as a Python module (not implemented so far)</li>
+<li><span class="man-ref">flock<span class="s">(1)</span></span> doesn't exist 
on Solaris and OSX</li>
+</ul>
+
+
+<h2 id="BUGS">BUGS</h2>
+
+<p><a class="man-ref" href="withlock.1.html">withlock<span 
class="s">(1)</span></a> has been tested on many platforms, including Debian, 
Ubuntu,
+openSUSE, CentOS, Fedora, FreeBSD, OSX, OpenCSW Solaris and is in production
+use since 2009. There don't seem to be race conditions (the author tried very
+hard to break it) but there are no guarantees.</p>
+
+<h2 id="AUTHOR">AUTHOR</h2>
+
+<p>This program was written by Peter Pöml <a 
href="&#109;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#112;&#x65;&#116;&#x65;&#x72;&#64;&#x70;&#111;&#101;&#x6d;&#108;&#46;&#x64;&#x65;"
 
data-bare-link="true">&#112;&#101;&#x74;&#x65;&#114;&#x40;&#112;&#x6f;&#x65;&#x6d;&#108;&#x2e;&#100;&#101;</a>
 in 2009.</p>
+
+<h2 id="SEE-ALSO">SEE ALSO</h2>
+
+<p><span class="man-ref">flock<span class="s">(1)</span></span><br />
+<span class="man-ref">with-lock-ex<span class="s">(1)</span></span> from 
Debian package chiark-utils-bin</p>
+
+
+  <ol class='man-decor man-foot man foot'>
+    <li class='tl'></li>
+    <li class='tc'>June 2015</li>
+    <li class='tr'>withlock(1)</li>
+  </ol>
+
+  </div>
+</body>
+</html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/withlock-0.3/withlock.1.ronn 
new/withlock-0.4/withlock.1.ronn
--- old/withlock-0.3/withlock.1.ronn    1970-01-01 01:00:00.000000000 +0100
+++ new/withlock-0.4/withlock.1.ronn    2015-06-15 02:24:25.000000000 +0200
@@ -0,0 +1,118 @@
+withlock(1) -- locking wrapper script
+=====================================
+
+## SYNOPSIS
+
+`withlock` <lockfile> <command> [<args>...]<br>
+`withlock` [`-w <seconds>`|`--wait`=<seconds>] [`-q`|`--quiet`] 
[`-v`|`--verbose`] <lockfile> <command> [<args>...]<br>
+`withlock` [`-h`|`--help`]<br>
+`withlock` [`--version`]
+
+
+## DESCRIPTION
+
+withlock(1) is a wrapper script to make sure that some program isn't run
+more than once. It is ideal to prevent periodic jobs spawned by cron(8) from
+stacking up.
+
+It uses locks that are valid only while the wrapper is running, and thus will
+*never* require additional cleanup, even after a system crash or reboot. This
+makes the wrapper safe and easy to use, and better than implementing
+half-hearted locking within scripts.
+
+The script can wait a defined time for a lock to become "free".
+
+
+## SECURITY
+
+Lockfiles, generally, MUST NOT be placed in a publicly writable directory,
+because that would allow for a symlink attack. For that reason, withlock(1)
+simply disallows lockfiles in such locations.
+
+
+## OPTIONS
+
+  * `-v`, `--verbose`:
+    Print debug messages to stderr.
+  
+  * `-q`, `--quiet`:
+    If lock can't be acquired immediately, silently quit without error.
+  
+  * `--version`:
+    Show program's version number and exit.
+  
+  * `-h`, `--help`:
+    Show command synopsis and exit.
+  
+  * `-w` <seconds>, `--wait`=<seconds>:
+    Wait for maximum <seconds> for the lock to be acquired.
+
+
+## EXAMPLES
+
+Instead of your command 
+
+    <command> [<args>...]
+
+you simply use
+
+    withlock <lockfile> <command> [<args>...]
+
+cron(8) jobs, especially long running ones, are frequently run under 
withlock(1).
+Here's an example:
+
+
+    -*/10 * * * *   root     withlock LOCK-serverstatus 
/usr/bin/log_server_status2
+    43 5,17 * * *   mirror   withlock LOCK-rsync-edu-isos rsync -rlptoH 
--no-motd rsync.opensuse-education.org::download/ISOs/ 
/srv/mirrors/opensuse-education/ISOs -hi
+
+
+
+## HISTORY
+
+This wrapper was implemented because no comparable solution was found even
+after looking around for a long time (and suffering problems caused by missing
+or insufficient locking for years). The only solution that comes close is
+with-lock-ex.c, an implementation in C, which was written by Ian Jackson and
+placed in the public domain by him. with-lock-ex.c is traditionally available
+on Debian in a package named chiark-utils-bin. Parts of withlock's locking
+strategy and parts of the usage semantics were inspired from that program. This
+implementation was chosen to be done in Python because it's universally
+available, easy to adapt, and doesn't require to be compiled.
+
+Then, somebody pointed out to me that there's flock(1), a small tool written in
+C that does the same. Indeed, I had apparently managed to miss that tool during
+a decade's worth of Linux hacking (you discover something new every day, don't
+you?). The functionality is mainly the same indeed. 
+
+However, withlock(1) has some advantages:
+
+- withlock(1) ist a little easier and logical to use than flock(1). The
+  semantics are more suited for sysadmins.
+- withlock(1) always cleans up it's lock files. flock(1) always lets them lying
+  around. I admit that I like the fact that with withlock(1) I can always see
+  by the presence of the lock files which jobs are running.
+- flock(1) doesn't prevent using unsafe directories
+- withlock(1) is easily extensible
+- it could be used as a Python module (not implemented so far)
+- flock(1) doesn't exist on Solaris and OSX
+
+
+## BUGS
+
+
+withlock(1) has been tested on many platforms, including Debian, Ubuntu,
+openSUSE, CentOS, Fedora, FreeBSD, OSX, OpenCSW Solaris and is in production
+use since 2009. There don't seem to be race conditions (the author tried very
+hard to break it) but there are no guarantees.
+
+
+
+
+## AUTHOR  
+
+This program was written by Peter Pöml <pe...@poeml.de> in 2009. 
+
+## SEE ALSO  
+
+flock(1)  
+with-lock-ex(1) from Debian package chiark-utils-bin


Reply via email to