all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* A postinst equivalent in Guix?
@ 2017-01-19 18:30 Georgi Kirilov
  2017-01-20  6:23 ` John Darrington
  2017-01-20 14:09 ` Ludovic Courtès
  0 siblings, 2 replies; 12+ messages in thread
From: Georgi Kirilov @ 2017-01-19 18:30 UTC (permalink / raw)
  To: guix-devel

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

Hi,

is there anything in Guix that can do things at install time, like postinst
scripts in Debian?

A program in a package I created is trying to access /var, but has no
permissions. (Well, /gnu/store/.../var)
The 'install' make target was doing 'chgrp' and 'install -g', but I had to
remove these because there was no such group in the chroot jail. And it
would be wrong anyway, as the gid in the jail would be different from that
in the systems where the package will be installed.
So, I guess /gnu/store/.../var has to be chgrp-ed during installation, on
the user's system.

Any hints?

-- 
Regards,
Georgi Kirilov

[-- Attachment #2: Type: text/html, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-19 18:30 A postinst equivalent in Guix? Georgi Kirilov
@ 2017-01-20  6:23 ` John Darrington
  2017-01-20 14:09 ` Ludovic Courtès
  1 sibling, 0 replies; 12+ messages in thread
From: John Darrington @ 2017-01-20  6:23 UTC (permalink / raw)
  To: Georgi Kirilov; +Cc: guix-devel

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

On Thu, Jan 19, 2017 at 08:30:26PM +0200, Georgi Kirilov wrote:
     Hi,
     
     is there anything in Guix that can do things at install time, like postinst
     scripts in Debian?
     
     A program in a package I created is trying to access /var, but has no
     permissions. (Well, /gnu/store/.../var)
     The 'install' make target was doing 'chgrp' and 'install -g', but I had to
     remove these because there was no such group in the chroot jail. And it
     would be wrong anyway, as the gid in the jail would be different from that
     in the systems where the package will be installed.
     So, I guess /gnu/store/.../var has to be chgrp-ed during installation, on
     the user's system.
     

It's a fast rule that packages in Guix may not mutate the store.  So you will
have to find out exactly what and why your package is trying to do that, and
work out another way to effect it.

J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-19 18:30 A postinst equivalent in Guix? Georgi Kirilov
  2017-01-20  6:23 ` John Darrington
@ 2017-01-20 14:09 ` Ludovic Courtès
  2017-01-21 14:39   ` Georgi Kirilov
  1 sibling, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2017-01-20 14:09 UTC (permalink / raw)
  To: Georgi Kirilov; +Cc: guix-devel

Hi,

Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:

> is there anything in Guix that can do things at install time, like postinst
> scripts in Debian?

No.  There are “profile hooks” in (guix profiles) that are used to a
similar effect, for instance to assemble the ‘dir’ file that contains
pointers to Info documentation.

> A program in a package I created is trying to access /var, but has no
> permissions. (Well, /gnu/store/.../var)
> The 'install' make target was doing 'chgrp' and 'install -g', but I had to
> remove these because there was no such group in the chroot jail. And it
> would be wrong anyway, as the gid in the jail would be different from that
> in the systems where the package will be installed.
> So, I guess /gnu/store/.../var has to be chgrp-ed during installation, on
> the user's system.

First, you probably need to pass --localstatedir=/var to this package’s
configure state, since at run time it won’t be able to write to
/gnu/store/…/var anyway.

Second, it will try and fail to create /var.  The way to address that is
by simply commenting out or patching out the offending commands.  See
for instance ‘avahi-localstatedir.patch’ or ‘mcron-install.patch’.

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-20 14:09 ` Ludovic Courtès
@ 2017-01-21 14:39   ` Georgi Kirilov
  2017-01-21 15:34     ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Georgi Kirilov @ 2017-01-21 14:39 UTC (permalink / raw)
  To: guix-devel

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

On Fri, Jan 20, 2017 at 03:09:25PM +0100, Ludovic Courtès wrote:
>
>> A program in a package I created is trying to access /var, but has no
>> permissions. (Well, /gnu/store/.../var)
>
>First, you probably need to pass --localstatedir=/var to this package’s
>configure state, since at run time it won’t be able to write to
>/gnu/store/…/var anyway.
>
>Second, it will try and fail to create /var.  The way to address that is
>by simply commenting out or patching out the offending commands.  See
>for instance ‘avahi-localstatedir.patch’ or ‘mcron-install.patch’.

That's what happened indeed. When I removed the writes to /var the build 
passed. But the programs in the package couldn't write to the system /var 
directory, since they expect /var/lib/<package>/ to exist and be 
writable.
Besides, writing to /var on a foreign distro may interfere with the same 
package installed natively there (if it is installed).

>> is there anything in Guix that can do things at install time, like postinst
>> scripts in Debian?
>
>No.  There are “profile hooks” in (guix profiles) that are used to a
>similar effect, for instance to assemble the ‘dir’ file that contains
>pointers to Info documentation.

This looks to me much better than the system-wide /var. It is not only 
user-specific, but generation-specific. Really nice mechanism.
I tried to write a new hook, to scan the installed packages and if they 
have a /var/lib/<package>/ inside, to create a writable copy in the 
user's profile, so the programs can write to it without interfering with 
anything on the system.

It didn't work because the hook's output turned out to be immutable...
Whatever chmod or chown I tried inside the hook, the files always ended 
up '-r--r--r-- root root'

Why are these customizations immutable?
I'm probably missing something, but nothing seems to depend on them.
If there was a way to create a writable customization, that would be 
the perfect place to put /var directories.

-- 
Regards,
Georgi

[-- Attachment #2: var-lib-package.patch --]
[-- Type: text/x-diff, Size: 1800 bytes --]

--- profiles.scm        2017-01-21 16:30:02.436621423 +0200
+++ bak/profiles.scm    2017-01-21 16:29:06.631019582 +0200
@@ -516,6 +516,34 @@
   (anym %store-monad
         entry-lookup-package (manifest-entries manifest)))
 
+(define (var-lib-package manifest)
+  (define build
+    (with-imported-modules '((guix build utils))
+    #~(begin
+       (use-modules (guix build utils)
+                    (srfi srfi-1) (srfi srfi-26)
+                    (ice-9 ftw))
+       (define profile-var-lib (string-append #$output "/var/lib"))
+       (define (package-var-libs top)
+         (let ((varlibdir (string-append top "/var/lib")))
+           (map (cut string-append varlibdir "/" <>)
+                (or (scandir varlibdir (lambda (file)
+                                         (not (member file '("." ".."))))) '()))))
+       (define (install-var dir)
+         (copy-recursively dir profile-var-lib)
+         ;; the file mode ends up being overwritten:
+         ;; (chmod dir #o777)
+         ;; guixbuilder* users can't do chown:
+         ;; (chown dir 1000 100)
+         )
+       (mkdir-p profile-var-lib)
+       (exit (every install-var
+                       (append-map package-var-libs
+                                   '#$(manifest-inputs manifest)))))))
+  (gexp->derivation "var-lib" build
+                    #:local-build? #t
+                    #:substitutable? #f))
+
 (define (info-dir-file manifest)
   "Return a derivation that builds the 'dir' file for all the entries of
 MANIFEST."
@@ -909,6 +937,7 @@
   ;; This is the list of derivation-returning procedures that are called by
   ;; default when making a non-empty profile.
   (list info-dir-file
+       var-lib-package
         fonts-dir-file
         ghc-package-cache-file
         ca-certificate-bundle

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-21 14:39   ` Georgi Kirilov
@ 2017-01-21 15:34     ` Ludovic Courtès
  2017-01-21 16:36       ` Georgi Kirilov
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2017-01-21 15:34 UTC (permalink / raw)
  To: Georgi Kirilov; +Cc: guix-devel

Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:

> On Fri, Jan 20, 2017 at 03:09:25PM +0100, Ludovic Courtès wrote:
>>
>>> A program in a package I created is trying to access /var, but has no
>>> permissions. (Well, /gnu/store/.../var)
>>
>>First, you probably need to pass --localstatedir=/var to this package’s
>>configure state, since at run time it won’t be able to write to
>>/gnu/store/…/var anyway.
>>
>>Second, it will try and fail to create /var.  The way to address that is
>>by simply commenting out or patching out the offending commands.  See
>>for instance ‘avahi-localstatedir.patch’ or ‘mcron-install.patch’.
>
> That's what happened indeed. When I removed the writes to /var the
> build passed. But the programs in the package couldn't write to the
> system /var directory, since they expect /var/lib/<package>/ to exist
> and be writable.

Right, but this is typically for daemons and programs that expect to be
installed system-wide.

In that case, the trick is to define a GuixSD service providing an
“activation” snippet that makes sur /var/lib/PACKAGE exists and has the
right permissions beforehand.  For Avahi, this happens here:

  http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/avahi.scm#n93

> Besides, writing to /var on a foreign distro may interfere with the
> same package installed natively there (if it is installed).

Yeah, but I don’t think there’s much we can do.  Again, these are
typically daemons, and for any given daemon there can usually only be
one instance running.

>>> is there anything in Guix that can do things at install time, like postinst
>>> scripts in Debian?
>>
>>No.  There are “profile hooks” in (guix profiles) that are used to a
>>similar effect, for instance to assemble the ‘dir’ file that contains
>>pointers to Info documentation.
>
> This looks to me much better than the system-wide /var. It is not only
> user-specific, but generation-specific. Really nice mechanism.
> I tried to write a new hook, to scan the installed packages and if
> they have a /var/lib/<package>/ inside, to create a writable copy in
> the user's profile, so the programs can write to it without
> interfering with anything on the system.
>
> It didn't work because the hook's output turned out to be immutable...
> Whatever chmod or chown I tried inside the hook, the files always
> ended up '-r--r--r-- root root'
>
> Why are these customizations immutable?

All of /gnu/store is purposefully immutable and profiles live in
/gnu/store.  This is what allows Guix to support reproducible setups,
transactional upgrades, and roll-backs.

By definition /var (aka. ‘localstatedir’) is for mutable state, so it
has to be outside of the store.

To make things more concrete, we could discuss specific packages you are
interested in and see how we could provide them in Guix{,SD}.

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-21 15:34     ` Ludovic Courtès
@ 2017-01-21 16:36       ` Georgi Kirilov
  2017-01-23  9:34         ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Georgi Kirilov @ 2017-01-21 16:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

On Sat, Jan 21, 2017 at 04:34:55PM +0100, Ludovic Courtès wrote:

>To make things more concrete, we could discuss specific packages you are
>interested in and see how we could provide them in Guix{,SD}.

The package is the old bsd-games bundle. Some of the games need to write 
score files under /var/lib/bsdgames/
You can find attached my patch so far.

-- 
Thanks,
Georgi

[-- Attachment #2: games-bsd-games.patch --]
[-- Type: text/x-diff, Size: 4201 bytes --]

From aaac9e7f8d6bb088bc390099445e33135e6bfbc3 Mon Sep 17 00:00:00 2001
From: TwoFinger <Two-Finger@users.noreply.github.com>
Date: Sat, 21 Jan 2017 18:13:48 +0200
Subject: [PATCH] gnu: Add bsd-games

* gnu/packages/games.scm (bsd-games): New variable
* gnu/packages/patches/bsd-games.patch: New file
---
 gnu/packages/games.scm               | 39 +++++++++++++++++++++++++++++++++++
 gnu/packages/patches/bsd-games.patch | 40 ++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 gnu/packages/patches/bsd-games.patch

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index c449f5954..ad4b4f2da 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3068,3 +3068,42 @@ symbols, the game needs graphics to render the non-euclidean world.")
 for Un*x systems with X11.")
     (home-page "http://olofson.net/kobodl/")
     (license license:gpl2+)))
