emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57501: closed (call-with-file-lock does not remove lock file)


From: GNU bug Tracking System
Subject: bug#57501: closed (call-with-file-lock does not remove lock file)
Date: Sun, 12 Feb 2023 00:53:02 +0000

Your message dated Sun, 12 Feb 2023 01:52:36 +0100
with message-id <87y1p3ln6z.fsf@gnu.org>
and subject line Re: bug#57501: call-with-file-lock does not remove lock file
has caused the debbugs.gnu.org bug report #57501,
regarding call-with-file-lock does not remove lock file
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
57501: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57501
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: call-with-file-lock does not remove lock file Date: Wed, 31 Aug 2022 11:50:38 +0200 User-agent: mu4e 1.8.7; emacs 28.1
“call-with-file-lock” and “call-with-file-lock/no-wait” create a lock
file but don’t remove the lock file when they exit.

(guix build syscalls) defines these procedures with “dynamic-wind” so
that the lock is always lifted with “unlock-file”.  While “unlock-file”
uses the fcntl syscall to remove the lock on the file, the lock file
itself is not deleted.

I think it should be deleted.  When the lock file sticks around we may
run into problems due to lock file ownership.  For example, imagine a
cron job running as a different user that upgrades the contents of a
user profile.  That cron job would leave behind an unlocked lock file
owned by that user, preventing the owner of the profile from operating
on the profile even though the lock has already been lifted with
“unlock-file”.

I propose letting either unlock-file or with-profile-lock delete the
lock file.

-- 
Ricardo



--- End Message ---
--- Begin Message --- Subject: Re: bug#57501: call-with-file-lock does not remove lock file Date: Sun, 12 Feb 2023 01:52:36 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Ricardo Wurmus <rekado@elephly.net> skribis:

> “call-with-file-lock” and “call-with-file-lock/no-wait” create a lock
> file but don’t remove the lock file when they exit.
>
> (guix build syscalls) defines these procedures with “dynamic-wind” so
> that the lock is always lifted with “unlock-file”.  While “unlock-file”
> uses the fcntl syscall to remove the lock on the file, the lock file
> itself is not deleted.
>
> I think it should be deleted.  When the lock file sticks around we may
> run into problems due to lock file ownership.  For example, imagine a
> cron job running as a different user that upgrades the contents of a
> user profile.  That cron job would leave behind an unlocked lock file
> owned by that user, preventing the owner of the profile from operating
> on the profile even though the lock has already been lifted with
> “unlock-file”.
>
> I propose letting either unlock-file or with-profile-lock delete the
> lock file.

Agreed.  Done in a68229b9a0f450db622511adfe00ff7307d745d3, thanks!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]