Subject: bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it

From: Eli Zaretskii <[email-masked]>
Date: Sun, 11 Feb 2018 18:32:11 +0200

> From: Noam Postavsky <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Sun, 11 Feb 2018 11:15:02 -0500
> 
> Pierre Neidhardt <[email-masked]> writes:
> 
> > 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.
> 
> 'git blame' brings me to Bug#11674 "desktop doesn't handle unclean
> restart under daemon mode".
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=11674

Indeed: daemon cannot usefully ask this question.

So I think desktop-load-locked-desktop is indeed the right solution to
this situation.