From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#11536: 23.4; frequent spurious auto-save while typing Date: Sat, 03 Nov 2012 23:46:36 +0800 Message-ID: <87d2zupu3n.fsf@gnu.org> References: <20120521212217.GA29282@psychosis.jim.sh> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1351957636 17074 80.91.229.3 (3 Nov 2012 15:47:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Nov 2012 15:47:16 +0000 (UTC) Cc: 11536@debbugs.gnu.org To: Jim Paris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 03 16:47:23 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TUfwP-0005Yp-0x for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Nov 2012 16:47:21 +0100 Original-Received: from localhost ([::1]:50708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUfwG-0000km-EG for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Nov 2012 11:47:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUfwD-0000kT-Ff for bug-gnu-emacs@gnu.org; Sat, 03 Nov 2012 11:47:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUfwC-0002Us-HI for bug-gnu-emacs@gnu.org; Sat, 03 Nov 2012 11:47:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUfwC-0002Ui-Az for bug-gnu-emacs@gnu.org; Sat, 03 Nov 2012 11:47:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TUfz0-0001PP-6u for bug-gnu-emacs@gnu.org; Sat, 03 Nov 2012 11:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Nov 2012 15:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11536 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11536-submit@debbugs.gnu.org id=B11536.13519577805380 (code B ref 11536); Sat, 03 Nov 2012 15:50:02 +0000 Original-Received: (at 11536) by debbugs.gnu.org; 3 Nov 2012 15:49:40 +0000 Original-Received: from localhost ([127.0.0.1]:47317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TUfyd-0001Oh-3o for submit@debbugs.gnu.org; Sat, 03 Nov 2012 11:49:39 -0400 Original-Received: from mail-da0-f44.google.com ([209.85.210.44]:53951) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TUfya-0001Oa-VG for 11536@debbugs.gnu.org; Sat, 03 Nov 2012 11:49:37 -0400 Original-Received: by mail-da0-f44.google.com with SMTP id h15so2047542dan.3 for <11536@debbugs.gnu.org>; Sat, 03 Nov 2012 08:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=VKuV3FHZijXOqyPegMRuqSW6nRt9Gx43dFCZCh+ueUo=; b=XvxNWbk7h0U6wJ986kFeqKj9PmbUpCkc68un4zyqPujFNBWACHa1d7eWXM/n9azdfw FC6pBf9+PxxBgc8C2jtTSOxZ91gK1VrHr0BQx1QNmAAzkXjjrF8UFYEDJkJbdmxZdz91 9Xv2ILizuTzP839mGPBTHa6TA6fgcZUG2wG/Hq+Y+ultMC3ELpcNC7QvnKn8gV77ryby w3jP9HxUozAXVWlOG77FUTyXcCd3VGgCrQVn1m2YICc4z3rKlVZoLOxnEVk/9qxbTdU4 pSLKWmAUPjA56LOJ/tkL5NnD+sEeOADAfP00C2MjmXJ6obv7BarGP9oS1O02il/NnPwe sGig== Original-Received: by 10.68.202.41 with SMTP id kf9mr16158636pbc.56.1351957601599; Sat, 03 Nov 2012 08:46:41 -0700 (PDT) Original-Received: from ulysses (cm198.gamma83.maxonline.com.sg. [202.156.83.198]) by mx.google.com with ESMTPS id ay5sm7561547pab.1.2012.11.03.08.46.38 (version=SSLv3 cipher=OTHER); Sat, 03 Nov 2012 08:46:40 -0700 (PDT) In-Reply-To: <20120521212217.GA29282@psychosis.jim.sh> (Jim Paris's message of "Mon, 21 May 2012 17:22:17 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66385 Archived-At: Jim Paris writes: > The call to keyboard.c:set_waiting_for_input is essentially telling the > keyboard.c:input_available_signal handler to reset &timeout to zero in > the case of SIGIO. However, consider what happens if a key is pressed > and SIGIO is received between set_waiting_for_input and select. > Then timeout will have been set to zero, and select will return > immediately with nfds == 0. The check in 5007 will then break the > while loop, causing wait_reading_process_output to return immediately > without any data having been read -- triggering the auto-save back > in keyboard.c:read_char. > > It seems the fix is simple: remove lines 5007-5009. It's a small > optimization that isn't necessary, because the later check at line 5129 > already covers the case where nfds == 0. Continuing the loop is fine, > because the top of the loop checks for an expired timeout and returns. Thanks for the bug report and the analysis. I couldn't reproduce the problem, but off the top of my head the analysis is correct, so I've made the change you suggested in trunk.