Subject: bug#13500: 24.2.92; tetris score grows after ending the game

From: Glenn Morris <[email-masked]>
Date: Sat, 19 Jan 2013 15:11:28 -0500

Sven Joachim wrote:

> Start tetris with M-x tetris and keep pressing SPC until the playing
> area is filled.  Now Emacs writes the score to
> ~/.emacs.d/games/tetris-scores, but not only once but several times per
> second, increasing the score each time as if the game is still going on
> (press C-g to stop that).

I can't reproduce this, though I did find an (old) bug in
gamegrid-add-score-with-update-game-score.

The fact that your scores get written to ~/.emacs.d/games means that
/usr/local/libexec/emacs/24.2.92/arch/update-game-score

is not setuid. If I set it non-setuid, and do

rm- rf ~/.emacs.d/games/

then Emacs fails to write score files due to a
gamegrid-add-score-with-update-game-score bug. If I fix that bug (see
below), or mkdir ~/.emacs.d/games first, then it works fine.

What happens if you rm ~/.emacs.d/games/tetris-scores?

*** lisp/play/gamegrid.el	2013-01-01 09:11:05 +0000
--- lisp/play/gamegrid.el	2013-01-19 20:02:52 +0000
***************
*** 507,513 ****
  					gamegrid-user-score-file-directory))
  	  (t (let ((f (expand-file-name
  		       gamegrid-user-score-file-directory)))
! 	       (when (file-writable-p f)
  		 (unless (eq (car-safe (file-attributes f))
  			     t)
  		   (make-directory f))
--- 507,513 ----
  					gamegrid-user-score-file-directory))
  	  (t (let ((f (expand-file-name
  		       gamegrid-user-score-file-directory)))
! 	       (when (file-writable-p (directory-file-name f))
  		 (unless (eq (car-safe (file-attributes f))
  			     t)
  		   (make-directory f))