[PATCH] gnu: Add bsd-games.

  • Done
  • quality assurance status badge
Details
2 participants
  • Vitaliy Shatrov
  • Nicolas Goaziou
Owner
unassigned
Submitted by
Vitaliy Shatrov
Severity
normal
V
V
Vitaliy Shatrov wrote on 24 Apr 2020 15:54
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
ff2iu2bW1tBFrGN2L7u6kGsUl3_b0Iohk-KEjwDYVftqfTeGuRnUgclM3VEquudkczw_67OLLuUkHG7bknJiV0-b0P64FCAF9zWCK7WO-3w=@protonmail.com
Hi.
The most important thing to review is rights. This package assumes that all score-files and save-games are placed in /var/tmp/bsd-games. The first user owns the files, and the wrapper script do `chmod ug+w`. If the SETGUID approach, despite the games age is better, i'll rework this. Though sys-admin (or the first user) can simply change the permissions, or group to restrict the access.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
N
N
Nicolas Goaziou wrote on 16 Jun 2020 15:17
(name . Vitaliy Shatrov via Guix-patches via)(address . guix-patches@gnu.org)
871rmfcfqr.fsf@nicolasgoaziou.fr
Hello,

Vitaliy Shatrov via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (7 lines)
> The most important thing to review is rights. This package assumes
> that all score-files and save-games are placed in /var/tmp/bsd-games.
> The first user owns the files, and the wrapper script do `chmod ug+w`.
> If the SETGUID approach, despite the games age is better, i'll rework
> this. Though sys-admin (or the first user) can simply change the
> permissions, or group to restrict the access.

Thank you for the patch.

Is it possible to create save-games in ~/.local/share/XXX/ instead?

Also, considering the bsd-games-add-word-list.patch file, would it be
possible to use "miscfiles" package as an input instead? It also
provides and English words list.

Regards,
--
Nicolas Goaziou
V
V
Vitaliy Shatrov wrote on 17 Jun 2020 09:46
Re: [bug #40818] "Add bsd-games"
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)
C319gNzHHDCZEdWxB7Dxk3DFqxUyBG4D8KfCHqmkfuRvrlERg5jVWs91MyGahLTIPoel6UQpCV4jnytKxs8CGLISJS65PEd6v5cSLiHAYJ4=@protonmail.com
I'll try ~/. Thanks for the misc pointer.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
V
V
Vitaliy Shatrov wrote on 17 Jun 2020 18:42
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)
9hfOZ7tKeT02_D1hsiO4AvJ6KfRqwwUFhveEUJ34qgvPzU9tXWnMdRHkOsNolUJoRML4T1eKnQGsfItTWQ6KPLmS19KamA0Fwhr8SHoHDLk=@protonmail.com
About ~/.local/share/xxx: Will things like this "bsd-hack"-patch be accepted?

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
--- bsd-games-2.17.orig/hack/hack.main.c 1970-01-01 07:00:01.000000000 +0700
+++ bsd-games-2.17/hack/hack.main.c 2020-06-17 22:09:31.424759883 +0700
@@ -552,8 +552,15 @@
#endif
#ifdef HACKDIR
- if (dir == NULL)
- dir = HACKDIR;
+ /* Guix: make "hack" target the user's HOME as default. */
+ if (dir == NULL) {
+ /* Guix: i'm sorry for using the plain numbers. */
+ char hackdir_str[1026] = "";
+ strncat(hackdir_str, getenv("HOME"), 512);
+ strcat(hackdir_str, "/");
+ strncat(hackdir_str, HACKDIR, 512);
+ dir = hackdir_str;
+ }
#endif
if (dir && chdir(dir) < 0) {
V
V
Vitaliy Shatrov wrote on 17 Jun 2020 18:49
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)(name . mail@nicolasgoaziou.fr)(address . mail@nicolasgoaziou.fr)
AxUE6Bqi4MmH2TAEgZCfQnw1RgCw_W9_96APPUNkgh6wDObusqOAGFUBwoDbm_pS4kUI57_iOK7wVuU-Wf5tytq3ob6XAT9c8BWuvFVamUA=@protonmail.com
Probably now i've sent the mail correct way.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
N
N
Nicolas Goaziou wrote on 7 Jul 2020 14:29
Re: [bug#40818] [bug #40818] "Add bsd-games"
(name . Vitaliy Shatrov via Guix-patches via)(address . guix-patches@gnu.org)
87d0577bk3.fsf@nicolasgoaziou.fr
Hello,

Vitaliy Shatrov via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (3 lines)
> About ~/.local/share/xxx: Will things like this "bsd-hack"-patch be
> accepted?

Since no one complained, I guess the answer is "yes" :)

