From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71477: 30.0.50; Lock files are not deleted on Windows 98 Date: Wed, 12 Jun 2024 20:10:50 +0300 Message-ID: <86sexiytlx.fsf@gnu.org> References: <87r0d4bzut.fsf.ref@yahoo.com> <87r0d4bzut.fsf@yahoo.com> <867cew8zgh.fsf@gnu.org> <87ikygb6hp.fsf@yahoo.com> <86h6e06kn5.fsf@gnu.org> <87bk47c4cd.fsf@yahoo.com> <86bk477vzx.fsf@gnu.org> <871q53c2ur.fsf@yahoo.com> <868qzb7uic.fsf@gnu.org> <87jzivamzp.fsf@yahoo.com> <86h6dy1saf.fsf@gnu.org> <531dbf85-2554-43aa-bca1-db50e0bf2306@cs.ucla.edu> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16041"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 71477@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 12 19:12:33 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sHRWS-0003oy-9f for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Jun 2024 19:12:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHRW1-0001LD-P7; Wed, 12 Jun 2024 13:12:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHRW0-0001KU-C0 for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2024 13:12:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHRW0-0006g5-3L for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2024 13:12:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sHRVy-0001u8-2O for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2024 13:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Jun 2024 17:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71477 X-GNU-PR-Package: emacs Original-Received: via spool by 71477-submit@debbugs.gnu.org id=B71477.17182122627240 (code B ref 71477); Wed, 12 Jun 2024 17:12:02 +0000 Original-Received: (at 71477) by debbugs.gnu.org; 12 Jun 2024 17:11:02 +0000 Original-Received: from localhost ([127.0.0.1]:40058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sHRUz-0001sX-JV for submit@debbugs.gnu.org; Wed, 12 Jun 2024 13:11:02 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sHRUv-0001sB-Hf for 71477@debbugs.gnu.org; Wed, 12 Jun 2024 13:11:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHRUq-0006OP-E1; Wed, 12 Jun 2024 13:10:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=dZz33Nsnn+SxbnLcX7uyXIHbrCn9I5/35wOuUUNAwGo=; b=BkFI0s36Lyg6 CUWknuP/1IcfLFU6LJX1Pe+F/w2CQY4F/BSm5GQGoo8Z74UVQKY7uK0CEz3qtFYp/+X5nG8WtE8Dh tFsXdcYhGXne7LrY44qghudpirAP+R6RLd1S323B4N7Rclbk2sKgVCvlkRtaO8Lf2HrqBKRCJzzcm 8knXBxLmVZJDmzJN5F/ZHtksMOvAgc4ES+t/L61Z5XHfYpJYTDgqK1n+ANueS0svw0hy/DlotvIXB Nvuds29M6reqVmrPkAIVLn+A+WqQoWcH7toxPSyDgWY7p+woULw5a0G7aMIMH2yyE2jdE4JMASTYX STzppmg3g19dnOsXxDAivA==; In-Reply-To: <531dbf85-2554-43aa-bca1-db50e0bf2306@cs.ucla.edu> (message from Paul Eggert on Wed, 12 Jun 2024 09:07:52 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287167 Archived-At: > Date: Wed, 12 Jun 2024 09:07:52 -0700 > Cc: 71477@debbugs.gnu.org > From: Paul Eggert > > > 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. OK. > > - 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. But on all platforms except Windows 9X we shouldn't see a negative PID here, so what you say is purely theoretical, no? > Even on MS Windows 98 we should check that TYPE_MINIMUM (pid_t) <= pid. Since pid_t is typedefed as 'int', that's always true, no? > Also, is there a special meaning for kill (0, 0) on MS Windows 98? No. And our emulation of 'kill' fails with EPERM when called witgh both arguments zero. > If so, we should also check that pid != 0. There are no processes on Windows whose PID is zero, so getting zero here is impossible. > 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). Windows does support process groups, but our emulation of 'kill' pretends that each process is its own group. > 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. Fine with me, please install and I will followup. Thanks.