[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#35056: closed (26.1; Tetris score is no longer upd

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#35056: closed (26.1; Tetris score is no longer updated)
Date: Mon, 01 Apr 2019 03:05:03 +0000

Your message dated Sun, 31 Mar 2019 20:03:55 -0700
with message-id <address@hidden>
and subject line Re: bug#35056: 26.1; Tetris score is no longer updated due to 
commit 995be66f0f0d26d1a96cbb8dfb429c3941157771
has caused the debbugs.gnu.org bug report #35056,
regarding 26.1; Tetris score is no longer updated
to be marked as done.

(If you believe you have received this mail in error, please contact

35056: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35056
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 26.1; Tetris score is no longer updated Date: Sat, 30 Mar 2019 23:22:11 +0100
Ubuntu 16.04 comes with Emacs 24, and I have played several Tetris games
using it, the high scores of which are recorded in my home directory.
Today, I built Emacs 26.1 and played a Tetris game using it.  The
resulting score, however, was not recorded although it should have been.

I traced the problem to the following commit that changes the expected
format of the high-score file in my home directory:
-- 8< ------------------------------------------------------------------
commit 995be66f0f0d26d1a96cbb8dfb429c3941157771
Author: Paul Eggert <address@hidden>
Date:   Sun Mar 12 12:04:10 2017 -0700

    Install update-game-score only on request

    Most distributions do not install update-game-score properly
    due to setuid/setgid complications, so install it only when
    the installer specifies a user or group (Bug#25895).
    * .gitattributes: Remove lib-src/update-game-score.exe.manifest.
    * Makefile.in (gameuser, gamegroup, use_gamedir, PATH_GAME):
    New vars.
    (epaths-force): Use PATH_GAME.
    (uninstall): Remove snake-scores and tetris-scores only if shared.
    * configure.ac: Default --with-gameuser to 'no'.
    (UPDATE_MANIFEST): Remove.
    * etc/NEWS: Mention this.
    * lib-src/Makefile.in (UPDATE_MANIFEST): Remove.
    (use_gamedir): New macro.
    (UTILITIES): Remove update-game-score unless use_gamedir.
    ($(DESTDIR)${archlibdir}): Install game directory program and data
    only if use_gamedir.
    * lib-src/update-game-score.exe.manifest: Remove, as
    update-game-score is no longer installed on MS-Windows.
    * lisp/play/gamegrid.el (gamegrid-add-score-with-update-game-score):
    Use auxiliary program only if setuid or setgid.
    * make-dist: Do not distribute update-game-score.exe.manifest.
    * src/callproc.c (init_callproc):
    Set Vshared_game_score_directory based on PATH_GAME, not DOS_NT.
    (syms_of_callproc): Remove unnecessary initialization of
-- 8< ------------------------------------------------------------------

The offending diff in the commit is shown below:
-- 8< ------------------------------------------------------------------
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index b0ccbd3..0386a89 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -497,23 +499,12 @@ FILE is created there."
         (expand-file-name file shared-game-score-directory) score))
       ;; Else: Add the score to a score file in the user's home
       ;; directory.
-      (gamegrid-shared-game-dir
-       ;; If `gamegrid-shared-game-dir' is non-nil, then
-       ;; "update-gamescore" program is setuid, so don't use it.
-       (unless (file-exists-p
-            (directory-file-name gamegrid-user-score-file-directory))
-         (make-directory gamegrid-user-score-file-directory t))
-       (gamegrid-add-score-insecure file score
-                    gamegrid-user-score-file-directory))
        (unless (file-exists-p
             (directory-file-name gamegrid-user-score-file-directory))
          (make-directory gamegrid-user-score-file-directory t))
-       (let ((f (expand-file-name file
-                      gamegrid-user-score-file-directory)))
-         (unless (file-exists-p f)
-           (write-region "" nil f nil 'silent nil 'excl))
-         (gamegrid-add-score-with-update-game-score-1 file f score))))))
+       (gamegrid-add-score-insecure file score
+                    gamegrid-user-score-file-directory)))))

 (defun gamegrid-add-score-with-update-game-score-1 (file target score)
   (let ((default-directory "/")
-- 8< ------------------------------------------------------------------

>From the diff, it is clear that previously the high-score file was
updated using `gamegrid-add-score-with-update-game-score-1', which
writes a high-score line in the following format:
(concat (int-to-string score)
        " " (user-login-name) " "
        (concat (user-full-name)
                " <"
                (cond ((fboundp 'user-mail-address)
                      ((boundp 'user-mail-address)
                      (t ""))
                ">  "

After the commit, the high-score file is updated using
`gamegrid-add-score-insecure', which writes a high-score line in the
following format:
(format "%05d\t%s\t%s <%s>\n"
        (cond ((fboundp 'user-mail-address)
              ((boundp 'user-mail-address)
              (t "")))

In my high-score file for Tetris, the lowest score (obfuscated for
privacy) is as follows:
1817 XXX XXX XXX <address@hidden>  XXX XXX XX XX:XX:XX XXXX

So, when today I played Tetris using Emacs 26.1 and scored higher than
1817 (e.g., 2555), `gamegrid-add-score-insecure' first writes the
following line:
1817 XXX XXX XXX <address@hidden>  XXX XXX XX XX:XX:XX XXXX
02555    XXX XXX XX XX:XX:XX XXXX    XXX XXX <address@hidden>

Then, it sorts the lines using `sort-fields' on field 1.  Since
`sort-fiels' performs a lexicographical sort, the higher score 02555
ends up being the lowest score due to the leading 0.  As a result, the
new score is not recorded, leading to this reported bug.

Since this is a user-visible change, the NEWS file that accompanies
Emacs 26.1 (http://www.gnu.org/software/emacs/news/NEWS.26.1) ought to
mention this problem.  Unfortunately, the offending commit does not do
so as shown below:
-- 8< ------------------------------------------------------------------
diff --git a/etc/NEWS b/etc/NEWS
index f0df0a7..cd829bf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -65,6 +65,11 @@ emacs-version and erc-cmd-SV functions, and the
leave the following
 variables nil: emacs-build-system, emacs-build-time,

+** The configure option '--with-gameuser' now defaults to 'no',
+as this appears to be the most common configuration in practice.
+When it is 'no', the shared game directory and the auxiliary program
+update-game-score are no longer needed and are not installed.
 ** Emacs no longer works on IRIX.  We expect that Emacs users are not
 affected by this, as SGI stopped supporting IRIX in December 2013.
-- 8< ------------------------------------------------------------------

Since this seems to break for many users, in addition to fixing the NEWS
file, I suggest that `gamegrid-add-score-insecure' be fixed to work with
the high-score line format of
`gamegrid-add-score-with-update-game-score-1'.  Otherwise, an error
message should be raised to let users quickly fix their high-score files

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2019-03-30 built on 0x657573
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description:    Ubuntu 16.04.6 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --prefix=/mnt/core/Codebases/installzone/emacs
 --with-xwidgets --disable-silent-rules'

Configured features:

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting xwidget-internal
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 94622 8544)
 (symbols 48 20366 2)
 (miscs 40 38 118)
 (strings 32 28354 1003)
 (string-bytes 1 751654)
 (vectors 16 13968)
 (vector-slots 8 492158 10422)
 (floats 8 49 68)
 (intervals 56 220 0)
 (buffers 992 11)
 (heap 1024 34351 1010))

Best regards,

--- End Message ---
--- Begin Message --- Subject: Re: bug#35056: 26.1; Tetris score is no longer updated due to commit 995be66f0f0d26d1a96cbb8dfb429c3941157771 Date: Sun, 31 Mar 2019 20:03:55 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1
Richard Stallman wrote:
We could change play/gamegrid.el to use the update-game-score format
and convert the old format when encountered.

Yes, that would be an improvement over what the patch does. In the meantime I installed the patch since it fixes the problem at hand, and I am marking the bug as done.

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]