* bug#21946: 25.1.50; Saving games fails in dunnet
@ 2015-11-17 21:14 Peder O. Klingenberg
2015-11-18 12:30 ` Nicolas Richard
0 siblings, 1 reply; 2+ messages in thread
From: Peder O. Klingenberg @ 2015-11-17 21:14 UTC (permalink / raw)
To: 21946
[-- Attachment #1: Type: text/plain, Size: 825 bytes --]
While plaing dunnet, saving games via the "save"-command fails with the
message "Error saving to file". To reproduce:
$ ~/src/emacs/src/emacs -batch -l dunnet
Dead end
You are at a dead end of a dirt road. The road goes to the east.
In the distance you can see that it will eventually fork off. The
trees here are very tall royal palms, and they are spaced equidistant
from each other.
There is a shovel here.
>save /tmp/foo.txt
Error saving to file.
>
The reason is that dunnet uses its own implementation of ROT13 to
obfuscate the savefile, and this implementation breaks when it
encounters characters outside the 0-255 range. On 2015-08-24, Paul
Eggert introduced some curly quotes in data normally saved to this
file.
Attached is a patch that makes dun-rot13 use rot13-region instead of its
own implementation.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-savegames-in-dunnet.patch --]
[-- Type: text/x-patch, Size: 1533 bytes --]
From 94208031216879eeb8c04e11118b666a10af6860 Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Tue, 17 Nov 2015 21:47:27 +0100
Subject: [PATCH] Fix savegames in dunnet
* lisp/play/dunnet.el (dun-rot13): Use the standard rot13-region instead
of separate implementation.
---
lisp/play/dunnet.el | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index ba137f5..8aba50b 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -1321,29 +1321,8 @@ dun-remove-obj-from-inven
(setq new-inven (append new-inven (list x)))))
(setq dun-inventory new-inven)))
-
-(let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
- (setq dun-translate-table (make-vector 256 0))
- (while (< i 256)
- (aset dun-translate-table i i)
- (setq i (1+ i)))
- (setq lower (concat lower lower))
- (setq upper (upcase lower))
- (setq i 0)
- (while (< i 26)
- (aset dun-translate-table (+ ?a i) (aref lower (+ i 13)))
- (aset dun-translate-table (+ ?A i) (aref upper (+ i 13)))
- (setq i (1+ i))))
-
(defun dun-rot13 ()
- (let (str len (i 0))
- (setq str (buffer-substring (point-min) (point-max)))
- (setq len (length str))
- (while (< i len)
- (aset str i (aref dun-translate-table (aref str i)))
- (setq i (1+ i)))
- (erase-buffer)
- (insert str)))
+ (rot13-region (point-min) (point-max)))
;;;;
;;;; This section defines the globals that are used in dunnet.
--
2.4.0
[-- Attachment #3: Type: text/plain, Size: 6490 bytes --]
In GNU Emacs 25.1.50.1 (x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F1021))
of 2015-11-17
Repository revision: 58e6235007e6761fb9734b942ecff94bf4e9ba68
Windowing system distributor 'Apple', version 10.3.1348
Configured features:
RSVG DBUS ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
Important settings:
locale-coding-system: utf-8-unix
Major mode: Emacs-Lisp
Minor modes in effect:
global-git-commit-mode: t
async-bytecomp-package-mode: t
shell-dirtrack-mode: t
diff-auto-refine-mode: t
linum-mode: t
show-paren-mode: t
paredit-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
Type C-c C-c to finish, or C-c C-k to cancel
Auto-saving...done
Auto-saving...done
Mark set
Saving file /Users/pok/src/emacs/.git/COMMIT_EDITMSG...
Wrote /Users/pok/src/emacs/.git/COMMIT_EDITMSG
Git finished [2 times]
Reverting (up to) 3 file-visiting buffer(s)...
(No buffers need to be reverted)
Type C-h i to view popup manual, ? to describe an argument or action. [2 times]
Load-path shadows:
./zone hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/zone
./tetris hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/tetris
./studly hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/studly
./spook hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/spook
./solitaire hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/solitaire
./snake hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/snake
./pong hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/pong
./mpuz hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/mpuz
./morse hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/morse
./life hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/life
./hanoi hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/hanoi
./handwrite hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/handwrite
./gomoku hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/gomoku
./gametree hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/gametree
./gamegrid hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/gamegrid
./fortune hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/fortune
./dunnet hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/dunnet
./doctor hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/doctor
./dissociate hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/dissociate
./decipher hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/decipher
./cookie1 hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/cookie1
./bubbles hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/bubbles
./blackbox hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/blackbox
./animate hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/animate
./5x5 hides /Users/pok/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/play/5x5
Features:
(shadow sort mail-extr emacsbug mm-archive network-stream nsm starttls
url-cache debbugs-gnu wid-edit debbugs soap-client url-http tls url-auth
url-gw url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse url-vars mailcap rng-xsd rng-dt
rng-util xsd-regexp xml magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit magit-apply magit-wip
magit-log magit-diff smerge-mode magit-core magit-process magit-popup
magit-mode magit-git crm magit-section magit-utils git-commit log-edit
message sendmail dired rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log with-editor async-bytecomp async
tramp-sh dash warnings derived rot13 disp-table apropos vc-annotate
cus-start cus-load eieio-opt speedbar sb-image ezimage dframe edebug
debug pulse dunnet tramp-cache tramp tramp-compat auth-source gnus-util
mm-util help-fns mail-prsvr password-cache tramp-loaddefs trampver shell
advice dabbrev xref cl-seq project eieio eieio-core character-fold
misearch multi-isearch vc vc-dispatcher vc-git diff-mode map jka-compr
thingatpt linum paren paredit pok-init org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
easy-mmode org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs gedcom
slime-autoloads reftex reftex-vars edmacro kmacro ido seq byte-opt
cl-macs server dmacro cl gv compile comint ansi-color ring bytecomp
byte-compile cl-extra help-mode cl-loaddefs pcase cl-lib cconv
finder-inf tex-site info package easymenu epg-config time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel ns-win term/common-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core 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 charscript case-table epa-hook
jka-cmpr-hook help simple abbrev 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 cocoa ns multi-tty
make-network-process emacs)
Memory information:
((conses 16 374279 78364)
(symbols 48 39069 2)
(miscs 40 1910 2700)
(strings 32 85339 32771)
(string-bytes 1 2585328)
(vectors 16 38829)
(vector-slots 8 1204135 24354)
(floats 8 519 409)
(intervals 56 15896 519)
(buffers 976 34))
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#21946: 25.1.50; Saving games fails in dunnet
2015-11-17 21:14 bug#21946: 25.1.50; Saving games fails in dunnet Peder O. Klingenberg
@ 2015-11-18 12:30 ` Nicolas Richard
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Richard @ 2015-11-18 12:30 UTC (permalink / raw)
To: Peder O. Klingenberg; +Cc: 21946-done
peder@klingenberg.no (Peder O. Klingenberg) writes:
> Attached is a patch that makes dun-rot13 use rot13-region instead of its
> own implementation.
Thanks for the analysis and the patch, I applied it to emacs-25.
Nicolas.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-18 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 21:14 bug#21946: 25.1.50; Saving games fails in dunnet Peder O. Klingenberg
2015-11-18 12:30 ` Nicolas Richard
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.