+
+(define-public bsd-games
+  (let ((commit "1e6f16ee747a7c8b6a0b836b12847f79024d0ab6"))
+    (package
+      (name "bsd-games")
+      (version (git-version "2.17" "1" commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url (string-append "https://github.com/msharov/" name ".git"))
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (patches
+                 (search-patches (string-append name ".patch")))
+                (sha256
+                 (base32
+                  "15hazzgy0z5c17rqzvahaw4z0c4n2sdq56mi8lsja56yr1w5n6y3"))))
+      (build-system gnu-build-system)
+      (inputs `(("ncurses" ,ncurses)))
+      (arguments
+       `(#:tests? #f
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (setenv "CC" "gcc")
+                      (let* ((out (assoc-ref outputs "out"))
+                             (var (string-append out "/var")))
+                        (zero?
+                         (system* "./configure"
+                                  (string-append "--prefix=" out)
+                                  (string-append "--localstatedir=" var)))))))))
+      (home-page "https://www.polyomino.org.uk/computer/software/bsd-games/")
+      (synopsis "Linux port of the collection of BSD command line games")
+      (description "Port of most of the games from NetBSD-current.
+Games included:
+atc battlestar caesar cribbage dab drop4 fish gomoku
+hack hangman klondike robots sail snake worm wump")
+      (license license:bsd-4))))
diff --git a/gnu/packages/patches/bsd-games.patch b/gnu/packages/patches/bsd-games.patch
new file mode 100644
index 000000000..9a153f535
--- /dev/null
+++ b/gnu/packages/patches/bsd-games.patch
@@ -0,0 +1,40 @@
+commit 5a7ed4b23b20b239b0788b2cefe1d2819c80aa1a
+Author: TwoFinger <Two-Finger@users.noreply.github.com>
+Date:   Sat Jan 21 14:22:30 2017 +0200
+
+    No chgrp /var/lib/bsdgames
+
+diff --git a/Config.mk.in b/Config.mk.in
+index fbdae93..851421a 100644
+--- a/Config.mk.in
++++ b/Config.mk.in
+@@ -13,7 +13,7 @@ INSTALL		:= @INSTALL@
+ 
+ INSTALLEXE	:= ${INSTALL} -D -p -m 755 -s
+ INSTALLDATA	:= ${INSTALL} -D -p -m 644
+-INSTALLSCORE	:= ${INSTALL} -D -p -m 664 -g users
++INSTALLSCORE	:= ${INSTALL} -D -p -m 664
+ RMPATH		:= rmdir -p --ignore-fail-on-non-empty
+ 
+ ################ Destination #########################################
+@@ -21,7 +21,7 @@ RMPATH		:= rmdir -p --ignore-fail-on-non-empty
+ prefix		:= @prefix@
+ BINDIR		:= @bindir@
+ MANDIR		:= @mandir@
+-STATEDIR	:= @localstatedir@/${NAME}
++STATEDIR	:= @localstatedir@/lib/${NAME}
+ DATADIR		:= @datadir@/${NAME}
+ 
+ WORDLIST	:= @wordlist@
+diff --git a/hack/Module.mk b/hack/Module.mk
+index 971bcf1..4ab0eb6 100644
+--- a/hack/Module.mk
++++ b/hack/Module.mk
+@@ -51,7 +51,6 @@ ${hack/SCOREI}:	${STATEDIR}/hack
+ ${STATEDIR}/hack:
+ 	@echo "Creating hack dir and score files ..."
+ 	@mkdir -m 755 ${STATEDIR}/hack
+-	@chgrp users ${STATEDIR}/hack
+ 	@${INSTALLSCORE} /dev/null ${STATEDIR}/hack/perm
+ 	@${INSTALLSCORE} /dev/null ${STATEDIR}/hack/record
+ 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-21 16:36       ` Georgi Kirilov
@ 2017-01-23  9:34         ` Ludovic Courtès
  2017-01-25  0:26           ` Christopher Allan Webber
  2017-01-25 14:54           ` Georgi Kirilov
  0 siblings, 2 replies; 12+ messages in thread
