Subject: Re: bug#21723: 24.5; Bug in `server-kill-emacs-query-function'

From: Eli Barzilay <[email-masked]>
Date: Thu, 22 Oct 2015 01:30:28 -0400

On Wed, Oct 21, 2015 at 12:51 PM, Eli Zaretskii <[email-masked]> wrote:
>> From: Eli Barzilay <[email-masked]>
>> Date: Wed, 21 Oct 2015 04:52:01 -0400
>>
>> The code in `server-kill-emacs-query-function' (in server.el) has this
>> in an `or':
>>
>>     (let (live-client)
>>       (dolist (proc server-clients)
>>         (when (memq t (mapcar 'buffer-live-p (process-get
>>                                               proc 'buffers)))
>>           (setq live-client t)))
>>       live-client)
>>
>> IIUC, this looks for a live client, and if there is one, the t result
>> means that the yes-or-no-p question in the end will *not* get asked.
>> I verified this by:
>>
>>   * Starting emacs -Q and in it start the server
>>
>>   * Run emacsclient on a random file
>>
>>   * Now, C-x C-c exits without asking any questions.
>>
>> It seems to me like that condition is reversed, an the last line
>> should instead be: (not live-client)
>
> Ouch!  This bug was there for almost 10 years, since the simple loop
> was rewritten as dolist, and the negation of the result was dropped in
> the process.

(Ah -- I saw the bug when adapting old hacks to new code, and saw that
difference.  I wondered why I didn't report it if I had a fixed version,
but my hacks were probably more than 10 years old so based on the
previous version...)

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!