From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#4397: marked as done (23.0.60; update-game-score doesn't update when MAX_SCORES entries are present) Date: Fri, 11 Sep 2009 19:20:04 +0000 Message-ID: References: <20090910235338.GA29473@ozbert.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1252696804-9827-0" X-Trace: ger.gmane.org 1252697279 22375 80.91.229.12 (11 Sep 2009 19:27:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Sep 2009 19:27:59 +0000 (UTC) To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 11 21:27:52 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MmBmh-0001W3-F7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Sep 2009 21:27:51 +0200 Original-Received: from localhost ([127.0.0.1]:38887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmBmg-0000xp-Ih for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Sep 2009 15:27:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MmBm3-0000eP-1L for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 15:27:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MmBlw-0000cK-J3 for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 15:27:10 -0400 Original-Received: from [199.232.76.173] (port=39664 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmBlw-0000bn-1Q for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 15:27:04 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:48774) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MmBlv-0006lK-CE for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2009 15:27:03 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8BJQxtW010962; Fri, 11 Sep 2009 12:27:00 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8BJK42d009833; Fri, 11 Sep 2009 12:20:04 -0700 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: closed 4397 X-Emacs-PR-Package: emacs X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30969 Archived-At: This is a multi-part message in MIME format... ------------=_1252696804-9827-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Fri, 11 Sep 2009 15:11:20 -0400 with message-id and subject line Re: bug#4397: 23.0.60; update-game-score doesn't update wh= en MAX_SCORES entries are present has caused the Emacs bug report #4397, regarding 23.0.60; update-game-score doesn't update when MAX_SCORES entries= are present to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com immediately.) --=20 4397: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D4397 Emacs Bug Tracking System Contact owner@emacsbugs.donarmstrong.com with problems ------------=_1252696804-9827-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 11 Sep 2009 00:21:04 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=none autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8B0L26i001550 for ; Thu, 10 Sep 2009 17:21:04 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mltsr-0000FJ-Mg for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:21:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mltso-0000F7-VN for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:21:01 -0400 Received: from [199.232.76.173] (port=46916 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mltso-0000F4-Sx for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:20:58 -0400 Received: from 173-13-141-233-sfba.hfc.comcastbusiness.net ([173.13.141.233]:52468 helo=athena.ozbert.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mltso-00012Q-Hy for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 20:20:58 -0400 Received: from jfeng by athena.ozbert.com with local (Exim 4.63) (envelope-from ) id 1MltSM-0007fc-IF for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2009 16:53:38 -0700 Date: Thu, 10 Sep 2009 16:53:38 -0700 To: bug-gnu-emacs@gnu.org Subject: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present Message-ID: <20090910235338.GA29473@ozbert.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) From: Jason Feng X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-Greylist: delayed 1668 seconds by postgrey-1.27 at monty-python; Thu, 10 Sep 2009 20:20:52 EDT When attempting to run "update-game-score," when there are 200 entries in the score file, the new score is never included. Apparently, the INTENDED behavior is that the new score is included if it is larger than the minimum entry, pushing out the minimum entry, but this doesn't happen. I have isolated the cause to the following lines in update-game-score.c (pulled from the latest git tree): (starts at line 255) push_score (&scores, &scorecount, newscore, user_id, newdata); /* Limit the number of scores. If we're using reverse sorting, then we should increment the beginning of the array, to skip over the *smallest* scores. Otherwise, we just decrement the number of scores, since the smallest will be at the end. */ if (scorecount > MAX_SCORES) scorecount -= (scorecount - MAX_SCORES); if (reverse) scores += (scorecount - MAX_SCORES); sort_scores (scores, scorecount, reverse); As push_score adds the new score at the end of the score list, when the scorecount gets decremented, there is no chance for the new score to ever get included (when reverse is zero, that is). Really the decrement of scorecount should happen after the scores have been sorted. Regards, Jason Feng ------------=_1252696804-9827-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 4397-done) by emacsbugs.donarmstrong.com; 11 Sep 2009 19:11:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.0 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from tomts10-srv.bellnexxia.net (tomts10-srv.bellnexxia.net [209.226.175.54]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8BJBLVk008547 for <4397-done@emacsbugs.donarmstrong.com>; Fri, 11 Sep 2009 12:11:22 -0700 Received: from toip6.srvr.bell.ca ([209.226.175.125]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20090911191120.YRMZ12711.tomts10-srv.bellnexxia.net@toip6.srvr.bell.ca> for <4397-done@emacsbugs.donarmstrong.com>; Fri, 11 Sep 2009 15:11:20 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgwFAD84qkpGN458/2dsb2JhbACBU9wWhBgF Received: from bas1-montreal42-1178046076.dsl.bell.ca (HELO ceviche.home) ([70.55.142.124]) by toip6.srvr.bell.ca with ESMTP; 11 Sep 2009 15:03:49 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 3A8CEB40D4; Fri, 11 Sep 2009 15:11:20 -0400 (EDT) From: Stefan Monnier To: Jason Feng Subject: Re: bug#4397: 23.0.60; update-game-score doesn't update when MAX_SCORES entries are present Message-ID: References: <20090910235338.GA29473@ozbert.com> Date: Fri, 11 Sep 2009 15:11:20 -0400 In-Reply-To: <20090910235338.GA29473@ozbert.com> (Jason Feng's message of "Thu, 10 Sep 2009 16:53:38 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > ever get included (when reverse is zero, that is). Really the decrement > of scorecount should happen after the scores have been sorted. Indeed, thank you. I've just installed the patch below, Stefan Index: lib-src/ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lib-src/ChangeLog,v retrieving revision 2.541 diff -u -r2.541 ChangeLog --- lib-src/ChangeLog 9 Sep 2009 02:32:25 -0000 2.541 +++ lib-src/ChangeLog 11 Sep 2009 19:10:04 -0000 @@ -1,3 +1,8 @@ +2009-09-11 Stefan Monnier + + * update-game-score.c (main): Sort scores before trimming them, + reported by Jason Feng (bug#4397). + 2009-09-09 Glenn Morris * Makefile.in ($(DESTDIR)${archlibdir}): Set umask to world-readable Index: lib-src/update-game-score.c =================================================================== RCS file: /sources/emacs/emacs/lib-src/update-game-score.c,v retrieving revision 1.27 diff -u -r1.27 update-game-score.c --- lib-src/update-game-score.c 8 Jan 2009 03:38:53 -0000 1.27 +++ lib-src/update-game-score.c 11 Sep 2009 19:10:04 -0000 @@ -254,6 +254,7 @@ lose_syserr ("Failed to read scores file"); } push_score (&scores, &scorecount, newscore, user_id, newdata); + sort_scores (scores, scorecount, reverse); /* Limit the number of scores. If we're using reverse sorting, then we should increment the beginning of the array, to skip over the *smallest* scores. Otherwise, we just decrement the number of @@ -262,7 +263,6 @@ scorecount -= (scorecount - MAX_SCORES); if (reverse) scores += (scorecount - MAX_SCORES); - sort_scores (scores, scorecount, reverse); if (write_scores (scorefile, scores, scorecount) < 0) { unlock_file (scorefile, lockstate); ------------=_1252696804-9827-0--