diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-02-12 01:15:51 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-02-12 01:48:53 +0100 |
commit | a68229b9a0f450db622511adfe00ff7307d745d3 (patch) | |
tree | 69bd89acde4a3f4ca1cbefc3c639ceeb5430da5d /guix/build | |
parent | 89c5cb4078f52f103e6221978a2ea75e0c474769 (diff) | |
download | guix-patches-a68229b9a0f450db622511adfe00ff7307d745d3.tar guix-patches-a68229b9a0f450db622511adfe00ff7307d745d3.tar.gz |
syscalls: 'with-file-lock' removes lock file upon exit.
Fixes <https://issues.guix.gnu.org/57501>.
Reported by Ricardo Wurmus <rekado@elephly.net>.
* guix/build/syscalls.scm (call-with-file-lock)
(call-with-file-lock/no-wait): Add call to 'delete-file' in unwind
handler.
Diffstat (limited to 'guix/build')
-rw-r--r-- | guix/build/syscalls.scm | 8 |
1 files 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 <ludo@gnu.org> +;;; Copyright © 2014-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 David Thompson <davet@gnu.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> @@ -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." |