unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: 57501@debbugs.gnu.org
Subject: bug#57501: call-with-file-lock does not remove lock file
Date: Wed, 31 Aug 2022 11:50:38 +0200	[thread overview]
Message-ID: <87v8q8razk.fsf@elephly.net> (raw)

“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




             reply	other threads:[~2022-08-31  9:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  9:50 Ricardo Wurmus [this message]
2023-02-12  0:52 ` bug#57501: call-with-file-lock does not remove lock file Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8q8razk.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=57501@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).