From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#1474: 23.0.60; desktop.el don't check if pid in his lock file is always in use Date: Mon, 27 Apr 2020 12:34:08 +0200 Message-ID: <87r1w98bfj.fsf@stefankangas.se> References: <87bpvufe28.fsf@tux.homenetwork> <87v9p094ym.fsf@marxist.se> <87eev56tuu.fsf@marxist.se> <83v9ohcdi7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="2534"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs@gentoo.org, 1474@debbugs.gnu.org, thierry.volpiatto@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 27 12:36:47 2020 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 1jT182-0000Ys-BW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 12:36:46 +0200 Original-Received: from localhost ([::1]:37976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jT181-0001ww-DE for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Apr 2020 06:36:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44750) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jT16M-0008Ax-Ov for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 06:35:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jT16M-0005yz-5H for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 06:35:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jT16L-0005x3-O7 for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 06:35:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jT16L-0003Qa-Kp for bug-gnu-emacs@gnu.org; Mon, 27 Apr 2020 06:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Apr 2020 10:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1474 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 1474-submit@debbugs.gnu.org id=B1474.158798366213111 (code B ref 1474); Mon, 27 Apr 2020 10:35:01 +0000 Original-Received: (at 1474) by debbugs.gnu.org; 27 Apr 2020 10:34:22 +0000 Original-Received: from localhost ([127.0.0.1]:35702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jT15i-0003PO-6F for submit@debbugs.gnu.org; Mon, 27 Apr 2020 06:34:22 -0400 Original-Received: from ted.gofardesign.uk ([67.225.143.91]:60728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jT15f-0003PB-WE for 1474@debbugs.gnu.org; Mon, 27 Apr 2020 06:34:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+gCdLOfQmosLBYvqRF1UmbuNjg7AGaogNK5VSDzs3CY=; b=gH6rCM/D2W8dGoGa2+pYwDyoZo FC3EkgdVkMKyWgVpmBI1retJz6F65uPD4Z1nbcDEN+yL7VlECdpXKZKJrC0IFI+hPouzaZFOtlGxV daojEZzEI+KX2ixuJQFIGhT+M4rNhk/+6FiryH/t1XT3yNr9wCdRrjLGzJ2riYrBjWegyY3kE67Q5 SY3IR3nbJCCWLa+LIYp1EYV0WQj9MCKiX3UtAJLOzX1IZQQjFsrYAXlCXKxPa/HMEYwP5YLwC2Wck FETfJaZlSPSJPDUZmBNghok+UnWsM0v8NV3BDAnDQ/qegzG/dzYywZp1wnrPN58WdCcPz7M0/B/Y8 hFM+5GRA==; Original-Received: from h-4-70-69.a785.priv.bahnhof.se ([155.4.70.69]:59000 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jT15W-001jnu-VN; Mon, 27 Apr 2020 06:34:11 -0400 In-Reply-To: <83v9ohcdi7.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Feb 2020 17:20:00 +0200") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:179140 Archived-At: Eli Zaretskii writes: > Sorry, I failed to present my comments at the time, so let me do that > now: Thank you kindly for the review. > I'd prefer 'check-pid' or maybe 'dead-pid' for this option. "Check" > is too general. Agreed. > You are right in mentioning that this should not be used for processes > that run on other machines, but how can a user make sure this is not > the case? Maybe we should modify the contents of the lock file to > include the host where the process was running, like we do with > file-locks? OK, I'll get to work on this. > Or maybe we should still ask for permission if there's no > such process, just with a different text, so that users who are sure > they _never_ run Emacs from another system could decide to unlock the > file more easily? The motivation here was to have no prompt at all if we can avoid it. So I think I'll get to work an the above suggestion instead, if that's acceptable. >> +(defun desktop--emacs-pid-running-p (pid) >> + "Return t if an Emacs process with PID exists." >> + (when-let ((attr (process-attributes pid))) >> + (string-match "^emacs$" (alist-get 'comm attr)))) > > I understand the rationale for the string-match test, but what if the > executable file name of Emacs was "transformed", per the > '--program-transform-name' option of the configure script? And even > if it wasn't transformed, this will not match emacs-XX.YY and > emacs.exe. Good point. But would you suggest to use no check at all, or is there some other check we could reasonably use? I assume it is impossible to use the process name due to '--program-transform-name'. Maybe we could think about prompting for the case where the pid exists, but the name doesn't match "^emacs"? The user should know best if this is a renamed process or what. Best regards, Stefan Kangas