GNU bug report logs - #71477
30.0.50; Lock files are not deleted on Windows 98

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Mon, 10 Jun 2024 16:41:04 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 71477 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>, Po Lu <luangruo <at> yahoo.com>
Cc: 71477 <at> debbugs.gnu.org
Subject: Re: bug#71477: 30.0.50; Lock files are not deleted on Windows 98
Date: Wed, 12 Jun 2024 09:07:52 -0700
[Message part 1 (text/plain, inline)]
On 2024-06-12 01:25, Eli Zaretskii wrote:

> -  if (! c_isdigit (dot[1]))
> +  if (! (c_isdigit (dot[1])
> +	 /* Windows 9X report negative PID values.  */
> +	 || (dot[1] == '-' && c_isdigit (dot[2]))))

Faster is "if (! c_isdigit[(dot[1] == '-') + 1])", as it avoids a 
conditional branch on most platforms.


> -      else if (0 < pid && pid <= TYPE_MAXIMUM (pid_t)
> +      else if (pid != -1 && pid <= TYPE_MAXIMUM (pid_t)
>                  && (kill (pid, 0) >= 0 || errno == EPERM)

This looks dubious for most systems, where 'kill' has special behavior 
when pid < -1 or pid == 0; it tests a process group. That's not the test 
we want here, since we want to check whether Emacs can be sent a signal, 
not whether any process in its process group can be sent a signal (this 
can be valid even after Emacs has exited). The code should use calls 
like kill (-2, 0) and kill (0, 0) only on platforms where we know the 
calls do not test a process group.

Even on MS Windows 98 we should check that TYPE_MINIMUM (pid_t) <= pid. 
Also, is there a special meaning for kill (0, 0) on MS Windows 98? If 
so, we should also check that pid != 0.

Do any MS-Windows platforms support process groups, i.e., kill (-2, 0) 
operates on process group 2 rather than on an individual process with 
process ID -2? If so, these platforms should be careful too, and should 
not use kill (-2, 0) or kill (0, 0).

How about the attached patch instead? You can adjust the 
Microsoft-specific .h files to define VALID_PROCESS_ID appropriately for 
MS Windows 98, and for any other MS platform where kill (-2, 0) is known 
to check for just the individual process -2.
[0001-Start-of-a-fix-for-bug-71477.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.