bug-guix
[Top][All Lists]
Advanced

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

bug#56799: (gnu services configuration) usage of *unspecified* is proble


From: Maxim Cournoyer
Subject: bug#56799: (gnu services configuration) usage of *unspecified* is problematic
Date: Mon, 01 Aug 2022 01:08:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Fixes <https://issues.guix.gnu.org/56799>.
>
> * guix/gexp.scm (gexp->sexp)[*unspecified*]: Quote value when encountering it.

Sadly, this doesn't fix the jami service when using a partially defined
jami-account as part of the jami-configuration; the error is:

--8<---------------cut here---------------start------------->8---
In procedure for-each: Wrong type argument: *unspecified*
--8<---------------cut here---------------end--------------->8---

Here's what the generated shepherd-jami.scm file look like:

--8<---------------cut here---------------start------------->8---
#:start
(lambda args
  (define
    (delete-file-recursively/safe file)
    (let
        ((parent-directory
          (dirname file)))
      (if
       (eq?
        (quote symlink)
        (stat:type
         (stat parent-directory)))
       (error "abnormality detected; unexpected symlink found at" 
parent-directory)
       (delete-file-recursively file))))
  (when #t
    (catch #t
      (lambda
          ()
        (for-each
         (cut delete-file-recursively/safe <>)
         (quote
          ("/var/lib/jami/.cache/jami" "/var/lib/jami/.config/jami" 
"/var/lib/jami/.local/share/jami" "/var/lib/jami/accounts"))))
      (lambda args #t))
    (let*
        ((accounts-dir "/var/lib/jami/accounts/")
         (pwd
          (getpwnam "jami"))
         (user
          (passwd:uid pwd))
         (group
          (passwd:gid pwd)))
      (mkdir-p accounts-dir)
      (chown accounts-dir user group)
      (for-each
       (lambda
           (f)
         (let
             ((dest
               (string-append accounts-dir
                              (basename f))))
           (copy-file f dest)
           (chown dest user group)))
       (quote
        
("/gnu/store/14flr53fr0hs7mzfwn93kmyzrnb3fhjz-dummy-jami-account.gz")))))
  (define daemon-pid
    ((make-forkexec-constructor/container
      (quote
       
("/gnu/store/z7qlqkb0qwnpcs5kbbf2z2js0k1xgkbv-libjami-20220726.1515.da8d1da/libexec/jamid"
 "--persistent" "--debug"))
      #:mappings
      (list
       (file-system-mapping
        (source "/dev/log")
        (target source))
       (file-system-mapping
        (source "/var/lib/jami")
        (target source)
        (writable? #t))
       (file-system-mapping
        (source "/var/run/jami")
        (target source)
        (writable? #t))
       (file-system-mapping
        (source 
"/gnu/store/mjmpb4k2g21p7hyx9zq57p9xymbl16ac-nss-certs-3.71/etc/ssl/certs")
        (target "/etc/ssl/certs")))
      #:user "jami" #:group "jami" #:environment-variables
      (list
       (string-append "DBUS_SESSION_BUS_ADDRESS=" "unix:path=/var/run/jami/bus")
       "SSL_CERT_DIR=/etc/ssl/certs"))))
  (setenv "DBUS_SESSION_BUS_ADDRESS" "unix:path=/var/run/jami/bus")
  (with-retries 20 1
    (jami-service-available?))
  (when #t
    (let*
        ((jami-account-archives
          (map
           (cut string-append "/var/lib/jami/accounts/" <>)
           (scandir "/var/lib/jami/accounts/"
                    (lambda
                        (f)
                      (not
                       (member f
                               (quote
                                ("." ".."))))))))
         (usernames
          (map-in-order
           (cut add-account <>)
           jami-account-archives)))
      (define
        (archive-name->username archive)
        (list-ref usernames
                  (list-index
                   (lambda
                       (f)
                     (string-suffix?
                      (basename archive)
                      f))
                   jami-account-archives)))
      (for-each
       (lambda
           (archive allowed-contacts moderators account-details)
         (let
             ((username
               (archive-name->username archive)))
           (when
               (not
                (unspecified? allowed-contacts))
             (set-account-details
              (quote
               (("DHT.PublicInCalls" . "false")))
              username)
             (for-each
              (cut remove-contact <> username)
              (username->contacts username))
             (for-each
              (cut add-contact <> username)
              allowed-contacts))
           (when
               (not
                (unspecified? moderators))
             (set-all-moderators #f username)
             (for-each
              (cut set-moderator <> #f username)
              (username->moderators username))
             (for-each
              (cut set-moderator <> #t username)
              moderators))
           (set-account-details account-details username)))
       (quote
        ("/gnu/store/14flr53fr0hs7mzfwn93kmyzrnb3fhjz-dummy-jami-account.gz"))
       (quote
        (*unspecified*))
       (quote
        (*unspecified*))
       (quote
        ((("Account.rendezVous" . "true")
          ("Account.peerDiscovery" . "false")
          ("Account.hostname" . "bootstrap.me;fallback.another.host")
          ("RingNS.uri" . "https://my.name.server";)))))))
  daemon-pid)
--8<---------------cut here---------------end--------------->8---

Can you spot where the problem is?

Attached is the extended test I've used to test.  You generate a VM
with:

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix system vm --no-graphics \
  -e '(@@ (gnu tests telephony) %jami-os-provisioning-partial)
--8<---------------cut here---------------end--------------->8---

To test with a more hands-on approach.

Attachment: 0001-gnu-telephony-Add-a-Jami-test-for-a-partially-define.patch
Description: Text Data

Thanks,

Maxim

reply via email to

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