Subject: bug#70973: 29.1; "Unlocking file: Invalid argument" Warning saving via a softlink with stale file lock

From: Duncan Greatwood <[email-masked]>
Date: Thu, 16 May 2024 07:17:59 -0700

> If you can reproduce the problem, please tell what does
>
>   ls -l ~/Dropbox/Documents/Projects/emacs/.#dotemacs
>
> produce when you see the warnings

As follows:
$ ls -l ~/Dropbox/Documents/Projects/emacs/.#dotemacs
-rw-r--r--@ 1 username  staff  0 May 16 07:13
/Users/username/Dropbox/Documents/Projects/emacs/.#dotemacs

On Thu, May 16, 2024 at 1:43 AM Eli Zaretskii <[email-masked]> wrote:

> > From: Duncan Greatwood <[email-masked]>
> > Date: Wed, 15 May 2024 17:53:05 -0700
> >
> > While editing the ~/.emacs file in emacs, the machine rebooted (kernel
> panic I believe). This left a lock file
> > behind.
> >
> > The ~/.emacs file is actually a softlink:
> > .emacs -> /Users/<username>/Dropbox/Documents/Projects/emacs/dotemacs
> > The fact that it's a softlink may or may not be relevant.
> >
> > In ~/Dropbox/Documents/Projects/emacs/, there was a file: .#dotemacs
> >
> > After the reboot, I started emacs, and continued with further edits to
> .emacs. Upon saving .emacs, had the
> > following warning:
> > ⛔ Warning (unlock-file): Unlocking file: Invalid argument,
> ~/Dropbox/Documents/Projects/emacs/dotemacs,
> > ignored
> >
> > As per the warning, the save was nonetheless successful.
> >
> > Invoking file-locked-p directly, I saw the same error, and the following
> debug info:
> > Debugger entered--Lisp error: (file-error "Testing file lock" "Invalid
> argument"
> > "~/Dropbox/Documents/Projects/emacs/dotemacs")
> >   file-locked-p("~/Dropbox/Documents/Projects/emacs/dotemacs")
> >   eval((file-locked-p "~/Dropbox/Documents/Projects/emacs/dotemacs") t)
> >   eval-expression((file-locked-p
> "~/Dropbox/Documents/Projects/emacs/dotemacs") nil nil 127)
> >   funcall-interactively(eval-expression (file-locked-p
> "~/Dropbox/Documents/Projects/emacs/dotemacs") nil nil
> > 127)
> >   call-interactively(eval-expression nil nil)
> >   command-execute(eval-expression)
> >
> > After removing the lock file manually, the warning on save goes away:
> > rm ~/Dropbox/Documents/Projects/emacs/.#dotemacs
> >
> > Access flags on dotemacs file are as follows:
> > -rw-r--r--@  1 dgreatwood  staff  133806 May 15 16:01 dotemacs
> > lrwxr-xr-x  1 dgreatwood  staff  59 Dec  6  2015 .emacs -> ...
>
> Thanks.
>
> However, this doesn't provide enough information to investigate the
> issue and its causes.  If you can reproduce the problem, please tell
> what does
>
>   ls -l ~/Dropbox/Documents/Projects/emacs/.#dotemacs
>
> produce when you see the warnings, because that is the immediate
> trigger for the "invalid argument".
>

-- 
NOTICE: This email and its attachments may contain privileged and 
confidential information, only for the viewing and use of the intended 
recipient. If you are not the intended recipient, you are hereby notified 
that any disclosure, copying, distribution, acting upon, or use of the 
information contained in this email and its attachments is strictly 
prohibited and that this email and its attachments must be immediately 
returned to the sender and deleted from your system. If you received this 
email erroneously, please notify the sender immediately.  Xage Security, 
Inc. and its affiliates will never request personal information (e.g., 
passwords, Social Security numbers) via email.  Report suspicious emails to 
[email-masked] <mailto:[email-masked]>