Accepting request 1046095 from Base:System

OBS-URL: https://build.opensuse.org/request/show/1046095
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/withlock?expand=0&rev=11
This commit is contained in:
Dominique Leuenberger 2023-01-02 14:02:10 +00:00 committed by Git OBS Bridge
commit 744f87f560
3 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,37 @@
https://github.com/poeml/withlock/pull/5
From 218831d810b44675c948786d3ce4d3d3180e83e0 Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
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 <bwiedemann@suse.de>
---
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

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sun Jan 1 13:51:36 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add withlock-0.5-fixboo864785.patch to fix concurrent locking (boo#864785)
-------------------------------------------------------------------
Thu Oct 3 08:54:21 UTC 2019 - munix9@googlemail.com

View File

@ -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