guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ludovic Courtès
Subject: [bug#61789] [PATCH 00/27] Deprecate old-style services.
Date: Fri, 03 Mar 2023 17:40:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi,

Bruno Victal <mirai@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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]