unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs@gentoo.org, 1474@debbugs.gnu.org, thierry.volpiatto@gmail.com
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	[thread overview]
Message-ID: <87r1w98bfj.fsf@stefankangas.se> (raw)
In-Reply-To: <83v9ohcdi7.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Feb 2020 17:20:00 +0200")

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	other threads:[~2020-04-27 10:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-02 21:43 bug#1474: 23.0.60; desktop.el don't check if pid in his lock file is always in use Thierry Volpiatto
2008-12-02 22:39 ` Juanma Barranquero
2008-12-03  6:36   ` Thierry Volpiatto
2008-12-03  8:25     ` Juanma Barranquero
2008-12-03  8:47       ` Thierry Volpiatto
2008-12-03  9:15         ` Juanma Barranquero
2008-12-03 10:08           ` Thierry Volpiatto
2008-12-03 10:20             ` Juanma Barranquero
2008-12-03 21:27         ` Stefan Monnier
2008-12-03  9:14       ` Ulrich Mueller
2008-12-03  9:16         ` Juanma Barranquero
2008-12-02 22:52 ` Stefan Monnier
2008-12-02 23:06   ` Ulrich Mueller
2008-12-03  6:30   ` Thierry Volpiatto
2020-01-24 16:47 ` Stefan Kangas
2020-02-08 14:23   ` Stefan Kangas
2020-02-08 15:20     ` Eli Zaretskii
2020-04-27 10:34       ` Stefan Kangas [this message]
2020-04-27 14:50         ` Eli Zaretskii
2022-03-24  8:25           ` bug#1474: bug#25232: 24.4; Eliminate - Warning: Desktop file appears to be " Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1w98bfj.fsf@stefankangas.se \
    --to=stefan@marxist.se \
    --cc=1474@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs@gentoo.org \
    --cc=thierry.volpiatto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).