Github messages for voidlinux
 help / color / mirror / Atom feed
From: ashpooljh <ashpooljh@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] nethack: fix SYSCF_FILE location
Date: Sat, 12 Dec 2020 00:26:47 +0100	[thread overview]
Message-ID: <20201211232647.wnRAsUUw5kvSbGsPASukb9Z4YZGeDwdoCd8RnCHXpFw@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27036@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

There is an updated pull request by ashpooljh against master on the void-packages repository

https://github.com/ashpooljh/void-packages nethack
https://github.com/void-linux/void-packages/pull/27036

nethack: fix SYSCF_FILE location
I wasn't able to enter the wizard mode, not even as root, e.g. `sudo nethack -D -u wizard` just printed 
```
Entering explore/discovery mode instead
```
Then I found out that `SYSCF_FILE` in the template was pointing to the directory `/usr/lib/nethack` instead of the file itself `/usr/lib/nethack/sysconf`, and used `gdb` to verify that this had lead to `src/files.c:parse_conf_file` silently failing (parsing nothing) and `sysopt.wizards` ending up empty. Updating the `SYSCF_FILE` value fixed the issue, and now the sysconf file is read and I'm able to access the wizard mode.

A patch file from https://github.com/void-linux/void-packages/pull/27036.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-nethack-27036.patch --]
[-- Type: text/x-diff, Size: 4223 bytes --]

From 5e2aeaf109893de40c007cf19a9b6b403f6631a0 Mon Sep 17 00:00:00 2001
From: Artem Zhurikhin <ashpool@xecut.net>
Date: Tue, 8 Dec 2020 20:45:29 +0300
Subject: [PATCH] nethack: fix SYSCF_FILE, misc. improvements

- fix xlint
- move *-devel depends to makedepends
- don't override CFLAGS in template, patch
  sys/unix/hints/linux instead
- remove post_extract(), since this is already done
  in sys/unix/hints/linux
- move /usr/lib/nethack/sysconf to /etc/nethack/sysconf,
  add it to conf_files
---
 srcpkgs/nethack/INSTALL                     |  1 +
 srcpkgs/nethack/patches/1-linux-hints.patch | 16 ++++++++++++++
 srcpkgs/nethack/template                    | 23 +++++++++------------
 3 files changed, 27 insertions(+), 13 deletions(-)
 create mode 100644 srcpkgs/nethack/patches/1-linux-hints.patch

diff --git a/srcpkgs/nethack/INSTALL b/srcpkgs/nethack/INSTALL
index c1b32c35262..78fe24f15ad 100644
--- a/srcpkgs/nethack/INSTALL
+++ b/srcpkgs/nethack/INSTALL
@@ -2,6 +2,7 @@ case "${ACTION}" in
 post)
 	chown nethack:nethack usr/lib/nethack/nethack
 	chmod 02755 usr/lib/nethack/nethack
