civodul pushed a commit to branch master
in repository guix.
commit a68229b9a0f450db622511adfe00ff7307d745d3
Author: Ludovic Courtès <[email protected]>
AuthorDate: Sun Feb 12 01:15:51 2023 +0100
syscalls: 'with-file-lock' removes lock file upon exit.
Fixes <https://issues.guix.gnu.org/57501>.
Reported by Ricardo Wurmus <[email protected]>.
* guix/build/syscalls.scm (call-with-file-lock)
(call-with-file-lock/no-wait): Add call to 'delete-file' in unwind
handler.
---
guix/build/syscalls.scm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 0358960ff5..df9b9f6ac7 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014-2022 Ludovic Courtès <[email protected]>
+;;; Copyright © 2014-2023 Ludovic Courtès <[email protected]>
;;; Copyright © 2015 David Thompson <[email protected]>
;;; Copyright © 2015 Mark H Weaver <[email protected]>
;;; Copyright © 2017 Mathieu Othacehe <[email protected]>
@@ -1400,7 +1400,8 @@ exception if it's already taken."
thunk
(lambda ()
(when port
- (unlock-file port))))))
+ (unlock-file port)
+ (delete-file file))))))
(define (call-with-file-lock/no-wait file thunk handler)
(let ((port #f))
@@ -1428,7 +1429,8 @@ exception if it's already taken."
thunk
(lambda ()
(when port
- (unlock-file port))))))
+ (unlock-file port)
+ (delete-file file))))))
(define-syntax-rule (with-file-lock file exp ...)
"Wait to acquire a lock on FILE and evaluate EXP in that context."