GNU bug report logs -
#35056
26.1; Tetris score is no longer updated
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35056 in the body.
You can then email your comments to 35056 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35056
; Package
emacs
.
(Sat, 30 Mar 2019 22:23:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tadeus Prastowo <tadeus.prastowo <at> unitn.it>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 30 Mar 2019 22:23:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <eggert <at> cs.ucla.edu>
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.
(SCRIPTS): Remove $(UPDATE_MANIFEST).
($(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
Vshared_game_score_directory.
-- 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))
(t
(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)
(user-mail-address))
((boundp 'user-mail-address)
user-mail-address)
(t ""))
"> "
(current-time-string)))
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"
score
(current-time-string)
(user-full-name)
(cond ((fboundp 'user-mail-address)
(user-mail-address))
((boundp 'user-mail-address)
user-mail-address)
(t "")))
In my high-score file for Tetris, the lowest score (obfuscated for
privacy) is as follows:
1817 XXX XXX XXX <XXX <at> XXX.XXX> 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 <XXX <at> XXX.XXX> XXX XXX XX XX:XX:XX XXXX
02555 XXX XXX XX XX:XX:XX XXXX XXX XXX <XXX <at> XXX.XXX>
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,
erc-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
themselves.
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:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS XWIDGETS LIBSYSTEMD LCMS2
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.
Features:
(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,
Tadeus
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35056
; Package
emacs
.
(Sun, 31 Mar 2019 03:34:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 35056 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Apparently the problem is that there are two formats of Tetris game-score files.
One format is used by play/gamegrid.el itself, the other is used by the
update-game-score command. I didn't know that; I thought that the only reason to
use update-game-score was to get setuid/setgid permissions, and that the file
format didn't change.
To some extent the file-format problem is Just One Of Those Things: if up
upgrade Emacs and it changes the file format, Emacs is not smart enough to deal
with the format change and so it loses your old Tetris scores.
That being said, Emacs could try harder to use the update-game-score program if
it's installed. Is it in your installation? If so, please try the attached
patch. If not, please try redoing 'configure' so that update-game-score is built
and installed, and then try the attached patch.
I suppose it would be possible to do more-serious hacking in gamegrid.el to deal
with the incompatible file formats (convert formats back and forth, say), but
that would be beyond my call of duty.
[0001-Use-update-game-score-more-often-with-Tetris.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35056
; Package
emacs
.
(Sun, 31 Mar 2019 19:42:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 35056 <at> debbugs.gnu.org (full text, mbox):
On Sun, Mar 31, 2019 at 5:32 AM Paul Eggert <eggert <at> cs.ucla.edu> wrote:
>
> Apparently the problem is that there are two formats of Tetris game-score files.
> One format is used by play/gamegrid.el itself, the other is used by the
> update-game-score command. I didn't know that; I thought that the only reason to
> use update-game-score was to get setuid/setgid permissions, and that the file
> format didn't change.
Perhaps you need to make a test unit to ensure there is no regression
in the future.
> To some extent the file-format problem is Just One Of Those Things: if up
> upgrade Emacs and it changes the file format, Emacs is not smart enough to deal
> with the format change and so it loses your old Tetris scores.
>
> That being said, Emacs could try harder to use the update-game-score program if
> it's installed. Is it in your installation? If so, please try the attached
> patch. If not, please try redoing 'configure' so that update-game-score is built
> and installed, and then try the attached patch.
I apply your patch to Emacs 26.1 source
(http://ftp.gnu.org/gnu/emacs/emacs-26.1.tar.xz), and run the
following configure command:
configure --prefix=/mnt/core/Codebases/installzone/emacs
--with-xwidgets --disable-silent-rules --with-gameuser=yes
And, then the following make command:
make
make install
I played Tetris, scoring higher than the lowest recorded in my high
score file, and I confirm that your patch allows the score to be
recorded after year 2018 went by without any new record due to the bug
introduced by commit 995be66f0f0d26d1a96cbb8dfb429c3941157771.
> I suppose it would be possible to do more-serious hacking in gamegrid.el to deal
> with the incompatible file formats (convert formats back and forth, say), but
> that would be beyond my call of duty.
I like your patch: if it ain't broken, don't fix it, dude ;)
--
Best regards,
Tadeus
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35056
; Package
emacs
.
(Sun, 31 Mar 2019 22:55:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 35056 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> One format is used by play/gamegrid.el itself, the other is used by the
> update-game-score command. I didn't know that; I thought that the only reason to
> use update-game-score was to get setuid/setgid permissions, and that the file
> format didn't change.
We could change play/gamegrid.el to use the update-game-score format
and convert the old format when encountered.
--
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Mon, 01 Apr 2019 03:05:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tadeus Prastowo <tadeus.prastowo <at> unitn.it>
:
bug acknowledged by developer.
(Mon, 01 Apr 2019 03:05:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 35056-done <at> debbugs.gnu.org (full text, mbox):
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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 29 Apr 2019 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.