Package: nethack-common
Version: 3.4.3-12.2
Severity: normal

Dear Maintainer,

In nethack-common.postinst, you try to create an empty
/var/games/nethack/record text file by using /dev/null as a source for
/usr/bin/install. The result of this on my busybox armel system is
that the new file is created as a character special block device, not
an ascii file. This means that the scorefile is not updated by nethack
(yet, there is no error displayed to the user...).

I noticed this because it affects my maemo port of your package, but I
expect this is true on other busybox systems (or possibly armel?)
running regular Debian. 

I've attached a suggested patch which seems to work on both my N900
and my amd64 sid system, creating the empty file with touch and then
setting the same mode and ownership you're using now.

Here is the strace that shows the file is a character special block
device.

20364 open("/var/games/nethack/record", O_RDONLY) = 5
20364 fstat64(5, {st_mode=S_IFCHR|0664, st_rdev=makedev(1, 3), ...}) = 0
20364 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbed0c6a4) = -1 ENOTTY 
(Inappropriate ioctl for device)
20364 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x40021000
20364 read(5, "", 4096)                 = 0
20364 close(5)                          = 0
20364 munmap(0x40021000, 4096)          = 0
20364 open("/var/games/nethack/record", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
20364 fstat64(5, {st_mode=S_IFCHR|0664, st_rdev=makedev(1, 3), ...}) = 0
20364 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbed0c27c) = -1 ENOTTY 
(Inappropriate ioctl for device)
20364 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x40021000
20364 write(5, "3.4.3 166 0 1 1 13 13 0 20111004"..., 74) = 74
20364 close(5)                          = 0
20364 munmap(0x40021000, 4096)          = 0
20364 unlink("/var/games/nethack/record_lock") = 0

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages nethack-common depends on:
ii  debconf [debconf-2.0]  1.5.41 
ii  debianutils            4.0.2  
ii  libc6                  2.13-21

Versions of packages nethack-common recommends:
ii  nethack-console  3.4.3-12.2

nethack-common suggests no packages.

-- debconf information:
  nethack-common/recover-setgid: false
  nethack-common/backup-incompatible: backup
--- nethack-common.postinst	2011-10-07 13:58:36.000000000 -0400
+++ /var/chroot/sid-ia32/scratchbox/users/johnsu01/home/johnsu01/nethack-3.4.3/debian/nethack-common.postinst	2011-10-07 14:02:10.000000000 -0400
@@ -50,7 +50,9 @@
     
     for file in perm record logfile; do
       if [ ! -e /var/games/nethack/$file ]; then
-	  	install -m 0664 -o root -g games /dev/null /var/games/nethack/$file
+		touch /var/games/nethack/$file
+		chmod 0664 /var/games/nethack/$file
+		chown root:games /var/games/nethack/$file
 	  fi
     done
 

Reply via email to