From: Ludovic Courtès @ 2017-01-23  9:34 UTC (permalink / raw)
  To: Georgi Kirilov; +Cc: guix-devel

Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:

> On Sat, Jan 21, 2017 at 04:34:55PM +0100, Ludovic Courtès wrote:
>
>>To make things more concrete, we could discuss specific packages you are
>>interested in and see how we could provide them in Guix{,SD}.
>
> The package is the old bsd-games bundle. Some of the games need to
> write score files under /var/lib/bsdgames/
> You can find attached my patch so far.

The patch looks good to me!

As for /var/lib/bsdgames, then it’s up to the admin to set the right
permissions on it.  We can ensure that it exists and has the right
permissions on GuixSD, but on foreign distros, there’s nothing we can
do.

We could also modify bsd-games such that it falls back to
~/.local/bsdgames when /var/lib/bsdgames isn’t accessible (and it would
be worth submitting upstream).  ISTR this was discussed for one of the
games present in Guix.

WDYT?

Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-23  9:34         ` Ludovic Courtès
@ 2017-01-25  0:26           ` Christopher Allan Webber
  2017-01-25 13:15             ` Ludovic Courtès
  2017-01-25 14:54           ` Georgi Kirilov
  1 sibling, 1 reply; 12+ messages in thread
From: Christopher Allan Webber @ 2017-01-25  0:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel, Georgi Kirilov