+	chmod 0644 etc/nethack/sysconf
 	touch var/games/nethack/logfile var/games/nethack/perm var/games/nethack/record var/games/nethack/xlogfile
 	chown nethack:nethack var/games/nethack var/games/nethack/*
 	chmod 0775 var/games/nethack
diff --git a/srcpkgs/nethack/patches/1-linux-hints.patch b/srcpkgs/nethack/patches/1-linux-hints.patch
new file mode 100644
index 00000000000..caaef540295
--- /dev/null
+++ b/srcpkgs/nethack/patches/1-linux-hints.patch
@@ -0,0 +1,16 @@
+We move /usr/lib/nethack/sysconf to /etc/nethack/sysconf since
+this file is intended to be editable by root.
+
+diff --git sys/unix/hints/linux sys/unix/hints/linux
+index 8629150..9a4d722 100644
+--- sys/unix/hints/linux
++++ sys/unix/hints/linux
+@@ -23,7 +23,7 @@ POSTINSTALL=cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INS
+ CFLAGS=-g -O -I../include -DNOTPARMDECL
+ CFLAGS+=-DDLB
+ CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
+-CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
++CFLAGS+=-DSYSCF -DSYSCF_FILE=\"/etc/nethack/sysconf\" -DSECURE
+ CFLAGS+=-DTIMED_DELAY
+ CFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
+ CFLAGS+=-DDUMPLOG
diff --git a/srcpkgs/nethack/template b/srcpkgs/nethack/template
index b7ec4c30753..e39eafb0b5c 100644
--- a/srcpkgs/nethack/template
+++ b/srcpkgs/nethack/template
@@ -1,9 +1,12 @@
 # Template file for 'nethack'
 pkgname=nethack
 version=3.6.6
-revision=1
+revision=2
+wrksrc="NetHack-NetHack-${version}_Released"
+conf_files="/etc/nethack/sysconf"
 make_dirs="/var/games/nethack/save 0775 nethack nethack"
-hostmakedepends="ncurses-devel flex"
+hostmakedepends="flex"
+makedepends="ncurses-devel ncurses-libtinfo-devel"
 depends="gzip"
 short_desc="Exploring The Mazes of Menace"
 maintainer="Leah Neukirchen <leah@vuxu.org>"
@@ -13,12 +16,6 @@ distfiles="https://www.nethack.org/download/${version}/nethack-${version//./}-sr
 checksum=cfde0c3ab6dd7c22ae82e1e5a59ab80152304eb23fb06e3129439271e5643ed2
 nocross=yes
 system_accounts="$pkgname"
-wrksrc="NetHack-NetHack-${version}_Released"
-
-post_extract() {
-	sed -i	-e '/COMPRESS/s/compress/gzip/g' \
-		-e '/COMPRESS_EXTENSION/s/\.Z/.gz/g' include/config.h
-}
 
 do_configure() {
 	sh sys/unix/setup.sh sys/unix/hints/linux
@@ -26,16 +23,15 @@ do_configure() {
 
 do_build() {
 	make all dungeon \
-		CC="$CC" LINK="$CC" LFLAGS="$LDFLAGS" \
-		LEX=flex WINTTYLIB=-lncurses \
-		CFLAGS="$CFLAGS -DLINUX -DTIMED_DELAY -DDLB \
-			-DSYSCF -DSYSCF_FILE='\"/usr/lib/nethack\"' \
-			-DHACKDIR='\"/var/games/nethack\"' -I../include"
+		CC="$CC" LINK="$CC" LFLAGS="$LDFLAGS" LEX=flex \
+		HACKDIR="/var/games/nethack"
 }
 
 do_install() {
 	vmkdir usr/share/man/man6
 	vmkdir var/games
+	vmkdir etc/nethack
+
 	make install manpages \
 		PREFIX=$DESTDIR \
 		SHELLDIR=$DESTDIR/usr/bin \
@@ -51,6 +47,7 @@ do_install() {
 
 	mv $DESTDIR/usr/lib/nethack/nhdat $DESTDIR/var/games/nethack
 	mv $DESTDIR/usr/lib/nethack/symbols $DESTDIR/var/games/nethack
+	mv $DESTDIR/usr/lib/nethack/sysconf $DESTDIR/etc/nethack
 	rm $DESTDIR/var/games/nethack/{logfile,perm,record,xlogfile}
 
 	sed -i	-e 's,^HACKDIR=.*,HACKDIR=/var/games/nethack,' \

  parent reply	other threads:[~2020-12-11 23:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 17:54 [PR PATCH] " ashpooljh
2020-12-08 18:51 ` [PR PATCH] [Updated] " ashpooljh
2020-12-08 18:52 ` ashpooljh
2020-12-08 19:08 ` ashpooljh
2020-12-08 19:10 ` ashpooljh
2020-12-08 19:13 ` leahneukirchen
2020-12-08 19:16 ` leahneukirchen
2020-12-10  9:55 ` [PR PATCH] [Updated] " ashpooljh
2020-12-10 10:02 ` ashpooljh
2020-12-10 10:04 ` ashpooljh
2020-12-11 15:10 ` [PR REVIEW] " ericonr
2020-12-11 16:05 ` ashpooljh
2020-12-11 16:06 ` ashpooljh
2020-12-11 16:16 ` ericonr
2020-12-11 23:26 ` ashpooljh [this message]
2020-12-11 23:40 ` ashpooljh
2020-12-11 23:41 ` ashpooljh
2020-12-11 23:43 ` ashpooljh
2020-12-11 23:49 ` ashpooljh
2020-12-12  1:44 ` ericonr
2020-12-12  9:32 ` [PR PATCH] [Updated] " ashpooljh
2020-12-12  9:48 ` ashpooljh
2020-12-16  1:26 ` ericonr
2020-12-16  1:26 ` [PR PATCH] [Merged]: " ericonr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201211232647.wnRAsUUw5kvSbGsPASukb9Z4YZGeDwdoCd8RnCHXpFw@z \
    --to=ashpooljh@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).