Package: nethack-console Version: 3.6.0-3 Severity: normal Tags: patch Dear Maintainer,
1. This bug is only found on armhf port; it is not found on amd64 port. It can be reproduced on a chroot Debian system on a ARMv7 smart phone and on a full Debian system in a QEMU virtual machine. 2. Method of reproduce and behavior of this bug 1) Start a wizard mode game: $ sudo /usr/games/nethack-console -D 2) Optional: Press ^W, then press Enter to wizard mode wish some random items; these created items are not fully identified. 3) Press ^I, then the Debug Identify menu, which shows the character's inventory with all items temporarily identified, will appear. 4) Press ^I again, then the Debug Identify menu disapeared, and a) the expected outcome: the game show "You have already identified all of your possessions." , if all items are already identified; or the game show full identify information of items and those items will be permanently identified, if there are some unidentified items in the inventory. b) the buggy outcome: nothing happen and unidentified items are still unidentified. 3. Possible cause In the function display_pickinv(), a special menu item is added to the Debug Identify menu; the identifier of this item is set to -1(src/invent.c:2083): any.a_char = -1; The type of any.a_char is char(include/wintype.h:16): char a_char; When ^I is pressed in the Debug Identify menu, the identifier will be returned by display_pickinv(). And wiz_identify() will check whether the return value of display_pickinv() equals -1(src/cmd.c:595): if (display_inventory((char *) 0, TRUE) == -1) then determine to fully identify all items or do nothing. However the type char is unsigned by default on arm port. "any.a_char = -1;" will set any.a_char to 255 actually on arm port(this can be verified by using gdb), so that above if statement will never success, and the permanent wizard identify will never be performed. Since all involved codes are all in files under src/ and include/ dirs, it seems that this bug affects not only nethack-console, but also nethack-x11 and nethack-lisp. As I did not test those two favors, this may not be true. 4. Demonstration patch After apply the attached patch, the bug disappeared. Please consider examine and apply it. Regards, Jun MO -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: armhf (armv7l) Kernel: Linux 3.16.0-4-armmp (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages nethack-console depends on: ii libc6 2.22-12 ii libncurses5 6.0+20160319-2+b1 ii libtinfo5 6.0+20160319-2+b1 ii nethack-common 3.6.0-3 nethack-console recommends no packages. nethack-console suggests no packages. -- no debconf information
Description: fix permanently identify bug The return value of display_inventory() is from a type char value; since the type char is unsigned on port arm by default, the if statement will never success and identify will not be commited. --- a/src/cmd.c +++ b/src/cmd.c @@ -592,7 +592,7 @@ { if (wizard) { iflags.override_ID = (int) cmd_from_func(wiz_identify); - if (display_inventory((char *) 0, TRUE) == -1) + if (display_inventory((char *) 0, TRUE) == (char) -1) identify_pack(0, FALSE); iflags.override_ID = 0; } else