Ludovic Courtès writes:

> Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:
>
>> On Sat, Jan 21, 2017 at 04:34:55PM +0100, Ludovic Courtès wrote:
>>
>>>To make things more concrete, we could discuss specific packages you are
>>>interested in and see how we could provide them in Guix{,SD}.
>>
>> The package is the old bsd-games bundle. Some of the games need to
>> write score files under /var/lib/bsdgames/
>> You can find attached my patch so far.
>
> The patch looks good to me!
>
> As for /var/lib/bsdgames, then it’s up to the admin to set the right
> permissions on it.  We can ensure that it exists and has the right
> permissions on GuixSD, but on foreign distros, there’s nothing we can
> do.
>
> We could also modify bsd-games such that it falls back to
> ~/.local/bsdgames when /var/lib/bsdgames isn’t accessible (and it would
> be worth submitting upstream).  ISTR this was discussed for one of the
> games present in Guix.
>
> WDYT?
>
> Ludo’.

I'm a bit wary about GuixSD packages declaring being able to write to
/var/ anything by default.  What would the permissions be?  I guess if
it were world-writable to all "users" group users it would be okayish.

Note that KoboDeluxe includes a patch snarfed from Debian that comments
out the ability to save score files for this same reason, and it was
marked in Debian as a security patch IIRC...

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-25  0:26           ` Christopher Allan Webber
@ 2017-01-25 13:15             ` Ludovic Courtès
  2017-01-25 13:42               ` John Darrington
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2017-01-25 13:15 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel, Georgi Kirilov

Christopher Allan Webber <cwebber@dustycloud.org> skribis:

> Ludovic Courtès writes:
>
>> Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:
>>
>>> On Sat, Jan 21, 2017 at 04:34:55PM +0100, Ludovic Courtès wrote:
>>>
>>>>To make things more concrete, we could discuss specific packages you are
>>>>interested in and see how we could provide them in Guix{,SD}.
>>>
>>> The package is the old bsd-games bundle. Some of the games need to
>>> write score files under /var/lib/bsdgames/
>>> You can find attached my patch so far.
>>
>> The patch looks good to me!
>>
>> As for /var/lib/bsdgames, then it’s up to the admin to set the right
>> permissions on it.  We can ensure that it exists and has the right
>> permissions on GuixSD, but on foreign distros, there’s nothing we can
>> do.
>>
>> We could also modify bsd-games such that it falls back to
>> ~/.local/bsdgames when /var/lib/bsdgames isn’t accessible (and it would
>> be worth submitting upstream).  ISTR this was discussed for one of the
>> games present in Guix.
>>
>> WDYT?
>>
>> Ludo’.
>
> I'm a bit wary about GuixSD packages declaring being able to write to
> /var/ anything by default.  What would the permissions be?  I guess if
> it were world-writable to all "users" group users it would be okayish.
>
> Note that KoboDeluxe includes a patch snarfed from Debian that comments
> out the ability to save score files for this same reason, and it was
> marked in Debian as a security patch IIRC...

Yeah, I think scores in /var are a remnant of the past.  Unix just lacks
a good way to address this use case.

So it sounds best for games to use a score file under $HOME by default.

Ludo’.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-25 13:15             ` Ludovic Courtès
@ 2017-01-25 13:42               ` John Darrington
  2017-01-25 16:19                 ` Christopher Allan Webber
  0 siblings, 1 reply; 12+ messages in thread
