Bug#828625: nethack-console: wizard mode permanently identify does not works on armhf port

Mo Jun royclark086 at gmail.com
Sun Jun 26 12:02:41 UTC 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0026-fix-permanently-identify.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20160626/601f8591/attachment.bin>


More information about the Pkg-games-devel mailing list