From unknown Mon Jun 23 16:48:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12779: 24.2.50; Gamegrid signals an error when score is too low Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Nov 2012 21:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12779 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 12779@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.135180399522574 (code B ref -1); Thu, 01 Nov 2012 21:07:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Nov 2012 21:06:35 +0000 Received: from localhost ([127.0.0.1]:43540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TU1yF-0005s3-95 for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:06:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47886) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TU1yC-0005rv-Ql for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:06:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1vX-0008SU-7j for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:03:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1vX-0008SO-4m for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:03:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1vV-0005QB-P0 for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1vU-0008R5-Fy for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:45 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:58850) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TU1vU-0008Qx-6L for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:44 -0400 Received: (qmail invoked by alias); 01 Nov 2012 21:03:41 -0000 Received: from i59F54801.versanet.de (EHLO rosalinde.fritz.box) [89.245.72.1] by mail.gmx.net (mp004) with SMTP; 01 Nov 2012 22:03:41 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+LLXpLMC2LKchBhMWAbsPamFR7bxXygVovsOZNzh 1XYDKGvMnIKAZd From: Stephen Berman Date: Thu, 01 Nov 2012 22:03:40 +0100 Message-ID: <87txt9828j.fsf@rosalinde.fritz.box> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --=-=-= Content-Type: text/plain If you play a game that keeps a list of top scores, such as Bubbles, and that list has reached the maximum number of entries (set in lib-src/update-game-score.c at 200 entries), and the game ends with a score too low to make the list, you get a message like this: Search failed: "601 steve Stephen Berman Thu Nov 1 18:10:50 2012" To reproduce: 0. emacs -Q 1. Create a score file with 200 entries, each with improbably high scores; e.g. for the default Bubbles game, create ~/.emacs.d/games/bubbles-default-2-10-10-scores with 200 lines like this: 10000 Thu Nov 1 20:58:35 2012 Stephen Berman (This assumes the score file is kept in user-emacs-directory, but AFAICS the problem should also occur with a non-nil shared-game-score-directory.) 2. M-x bubbles, play till the games is over (don't play well enough to get a top score!). => the error is signalled. The reason is that gamegrid-add-score-with-update-game-score-1 searches the score file for the last score, to put point on it, but doesn't set the NOERROR argument of search-forward (the update-game-score program, which updates the score file, chops off a score that is lower than the 200th top score, to keep the list to 200 entries, so the search fails). The minimal fix, in the first patch below, is simply to suppress the error message. A perhaps more user-friendly alternative, in the second patch below, is to also show a message like "Sorry, your score is too low to make the list of top scores." In GNU Emacs 24.2.50.2 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4) of 2012-10-31 on rosalinde Bzr revision: 110748 rudalics@gmx.at-20121031100251-29ks4uo7ift4gzyp Windowing system distributor `The X.Org Foundation', version 11.0.11203000 System Description: openSUSE 12.2 (x86_64) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: gamegrid patch 1 2012-11-01 Stephen Berman * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): Don't signal an error with a score that is too low to add to the list of top scores. (Bug#xxxxxx) === modified file 'lisp/play/gamegrid.el' *** lisp/play/gamegrid.el 2012-07-11 23:13:41 +0000 --- lisp/play/gamegrid.el 2012-11-01 18:53:59 +0000 *************** *** 560,566 **** (goto-char (point-min)) (search-forward (concat (int-to-string score) " " (user-login-name) " " ! marker-string)) (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) --- 560,566 ---- (goto-char (point-min)) (search-forward (concat (int-to-string score) " " (user-login-name) " " ! marker-string) nil t) (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: gamegrid patch 2 2012-11-01 Stephen Berman * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): Don't signal an error with a score that is too low to add to the list of top scores, but inform the user. (Bug#xxxxxx) === modified file 'lisp/play/gamegrid.el' *** lisp/play/gamegrid.el 2012-07-11 23:13:41 +0000 --- lisp/play/gamegrid.el 2012-11-01 20:03:28 +0000 *************** *** 558,567 **** (display-buffer buf)) (find-file-read-only target)) (goto-char (point-min)) ! (search-forward (concat (int-to-string score) ! " " (user-login-name) " " ! marker-string)) ! (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) (save-excursion --- 558,569 ---- (display-buffer buf)) (find-file-read-only target)) (goto-char (point-min)) ! (if (search-forward (concat (int-to-string score) ! " " (user-login-name) " " ! marker-string) nil t) ! (beginning-of-line) ! (message ! "Sorry, your score was too low to make the list of top scores.")))))) (defun gamegrid-add-score-insecure (file score &optional directory) (save-excursion --=-=-=-- From unknown Mon Jun 23 16:48:35 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stephen Berman Subject: bug#12779: closed (Re: bug#12779: 24.2.50; Gamegrid signals an error when score is too low) Message-ID: References: <87wqxk4sru.fsf@gnu.org> <87txt9828j.fsf@rosalinde.fritz.box> X-Gnu-PR-Message: they-closed 12779 X-Gnu-PR-Package: emacs Reply-To: 12779@debbugs.gnu.org Date: Sat, 17 Nov 2012 07:03:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1353135783-15581-1" This is a multi-part message in MIME format... ------------=_1353135783-15581-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #12779: 24.2.50; Gamegrid signals an error when score is too low which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 12779@debbugs.gnu.org. --=20 12779: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12779 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1353135783-15581-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 12779-done) by debbugs.gnu.org; 17 Nov 2012 07:02:42 +0000 Received: from localhost ([127.0.0.1]:50102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TZcQL-00042j-NK for submit@debbugs.gnu.org; Sat, 17 Nov 2012 02:02:42 -0500 Received: from mail-pb0-f44.google.com ([209.85.160.44]:49572) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TZcQJ-00042c-2z for 12779-done@debbugs.gnu.org; Sat, 17 Nov 2012 02:02:40 -0500 Received: by mail-pb0-f44.google.com with SMTP id uo1so2325596pbc.3 for <12779-done@debbugs.gnu.org>; Fri, 16 Nov 2012 23:01:46 -0800 (PST) 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=HmLowTUqqddAPh2fAN7J0GUyD8US/S/KunVh1uelB9s=; b=0LjyXT/992ODWuXEEZJX7w0K+yQqHE9yAD9U6pZ9ouce78crHWdRzIHsYebUrMBdU2 jDwlkW+SD4vJCy9xinJhrLbDwtbaP3OEZ8fPYslGuS8kc9Y2se0HviV/L11A8FaIB3R7 mGmj7fr0dnhL1kt/R0CE8NH/9TcaDuKsHhKaHvUwAIucihlC65zDekoE+Zeey2P5lOVT hYCQXUeaL+6nsuTCOLI+RmXMMwOqWLYJPZL0m8TY2b0fijKCc4sTit+aRNtE6oLV3FWR NeCjU8J9xo2v9wZafv7JFeup/XYWAfCvTckIJ1Hjv506uIzsgPi3BtFKpJuDBgbaI4bk h53A== Received: by 10.69.16.100 with SMTP id fv4mr10768354pbd.135.1353135706785; Fri, 16 Nov 2012 23:01:46 -0800 (PST) Received: from ulysses (cm198.gamma83.maxonline.com.sg. [202.156.83.198]) by mx.google.com with ESMTPS id nf9sm2497889pbc.17.2012.11.16.23.01.43 (version=SSLv3 cipher=OTHER); Fri, 16 Nov 2012 23:01:45 -0800 (PST) From: Chong Yidong To: Stephen Berman Subject: Re: bug#12779: 24.2.50; Gamegrid signals an error when score is too low References: <87txt9828j.fsf@rosalinde.fritz.box> Date: Sat, 17 Nov 2012 15:01:41 +0800 In-Reply-To: <87txt9828j.fsf@rosalinde.fritz.box> (Stephen Berman's message of "Thu, 01 Nov 2012 22:03:40 +0100") Message-ID: <87wqxk4sru.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12779-done Cc: 12779-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) Stephen Berman writes: > The reason is that gamegrid-add-score-with-update-game-score-1 searches > the score file for the last score, to put point on it, but doesn't set > the NOERROR argument of search-forward (the update-game-score program, > which updates the score file, chops off a score that is lower than the > 200th top score, to keep the list to 200 entries, so the search fails). > The minimal fix, in the first patch below, is simply to suppress the > error message. Committed to trunk, thanks. (I think the second patch is not necessary, since such messages are not customary). ------------=_1353135783-15581-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Nov 2012 21:06:35 +0000 Received: from localhost ([127.0.0.1]:43540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TU1yF-0005s3-95 for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:06:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47886) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TU1yC-0005rv-Ql for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:06:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1vX-0008SU-7j for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:03:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1vX-0008SO-4m for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:03:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1vV-0005QB-P0 for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1vU-0008R5-Fy for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:45 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:58850) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TU1vU-0008Qx-6L for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:44 -0400 Received: (qmail invoked by alias); 01 Nov 2012 21:03:41 -0000 Received: from i59F54801.versanet.de (EHLO rosalinde.fritz.box) [89.245.72.1] by mail.gmx.net (mp004) with SMTP; 01 Nov 2012 22:03:41 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+LLXpLMC2LKchBhMWAbsPamFR7bxXygVovsOZNzh 1XYDKGvMnIKAZd From: Stephen Berman To: bug-gnu-emacs@gnu.org Subject: 24.2.50; Gamegrid signals an error when score is too low Date: Thu, 01 Nov 2012 22:03:40 +0100 Message-ID: <87txt9828j.fsf@rosalinde.fritz.box> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --=-=-= Content-Type: text/plain If you play a game that keeps a list of top scores, such as Bubbles, and that list has reached the maximum number of entries (set in lib-src/update-game-score.c at 200 entries), and the game ends with a score too low to make the list, you get a message like this: Search failed: "601 steve Stephen Berman Thu Nov 1 18:10:50 2012" To reproduce: 0. emacs -Q 1. Create a score file with 200 entries, each with improbably high scores; e.g. for the default Bubbles game, create ~/.emacs.d/games/bubbles-default-2-10-10-scores with 200 lines like this: 10000 Thu Nov 1 20:58:35 2012 Stephen Berman (This assumes the score file is kept in user-emacs-directory, but AFAICS the problem should also occur with a non-nil shared-game-score-directory.) 2. M-x bubbles, play till the games is over (don't play well enough to get a top score!). => the error is signalled. The reason is that gamegrid-add-score-with-update-game-score-1 searches the score file for the last score, to put point on it, but doesn't set the NOERROR argument of search-forward (the update-game-score program, which updates the score file, chops off a score that is lower than the 200th top score, to keep the list to 200 entries, so the search fails). The minimal fix, in the first patch below, is simply to suppress the error message. A perhaps more user-friendly alternative, in the second patch below, is to also show a message like "Sorry, your score is too low to make the list of top scores." In GNU Emacs 24.2.50.2 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4) of 2012-10-31 on rosalinde Bzr revision: 110748 rudalics@gmx.at-20121031100251-29ks4uo7ift4gzyp Windowing system distributor `The X.Org Foundation', version 11.0.11203000 System Description: openSUSE 12.2 (x86_64) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: gamegrid patch 1 2012-11-01 Stephen Berman * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): Don't signal an error with a score that is too low to add to the list of top scores. (Bug#xxxxxx) === modified file 'lisp/play/gamegrid.el' *** lisp/play/gamegrid.el 2012-07-11 23:13:41 +0000 --- lisp/play/gamegrid.el 2012-11-01 18:53:59 +0000 *************** *** 560,566 **** (goto-char (point-min)) (search-forward (concat (int-to-string score) " " (user-login-name) " " ! marker-string)) (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) --- 560,566 ---- (goto-char (point-min)) (search-forward (concat (int-to-string score) " " (user-login-name) " " ! marker-string) nil t) (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: gamegrid patch 2 2012-11-01 Stephen Berman * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): Don't signal an error with a score that is too low to add to the list of top scores, but inform the user. (Bug#xxxxxx) === modified file 'lisp/play/gamegrid.el' *** lisp/play/gamegrid.el 2012-07-11 23:13:41 +0000 --- lisp/play/gamegrid.el 2012-11-01 20:03:28 +0000 *************** *** 558,567 **** (display-buffer buf)) (find-file-read-only target)) (goto-char (point-min)) ! (search-forward (concat (int-to-string score) ! " " (user-login-name) " " ! marker-string)) ! (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) (save-excursion --- 558,569 ---- (display-buffer buf)) (find-file-read-only target)) (goto-char (point-min)) ! (if (search-forward (concat (int-to-string score) ! " " (user-login-name) " " ! marker-string) nil t) ! (beginning-of-line) ! (message ! "Sorry, your score was too low to make the list of top scores.")))))) (defun gamegrid-add-score-insecure (file score &optional directory) (save-excursion --=-=-=-- ------------=_1353135783-15581-1--