From: John Darrington @ 2017-01-25 13:42 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, Georgi Kirilov

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

On Wed, Jan 25, 2017 at 02:15:12PM +0100, Ludovic Court??s wrote:
     Christopher Allan Webber <cwebber@dustycloud.org> skribis:
     
     > Ludovic Court??s writes:
     >
     >> Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:
     >>
     >>> On Sat, Jan 21, 2017 at 04:34:55PM +0100, Ludovic Court??s wrote:
     >>>
     >>>>To make things more concrete, we could discuss specific packages you are
     >>>>interested in and see how we could provide them in Guix{,SD}.
     >>>
     >>> The package is the old bsd-games bundle. Some of the games need to
     >>> write score files under /var/lib/bsdgames/
     >>> You can find attached my patch so far.
     >>
     >> The patch looks good to me!
     >>
     >> As for /var/lib/bsdgames, then it???s up to the admin to set the right
     >> permissions on it.  We can ensure that it exists and has the right
     >> permissions on GuixSD, but on foreign distros, there???s nothing we can
     >> do.
     >>
     >> We could also modify bsd-games such that it falls back to
     >> ~/.local/bsdgames when /var/lib/bsdgames isn???t accessible (and it would
     >> be worth submitting upstream).  ISTR this was discussed for one of the
     >> games present in Guix.
     >>
     >> WDYT?
     >>
     >> Ludo???.
     >
     > I'm a bit wary about GuixSD packages declaring being able to write to
     > /var/ anything by default.  What would the permissions be?  I guess if
     > it were world-writable to all "users" group users it would be okayish.
     >
     > Note that KoboDeluxe includes a patch snarfed from Debian that comments
     > out the ability to save score files for this same reason, and it was
     > marked in Debian as a security patch IIRC...
     
     Yeah, I think scores in /var are a remnant of the past.  Unix just lacks
     a good way to address this use case.
     
     So it sounds best for games to use a score file under $HOME by default.
     
