Subject: bug#70415: 30.0.50; [Cygwin] `lock-file' creates a symlink with funny name

From: Ken Brown <[email-masked]>
Date: Mon, 22 Apr 2024 12:15:42 -0400

On 4/17/2024 8:21 AM, Eli Zaretskii wrote:
>> Date: Wed, 17 Apr 2024 08:58:42 +0900
>> From: Katsumi Yamaoka <[email-masked]>
>> Cc: [email-masked]
>>
>> On Tue, 16 Apr 2024 16:32:17 +0300, Eli Zaretskii wrote:
>>>> .#FILE -> [email-masked]:-11644473599
>>>> For that case `(unlock-file "FILE")' issues this warning:
>>>> Warning (unlock-file): Unlocking file: Invalid argument, FILE, ignored
>>
>>> The part after the colon is the system boot time, and is used on all
>>> Posix hosts.
>>
>> Oh, I had never seen it until recently.  Thanks.
> 
> The question is: why it started appearing only recently?  The code in
> filelock.c hasn't changed since last December, if not earlier, so if
> this started happening recently, it could only be because Gnulib's
> get_boot_time or its Cygwin implementation changed, such that it was
> previously returning zero whereas now it returns non-zero (which
> triggers the addition of the ":BOOT_TIME" part to the file name).
> 
>>>> | commit 393f58c85aeb78f814866ccaad9ae7efd3fa6766
>>>> | Author: Adam Porter <[email-masked]>
>>>> | Date:   Fri Mar 8 23:43:14 2024 -0600
>>
>>> This is extremely unlikely to have caused the problem.  It is more
>>> likely that some change in Cygwin and/or in the Gnulib's boot-time
>>> module causes this now.
>>
>> Indeed.  But the fact is that Emacs built with that revno adds
>> a colon and a negative number to a link name and the one built
>> with just before it does not.  No problem on 29.3.50 and earlier,
>> either (i.e., not add a colon and numbers).
> 
> Then please step with a debugger through the relevant code in
> filelock.c, before and after that change, and see why they are
> different.  I cannot explain that, even after doing "git log -L" on
> all of filelock.c: the most recent change of the related code was in
> Aug 2023, AFAICT, which is a very far cry from Mar 2024.
> 
> And even if we understand why you now get the ":BOOT_TIME" part,
> there's still the question why it cannot be unlinked, if Cygwin
> supports file names with a colon.  Maybe it's because Emacs creates a
> symlink, and symlinks with such names are not supported by Cygwin?

I'm still traveling for another week and won't have time to try to 
reproduce and debug this until I return.  But I did do one quick test in 
a Cygwin shell.  I created a symlink

   .#FILE -> [email-masked]:-11644473599

and deleted it with rm.  So symlinks like this are indeed supported by 
Cygwin.

To be continued...

Ken