Could you send a complete patch? (Or maybe I missed it, this was a long
time ago!)

Regards,
--
Nicolas Goaziou
V
V
Vitaliy Shatrov wrote on 1 Aug 2020 20:45
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)
NAYdAmpfzJU_LZ3XcSVuOGXUbIw6F_awCq3zyhPgqXnnvThVfxItMIofLanz6PeUmtm6FtXFoCvevPCoPb3N2r6kv_MPl3xEh-08H79TWM8=@protonmail.com
Hello.

Toggle quote (3 lines)
> Could you send a complete patch? (Or maybe I missed it, this was a long
> time ago!)

Honestly there are none yet, but i'm working on that. I'm bad at programming for now. The last idea was to use a chdir() instead, and change the original variables from "path/to/x" to just "x".

Regards, Vitaliy.
Sent with ProtonMail Secure Email.
Attachment: file
V
V
Vitaliy Shatrov wrote on 4 Aug 2020 22:57
RE: [bug #40818] "Add bsd-games"
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)
LxumNxFttBPC0qD_9LMpaTSa1EWmHjrdTwgWlFx2z7Xo2ko1Hy01fTbk6TDHd0VbqqJI1ahwaviiPRJJ9KQp0gwn5H5GByN9EoMgIxyUtO4=@protonmail.com
Hello again.

I'd received an advice to send a patch in the best working state i have already,
and then add the games that aren't working.

The all games should work, but hack and phantasia. Some games currently can't write
a score files, but this isn't criticall.

I'll continue to thinking about, and search for advices on how to do things in the User's HOME,
or something similar: be that "getpwid()" stuff i'd seen on stackoverflow, or just a
"chdir(getenv("SOME_ENV_VAR"));".

Regards, Vitaliy.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
V
V
Vitaliy Shatrov wrote on 4 Aug 2020 22:59
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)
mI4iG8ZhDza81on0BxLDj7FnB_WzIfzcky6EG-5QYoRJLEPuYAdV4tZfhlts5in5dAa0mhfl6NEaCWIp1L7QrMRzFRBRF3K9vkshTrugYK8=@protonmail.com
The actual patch attached...
(Ooops..)
Regards-regards, Vitaliy.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
V
V
Vitaliy Shatrov wrote on 5 Aug 2020 16:35
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)
_PWhYxkw6OfHG67OjoQ_rXEbyw4zBvKV_awdd7pY-rDTnqBXtu_CvLiwr_eyPeF4cmqYRVkKYYfBQH-5ilv10F7igF9d40wsozcOAdLfeVs=@protonmail.com
Actually sail need the writable directory too.
Do not compile it untill some solution found.

Regards, Vitaliy.

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
V
V
Vitaliy Shatrov wrote on 6 Aug 2020 06:12
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)
0brPoyfV3zgdJ1J6hkXj-be_ncnF2rMvCs8qUnuL2Fy96ctAZ5HnuuLeMn0UcDPEifNEdcetFyS6rpvtx7oEMF1gpVngWPZB7OiDSA7NBug=@protonmail.com
I'm sorry, i'm forget to run both the `guix lint` and the code indentation checker.
I'll fix it.