I always thought the unix way was rather nice.   The scores file was owned by 
"games" and programs which wanted to write to them were setuid games.

That way everyone on the system shares the same scores file.

J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-23  9:34         ` Ludovic Courtès
  2017-01-25  0:26           ` Christopher Allan Webber
@ 2017-01-25 14:54           ` Georgi Kirilov
  1 sibling, 0 replies; 12+ messages in thread
From: Georgi Kirilov @ 2017-01-25 14:54 UTC (permalink / raw)
  To: Ludovic Courtès, Christopher Allan Webber, John Darrington
  Cc: guix-devel

On Mon, Jan 23, 2017 at 10:34:55AM +0100, Ludovic Courtès wrote:
>As for /var/lib/bsdgames, then it’s up to the admin to set the right
>permissions on it.  We can ensure that it exists and has the right
>permissions on GuixSD, but on foreign distros, there’s nothing we can
>do.

Yep, I think making it work in GuixSD is enough :)
Other distros have their own package.

I tried adding a gnu/services/games.scm and mimicking what the other 
services did, but I don't even know how to trigger the code.
I would appreciate any help.

On Wed, Jan 25, 2017 at 02:42:41PM +0100, John Darrington wrote:
>I always thought the unix way was rather nice.   The scores file was owned by
>"games" and programs which wanted to write to them were setuid games.
>
>That way everyone on the system shares the same scores file.

Yes, some of these games maintain and query a system-wide top scores 
list so users can try to beat each other's top scores.

On Tue, Jan 24, 2017 at 06:26:28PM -0600, Christopher Allan Webber wrote:
>I'm a bit wary about GuixSD packages declaring being able to write to
>/var/ anything by default.  What would the permissions be?  I guess if
>it were world-writable to all "users" group users it would be okayish.

This is exactly how this package does it - it installs initial, empty 
score files and chgrp's them to 'users'.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: A postinst equivalent in Guix?
  2017-01-25 13:42               ` John Darrington
