From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#35056: 26.1; Tetris score is no longer updated due to commit 995be66f0f0d26d1a96cbb8dfb429c3941157771 Date: Sat, 30 Mar 2019 20:32:51 -0700 Organization: UCLA Computer Science Department Message-ID: <78ea6992-85b1-e005-2c33-7b1df1c04031@cs.ucla.edu> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------990CB3CE98F18489FC3A33CE" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="34973"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: 35056@debbugs.gnu.org To: Tadeus Prastowo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 31 05:34:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAREa-0008zK-FV for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Mar 2019 05:34:12 +0200 Original-Received: from localhost ([127.0.0.1]:58034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAREZ-0002E4-Fd for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Mar 2019 23:34:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hARES-0002Bx-Dw for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 23:34:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hARER-0007Ct-2Y for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 23:34:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAREQ-0007Cl-Th for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 23:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAREQ-0004Fu-Dw for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 23:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2019 03:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35056 X-GNU-PR-Package: emacs Original-Received: via spool by 35056-submit@debbugs.gnu.org id=B35056.155400318316286 (code B ref 35056); Sun, 31 Mar 2019 03:34:02 +0000 Original-Received: (at 35056) by debbugs.gnu.org; 31 Mar 2019 03:33:03 +0000 Original-Received: from localhost ([127.0.0.1]:37713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hARDS-0004Eb-OR for submit@debbugs.gnu.org; Sat, 30 Mar 2019 23:33:03 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:35096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hARDP-0004E6-Dz for 35056@debbugs.gnu.org; Sat, 30 Mar 2019 23:33:00 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AD9F21612CF; Sat, 30 Mar 2019 20:32:53 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 9R9vEwQGdjbT; Sat, 30 Mar 2019 20:32:52 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6BF461612D2; Sat, 30 Mar 2019 20:32:52 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id M08P27zMaHCI; Sat, 30 Mar 2019 20:32:52 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 34267160F1C; Sat, 30 Mar 2019 20:32:52 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156965 Archived-At: This is a multi-part message in MIME format. --------------990CB3CE98F18489FC3A33CE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------990CB3CE98F18489FC3A33CE Content-Type: text/x-patch; name="0001-Use-update-game-score-more-often-with-Tetris.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Use-update-game-score-more-often-with-Tetris.patch" >From 9f14fc6f61c8c6609a24efa1024ef8a68d16a92f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 30 Mar 2019 20:26:15 -0700 Subject: [PATCH] Use update-game-score more often with Tetris * lisp/play/gamegrid.el (gamegrid-add-score-with-update-game-score): Go back to previous way of deciding whether to invoke update-game-score, except do not try to invoke it if file-modes fails on it (Bug#35056). --- lisp/play/gamegrid.el | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index 430a2071bf..4a9dac7f74 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el @@ -565,8 +565,8 @@ gamegrid-add-score ;; On POSIX systems there are four cases to distinguish: -;; 1. FILE is an absolute filename. Then it should be a file in -;; temporary file directory. This is the way, +;; 1. FILE is an absolute filename or "update-game-score" does not exist. +;; Then FILE should be a file in a temporary file directory. This is how ;; `gamegrid-add-score' was supposed to be used in the past and ;; is covered here for backward-compatibility. ;; @@ -583,21 +583,18 @@ gamegrid-add-score ;; update FILE. This is for the case that a user has installed ;; a game on her own. ;; -;; 4. "update-game-score" does not exist or is not setgid/setuid. -;; Create/update FILE in the user's home directory, without -;; using "update-game-score". There is presumably no shared -;; game directory. +;; 4. "update-game-score" is not setgid/setuid. Use it to +;; create/update FILE in the user's home directory. There is +;; presumably no shared game directory. (defvar gamegrid-shared-game-dir) (defun gamegrid-add-score-with-update-game-score (file score) - (let ((gamegrid-shared-game-dir - (not (zerop (logand (or (file-modes - (expand-file-name "update-game-score" - exec-directory)) - 0) - #o6000))))) - (cond ((file-name-absolute-p file) + (let* ((update-game-score-modes + (file-modes (expand-file-name "update-game-score" exec-directory))) + (gamegrid-shared-game-dir + (not (zerop (logand #o6000 (or update-game-score-modes 0)))))) + (cond ((or (not update-game-score-modes) (file-name-absolute-p file)) (gamegrid-add-score-insecure file score)) ((and gamegrid-shared-game-dir (file-exists-p (expand-file-name file shared-game-score-directory))) @@ -607,12 +604,23 @@ gamegrid-add-score-with-update-game-score (expand-file-name file shared-game-score-directory) score)) ;; Else: Add the score to a score file in the user's home ;; directory. - (t + (gamegrid-shared-game-dir + ;; If gamegrid-shared-game-dir is non-nil the + ;; "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))))) + 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)))))) (defun gamegrid-add-score-with-update-game-score-1 (file target score) (let ((default-directory "/") -- 2.17.1 --------------990CB3CE98F18489FC3A33CE--