Regards, Vitaliy. Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
V
V
Vitaliy Shatrov wrote on 6 Aug 2020 18:04
(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)
YZshsyJOYH9dSeUotQBSvcuJN3HAg6q8GVAnwOXaBgIh4Cojl-l0gNoMoM38bw_wpZGCF_D9-bK6Yt4PV_PQrAeZPGMKQuYHL9QrOuMidws=@protonmail.com
That is a "final" version. All games are works, the wrapper script works, and no unnecessary changes
were introduced to the games' code in the end. They're configured to search in the current dir, and the
wrapper (a bash script) cares about the files that should be copied from the Store, and cd's to the
BSD_GAMES_DIR (and ask the User to set this variable if it's unset). It's also can use HACKDIR if the game
started is "hack".

Regards, Vitaliy. Sent with [ProtonMail](https://protonmail.com) Secure Email.
Attachment: file
N
N
Nicolas Goaziou wrote on 13 Aug 2020 10:30
Re: [bug #40818] "Add bsd-games"
(name . Vitaliy Shatrov)(address . D0dyBo0D0dyBo0@protonmail.com)(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)
871rkb9cdz.fsf@nicolasgoaziou.fr
Hello,

Vitaliy Shatrov <D0dyBo0D0dyBo0@protonmail.com> writes:

Toggle quote (6 lines)
> That is a "final" version. All games are works, the wrapper script works, and no unnecessary changes
> were introduced to the games' code in the end. They're configured to search in the current dir, and the
> wrapper (a bash script) cares about the files that should be copied from the Store, and cd's to the
> BSD_GAMES_DIR (and ask the User to set this variable if it's unset). It's also can use HACKDIR if the game
> started is "hack".

Thank you.

Toggle quote (8 lines)
> Regards, Vitaliy. Sent with [ProtonMail](https://protonmail.com) Secure Email.
> From a6af7beba9d9feb5fdebf9f429c53cdad91b48bd Mon Sep 17 00:00:00 2001
> From: Vitaliy Shatrov <D0dyBo0D0dyBo0@protonmail.com>
> Date: Thu, 6 Aug 2020 22:15:22 +0700
> Subject: [PATCH] gnu: Add bsd-games.
>
> * gnu/packages/games.scm a new variable.

This should be gnu/packages/games.scm (bsd-games): New variable.

Toggle quote (15 lines)
> New patches, taken from Arch and Debian:
> * gnu/packages/patches/bsd-games-2.17-64bit.patch
> * gnu/packages/patches/bsd-games-bad-ntohl-cast.patch
> * gnu/packages/patches/bsd-games-gamescreen.h.patch
> * gnu/packages/patches/bsd-games-getline.patch
> * gnu/packages/patches/bsd-games-null-check.patch
> * gnu/packages/patches/bsd-games-number.c-and-test.patch
> * gnu/packages/patches/bsd-games-prevent-name-collisions.patch
> * gnu/packages/patches/bsd-games-stdio.h.patch
>
> New patches with our customizations (configure-config built after Arch's):
> * gnu/packages/patches/bsd-games-add-configure-config.patch
> * gnu/packages/patches/bsd-games-add-wrapper.patch
> * gnu/packages/patches/bsd-games-dont-install-empty-files.patch

You need to reference all those patches in "gnu/local.mk" file. Could
you send an updated patch?

Note that I did that, but some games still fail to run, e.g., phantasia
and hack.

Regards,
--
Nicolas Goaziou
V
V
Vitaliy Shatrov wrote on 25 Aug 2020 13:55
(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)(name . 40818@debbugs.gnu.org)(address . 40818@debbugs.gnu.org)
RXz3v9nXhSM2VKWR7BSxTG9GJ4E3AkggwMe08WkUb2gef5UBQSInJeOkDNtEDyIDUpBA4WRyNSyXiThXpVP3vhAxrJ2Ka_Q8GufukcD1V1Q=@protonmail.com
Hello Nicolas.

Toggle quote (4 lines)
> This should be gnu/packages/games.scm (bsd-games): New variable.

> reference all those patches in "gnu/local.mk" file.

Done

Toggle quote (2 lines)
> some games still fail to run, e.g., phantasia and hack.

Pity. What errors are output?

How i do start the games:

cd git/guix
guix environment --pure guix
./bootstrap && ./configure --localstatedir=/var && make -j2
./pre-inst-env guix environment --ad-hoc bsd-games
phantasia
--->
Guix: Please set up the BSD_GAMES_DIR variable.
Examples:
export BSD_GAMES_DIR=/var/multiplayer
export BSD_GAMES_DIR=~/.local/share/bsd-games
You can place this in ~/.bashrc or a similar file for Your shell.
For multiplayer this directory should be writable for all players.

BSD_GAMES_DIR=~/bsd-dir phantasia
--->
"You've been caught raping and pillaging"
"You are attacked by Kobold"
...
---

Regards, Vitaliy.
Sent with ProtonMail Secure Email.
N
N
Nicolas Goaziou wrote on 4 Nov 2020 15:18
[PATCH] gnu: Add bsd-games.
(name . Vitaliy Shatrov)(address . D0dyBo0D0dyBo0@protonmail.com)(address . 40818-done@debbugs.gnu.org)
87361purw5.fsf@nicolasgoaziou.fr
Hello,

This was long overdue, but I eventually applied this patch. Thank you!

Regards,
--
Nicolas Goaziou
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 40818@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 40818
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch