diff --git a/withlock-0.5-fixboo864785.patch b/withlock-0.5-fixboo864785.patch new file mode 100644 index 0000000..f760517 --- /dev/null +++ b/withlock-0.5-fixboo864785.patch @@ -0,0 +1,37 @@ +https://github.com/poeml/withlock/pull/5 + +From 218831d810b44675c948786d3ce4d3d3180e83e0 Mon Sep 17 00:00:00 2001 +From: "Bernhard M. Wiedemann" +Date: Sun, 1 Jan 2023 14:43:26 +0100 +Subject: [PATCH] Re-open lock file before locking + +because the previous 'withlock' cleanup function might have deleted +the file and since we still held a handle to the old deleted file, +we could run concurrently with a 3rd 'withlock' which creates a new file. + +Fixes #1 +Fixes boo#864785 + +Signed-off-by: Bernhard M. Wiedemann +--- + withlock | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/withlock b/withlock +index 01ef866..9e16f69 100755 +--- a/withlock ++++ b/withlock +@@ -137,12 +137,11 @@ def main(): + + prev_umask = os.umask(0o066) + +- lock = open(lockfile, 'w') +- + global got_lock + while 1 + 1 == 2: + + try: ++ lock = open(lockfile, 'w') + fcntl.lockf(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) + got_lock = True + break diff --git a/withlock.changes b/withlock.changes index 5abe531..e78c100 100644 --- a/withlock.changes +++ b/withlock.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun Jan 1 13:51:36 UTC 2023 - Bernhard Wiedemann + +- Add withlock-0.5-fixboo864785.patch to fix concurrent locking (boo#864785) + ------------------------------------------------------------------- Thu Oct 3 08:54:21 UTC 2019 - munix9@googlemail.com diff --git a/withlock.spec b/withlock.spec index 9b57b19..c0293ae 100644 --- a/withlock.spec +++ b/withlock.spec @@ -25,6 +25,7 @@ Group: System/Management URL: https://github.com/poeml/withlock Source0: %{name}-%{version}.tar.gz Patch0: fix-use-python3.patch +Patch1: withlock-0.5-fixboo864785.patch Requires: python3 BuildArch: noarch