@ 2017-01-25 16:19                 ` Christopher Allan Webber
  0 siblings, 0 replies; 12+ messages in thread
From: Christopher Allan Webber @ 2017-01-25 16:19 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, Georgi Kirilov

John Darrington writes:

> On Wed, Jan 25, 2017 at 02:15:12PM +0100, Ludovic Court??s wrote:
>      Christopher Allan Webber <cwebber@dustycloud.org> skribis:
>
>      > Ludovic Court??s writes:
>      >
>      >> Georgi Kirilov <kirilov.georgi.s@gmail.com> skribis:
>      >>
>      >>> On Sat, Jan 21, 2017 at 04:34:55PM +0100, Ludovic Court??s wrote:
>      >>>
>      >>>>To make things more concrete, we could discuss specific packages you are
>      >>>>interested in and see how we could provide them in Guix{,SD}.
>      >>>
>      >>> The package is the old bsd-games bundle. Some of the games need to
>      >>> write score files under /var/lib/bsdgames/
>      >>> You can find attached my patch so far.
>      >>
>      >> The patch looks good to me!
>      >>
>      >> As for /var/lib/bsdgames, then it???s up to the admin to set the right
>      >> permissions on it.  We can ensure that it exists and has the right
>      >> permissions on GuixSD, but on foreign distros, there???s nothing we can
>      >> do.
>      >>
>      >> We could also modify bsd-games such that it falls back to
>      >> ~/.local/bsdgames when /var/lib/bsdgames isn???t accessible (and it would
>      >> be worth submitting upstream).  ISTR this was discussed for one of the
>      >> games present in Guix.
>      >>
>      >> WDYT?
>      >>
>      >> Ludo???.
>      >
>      > I'm a bit wary about GuixSD packages declaring being able to write to
>      > /var/ anything by default.  What would the permissions be?  I guess if
>      > it were world-writable to all "users" group users it would be okayish.
>      >
>      > Note that KoboDeluxe includes a patch snarfed from Debian that comments
>      > out the ability to save score files for this same reason, and it was
>      > marked in Debian as a security patch IIRC...
>
>      Yeah, I think scores in /var are a remnant of the past.  Unix just lacks
>      a good way to address this use case.
>
>      So it sounds best for games to use a score file under $HOME by default.
>
> I always thought the unix way was rather nice.   The scores file was owned by
> "games" and programs which wanted to write to them were setuid games.
>
> That way everyone on the system shares the same scores file.
>
> J'

It's fun but... does anyone still play games on the same shared machine
anymore and compare score files?

Except for maybe nethack on fencepost ... ;)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-01-25 16:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-19 18:30 A postinst equivalent in Guix? Georgi Kirilov
2017-01-20  6:23 ` John Darrington
2017-01-20 14:09 ` Ludovic Courtès
2017-01-21 14:39   ` Georgi Kirilov
2017-01-21 15:34     ` Ludovic Courtès
2017-01-21 16:36       ` Georgi Kirilov
2017-01-23  9:34         ` Ludovic Courtès
2017-01-25  0:26           ` Christopher Allan Webber
2017-01-25 13:15             ` Ludovic Courtès
2017-01-25 13:42               ` John Darrington
2017-01-25 16:19                 ` Christopher Allan Webber
2017-01-25 14:54           ` Georgi Kirilov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.