bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1474: 23.0.60; desktop.el don't check if pid in his lock file is alw


From: Stefan Kangas
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]