GNU bug report logs - #61789
[PATCH 00/27] Deprecate old-style services.

Previous Next

Package: guix-patches;

Reported by: Bruno Victal <mirai <at> makinata.eu>

Date: Sat, 25 Feb 2023 18:55:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #89 received at 61789 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: 61789 <at> debbugs.gnu.org
Subject: Re: bug#61789: [PATCH 00/27] Deprecate old-style services.
Date: Fri, 03 Mar 2023 17:40:49 +0100
Hi,

Bruno Victal <mirai <at> makinata.eu> skribis:

> * doc/guix.texi (Base Services): Replace pam-limits-service with pam-limits-service-type.
> * gnu/packages/benchmark.scm (python-locust)[description]: Update index anchor to manual.
> * gnu/services/base.scm (pam-limits-service-type): Accept both lists and
> file-like objects for compatibility.
> (pam-limits-service): Deprecate procedure.

[...]

>  @lisp
> -(pam-limits-service
> +(service pam-limits-service-type
>   (list
>    (pam-limits-entry "@@realtime" 'both 'rtprio 99)
>    (pam-limits-entry "@@realtime" 'both 'memlock 'unlimited)))

Would be nice to indent the service value.  :-)

>  (define pam-limits-service-type
> -  (let ((security-limits
> -         ;; Create /etc/security containing the provided "limits.conf" file.
> -         (lambda (limits-file)
> -           `(("security/limits.conf"
> -              ,limits-file))))
> -        (pam-extension
> +  (let ((pam-extension
>           (lambda (pam)
>             (let ((pam-limits (pam-entry
>                                (control "required")
>                                (module "pam_limits.so")
> -                              (arguments '("conf=/etc/security/limits.conf")))))
> +                              (arguments
> +                               '("conf=/etc/security/limits.conf")))))
>               (if (member (pam-service-name pam)
>                           '("login" "greetd" "su" "slim" "gdm-password" "sddm"
>                             "sudo" "sshd"))
> @@ -1602,7 +1598,26 @@ (define pam-limits-service-type
>                    (inherit pam)
>                    (session (cons pam-limits
>                                   (pam-service-session pam))))
> -                 pam)))))
> +                 pam))))
> +
> +        ;; XXX: Using file-like objects is deprecated, use lists instead.
> +        ;;      This is to be reduced into the list? case when the deprecated
> +        ;;      code gets removed.
> +        ;; Create /etc/security containing the provided "limits.conf" file.
> +        (security-limits
> +         (match-lambda
> +           ((? file-like? obj)
> +            (warning (G_ "Using file-like value for 'pam-limits-service-type'
> +is deprecated~%"))
> +            obj)
> +           ((? list? lst)
> +            `(("security/limits.conf"
> +               ,(plain-file "limits.conf"
> +                            (string-join (map pam-limits-entry->string lst)
> +                                         "\n" 'suffix)))))
> +           (_ (report-error
> +               (G_ "invalid input for 'pam-limits-service-type'~%"))))))

Maybe this change (from file-like to list) should be done separately,
for clarity?

Also note that ‘report-error’ prints an error but keeps going.  You
probably want to use (raise (formatted-message …)) instead.

Ludo’.




This bug report was last modified 2 years and 136 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.