From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Pierre Neidhardt Newsgroups: gmane.emacs.bugs Subject: bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it Date: Sun, 11 Feb 2018 17:08:10 +0100 Message-ID: <87r2prpl05.fsf@gmail.com> References: <871shram2i.fsf@gmail.com> <83mv0f1q6t.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1518365256 6534 195.159.176.226 (11 Feb 2018 16:07:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 11 Feb 2018 16:07:36 +0000 (UTC) User-Agent: mu4e 1.0; emacs 25.3.1 Cc: 30421@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 11 17:07:32 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eku9q-0000U0-C3 for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Feb 2018 17:07:14 +0100 Original-Received: from localhost ([::1]:54531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekuBr-0007Wv-SN for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Feb 2018 11:09:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekuBe-0007VC-RI for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2018 11:09:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekuBa-00052M-Q0 for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2018 11:09:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekuBa-00052A-LX for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2018 11:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ekuBa-0002bC-Fe for bug-gnu-emacs@gnu.org; Sun, 11 Feb 2018 11:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Feb 2018 16:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30421 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30421-submit@debbugs.gnu.org id=B30421.15183653019943 (code B ref 30421); Sun, 11 Feb 2018 16:09:02 +0000 Original-Received: (at 30421) by debbugs.gnu.org; 11 Feb 2018 16:08:21 +0000 Original-Received: from localhost ([127.0.0.1]:38506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekuAu-0002aJ-Ku for submit@debbugs.gnu.org; Sun, 11 Feb 2018 11:08:20 -0500 Original-Received: from mail-wr0-f171.google.com ([209.85.128.171]:45022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekuAs-0002a6-K2 for 30421@debbugs.gnu.org; Sun, 11 Feb 2018 11:08:18 -0500 Original-Received: by mail-wr0-f171.google.com with SMTP id v65so6041056wrc.11 for <30421@debbugs.gnu.org>; Sun, 11 Feb 2018 08:08:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=Q6pld81rEk8M6z0s/7RgoSzASDqveRDZRZCEU4yv8HI=; b=gSKtfEw/9EuBkZ72z4OmbZVGpKV0Aq5hyn0aEDfbx+Hhb+LUt9jTVWhYdN9p4XjJJ1 Ew2N5oQyg5q3O5N8uylwoWM9uPbmDzMjgh08RFrsbJyeJwdbPUwvdUNFby7mWiL61EgR Vaz7KkGVZCa3Z3KuVs61qJbh3eJYcMYeagz+gHDMl4wY58kNeK9cF25ut1ONbSwVymKI HG05QC65Y+mWa886kx9RR0resH/uslPghtqC0Cji5nmIOBzPykU3iexx/8MmXRLCENm6 Fg4QrEj3swG1bEn8YLyHttqI85ZrQjU4ARizYbZkjucySkbLaDkBMpE/IKEK6rSPMT6E PknA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=Q6pld81rEk8M6z0s/7RgoSzASDqveRDZRZCEU4yv8HI=; b=j73nVBs9cmjG5pS/Iyt4GRDXs3M24ZISGeTryKHhlkPAtpvt0YAFtnCDKaLCVitIJN dBxpH5r1/v35f4hiq9WvRi0U553cmZ2FEzC4u0xO6qgEbNeQ6O0vy/n6o1OwX70IfNZ1 2xS0XLYyygKJ7qPzBYIA6AIZyaP7Yu0hwHv0cNfe+wq67eq4w1xPFzhUjsT+fcIfZHZE /ftkS2KC55DAdb/W8NGIlFkOXLjYwcFdUFKBl/CVbelRyq6W0PUeYy/dWGM3zZY5/2OI ML14Lo7oaz7mQv6reHIM/n3et1lRVhh/K63FBkXK+NYOa+SdSYtUDq/iddDimjETiSwd fsHA== X-Gm-Message-State: APf1xPAmc3vpGii+gZYvo7p/lpTeUukugQtXYWV9hfiq6NG2XfuEC/Z+ dIx8HkgLYiHo1NhSxKYderLZ8A== X-Google-Smtp-Source: AH8x227bqz7NVcOGnU0QpFgAiogcru1mMuJStfWTVZty43asJw7eZJnxD8gRgh6MU43jmVQ7WUfW4A== X-Received: by 10.223.200.74 with SMTP id e10mr7482577wrh.128.1518365292624; Sun, 11 Feb 2018 08:08:12 -0800 (PST) Original-Received: from mimimi (2a01cb040a37a0003a915b0581181238.ipv6.abo.wanadoo.fr. [2a01:cb04:a37:a000:3a91:5b05:8118:1238]) by smtp.gmail.com with ESMTPSA id y90sm13528200wrc.24.2018.02.11.08.08.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 08:08:11 -0800 (PST) In-reply-to: <83mv0f1q6t.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143144 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Pierre Neidhardt >> Date: Sun, 11 Feb 2018 10:54:13 +0100 >> >> >> By default, desktop-save-mode will not save (and will set >> desktop-dirname to nil) if a lock file exists with a PID in it. >> >> It's problematic however when Emacs gets killed and does not release the >> lock. Upon next start, desktop-save-mode will refuse to save because >> the lock exists, even though no process is using it. In terms of user >> experience, it's pretty bad considering the error feedback is just one >> line in the *Messages* buffer (I almost never notice it when it happens) >> and the problem is persistent across reboots (the lock file will remain >> as long as the user does not remove it manually). > > When this happens to me, the next time I start Emacs, I'm asked > whether to use the desktop file that appears to be locked, and if I > answer YES, desktop.el goes on to restore the session, no other > questions asked, and saves the desktop upon exit with no problems. > I'm confused as to why you see something different. Could it be that > your activation of desktop-save-mode is somehow different from mine? I always run Emacs daemon. And I think the following excerpt explains it all: (defun desktop-read (&optional dirname) ... (or (null desktop-load-locked-desktop) (daemonp) (not (y-or-n-p (format "Warning: desktop file appears to be in use by PID %s.\n\ Using it may cause conflicts. Use it anyway? " owner)))) Not sure why (daemonp) is here. Removing this line would solve the issue. I just realized that `desktop-load-locked-desktop' is also a solution to my problem. >> Furthermore, isn't it strange to just check if there lock file contains >> a number and not actually check if it's an existing PID? > > You are assuming that the locking process runs on the same machine, > but that is not guaranteed. The directory where the desktop file > lives could be mounted via the network, I think. You mean in case two Emacs instances on two separate machines share the same location for `desktop-full-lock-name' over network? I don't know, is there such a use case? I might not see the point. -- Pierre Neidhardt Troubles are like babies; they only grow by nursing. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlqAamoACgkQm9z0l6S7 zH+eiwf+JZefk8DglqVrcxYH3Wl8RCRkrJDHgMNKSTmN9na0Lpe0N01LcSBrNV4G 8k4fqLllBS1qmxr0cnH6sOw86mqrAhh91b/dNPqDrzQyhw6Zry2VeOqYMZxyqSkv BtDzWGfyNJZbn1H/tIXmuNTmbeg1PGLJ8lO1acqVCzlTB6XrssIClr9GC0wYdvHk rA2Ujgg7JG2NkOlkrxLynW9EsdxAispkRZIthhHBhqUY/FkuFNnDIFPhsBDiU2wy +9ckbVz6LtGqBugWb2CxMAuQMkAnJHpesffATIyUsE88vk7ti91ZgDoP+jBroXjL mLfU/H7jYl0lPsyQyqJDBVVJnakTSw== =D+ua -----END PGP SIGNATURE----- --=-=-=--