From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 56799@debbugs.gnu.org
Subject: bug#56799: (gnu services configuration) usage of *unspecified* is problematic
Date: Mon, 01 Aug 2022 01:08:31 -0400 [thread overview]
Message-ID: <87mtco4kkw.fsf_-_@gmail.com> (raw)
In-Reply-To: <20220728044144.15693-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Thu, 28 Jul 2022 00:41:44 -0400")
[-- Attachment #1: Type: text/plain, Size: 5573 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-telephony-Add-a-Jami-test-for-a-partially-define.patch --]
[-- Type: text/x-patch, Size: 5267 bytes --]
From 4ccaa9109c67174d428512b16a5c1ee77e66f491 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 1 Aug 2022 00:49:07 -0400
Subject: [PATCH] gnu: telephony: Add a Jami test for a partially defined
jami-account.
* gnu/tests/telephony.scm (%dummy-jami-account-partial): New variable.
(make-jami-os): Add a PARTIAL? argument and use it to select the jami-account
variant to use.
(%jami-os-provisioning-partial): New variable.
(run-jami-test): Add a PARTIAL? argument, and use it to select operating
system variant. Skip allowed-contacts and moderators test when PARTIAL? is
true.
(%test-jami-provisioning-partial): New test.
---
gnu/tests/telephony.scm | 49 +++++++++++++++++++++++++++++++++--------
1 file changed, 40 insertions(+), 9 deletions(-)
diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm
index 16ee313f69..b505f26e8d 100644
--- a/gnu/tests/telephony.scm
+++ b/gnu/tests/telephony.scm
@@ -31,7 +31,8 @@ (define-module (gnu tests telephony)
#:use-module (guix gexp)
#:use-module (guix modules)
#:export (%test-jami
- %test-jami-provisioning))
+ %test-jami-provisioning
+ %test-jami-provisioning-partial))
;;;
;;; Jami daemon.
@@ -67,7 +68,18 @@ (define %dummy-jami-account (jami-account
"fallback.another.host"))
(name-server-uri "https://my.name.server")))
-(define* (make-jami-os #:key provisioning?)
+;;; Like %dummy-jami-account, but with allowed-contacts and moderators left
+;;; unset (thus taking the value *unspecified*).
+(define %dummy-jami-account-partial
+ (jami-account
+ (archive %dummy-jami-account-archive)
+ (rendezvous-point? #t)
+ (peer-discovery? #f)
+ (bootstrap-hostnames '("bootstrap.me"
+ "fallback.another.host"))
+ (name-server-uri "https://my.name.server")))
+
+(define* (make-jami-os #:key provisioning? partial?)
(operating-system
(host-name "jami")
(timezone "America/Montreal")
@@ -87,7 +99,10 @@ (define* (make-jami-os #:key provisioning?)
(if provisioning?
(jami-configuration
(debug? #t)
- (accounts (list %dummy-jami-account)))
+ (accounts
+ (list (if partial?
+ %dummy-jami-account-partial
+ %dummy-jami-account))))
(jami-configuration
(debug? #t))))
(service dbus-root-service-type)
@@ -109,12 +124,18 @@ (define %jami-os
(define %jami-os-provisioning
(make-jami-os #:provisioning? #t))
-(define* (run-jami-test #:key provisioning?)
- "Run tests in %JAMI-OS. When PROVISIONING? is true, test the
-accounts provisioning feature of the service."
+(define %jami-os-provisioning-partial
+ (make-jami-os #:provisioning? #t #:partial? #t))
+
+(define* (run-jami-test #:key provisioning? partial?)
+ "Run tests in %JAMI-OS. When PROVISIONING? is true, test the accounts
+provisioning feature of the service. When PARTIAL? is #t, some fields of the
+jami account used as part of the jami configuration are left *unspecified*."
(define os (marionette-operating-system
(if provisioning?
- %jami-os-provisioning
+ (if partial?
+ %jami-os-provisioning-partial
+ %jami-os-provisioning)
%jami-os)
#:imported-modules '((gnu services herd)
(guix combinators))))
@@ -202,7 +223,7 @@ (define marionette
"Account.username")))))))
marionette))
- (unless #$provisioning? (test-skip 1))
+ (unless #$(and provisioning? (not partial?)) (test-skip 1))
(test-assert "jami accounts provisioning, allowed-contacts"
(marionette-eval
'(begin
@@ -224,7 +245,7 @@ (define marionette
(assert (lset= string-ci=? contacts '#$%allowed-contacts)))))
marionette))
- (unless #$provisioning? (test-skip 1))
+ (unless #$(and provisioning? (not partial?)) (test-skip 1))
(test-assert "jami accounts provisioning, moderators"
(marionette-eval
'(begin
@@ -341,3 +362,13 @@ (define %test-jami-provisioning
(name "jami-provisioning")
(description "Provisioning test for the jami service.")
(value (run-jami-test #:provisioning? #t))))
+
+;;; Thi test verifies that <jami-account> values can be left unspecified
+;;; without causing any issue (see: https://issues.guix.gnu.org/56799).
+(define %test-jami-provisioning-partial
+ (system-test
+ (name "jami-provisioning-partial")
+ (description "Provisioning test for the jami service, when some of the
+'maybe' fields aren't provided (such that their value end up being
+*unspecified*.")
+ (value (run-jami-test #:provisioning? #t #:partial? #t))))
--
2.36.1
[-- Attachment #3: Type: text/plain, Size: 16 bytes --]
Thanks,
Maxim
next prev parent reply other threads:[~2022-08-01 5:09 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 16:23 bug#56799: (gnu services configuration) usage of *unspecified* is problematic Maxim Cournoyer
2022-07-27 16:43 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-07-27 18:27 ` Attila Lendvai
2022-07-28 15:15 ` Maxim Cournoyer
2022-07-27 18:31 ` Maxim Cournoyer
2022-07-27 18:45 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-07-27 19:09 ` Maxim Cournoyer
2022-07-27 19:45 ` bug#56799: [PATCH] services: configuration: Step back from *unspecified* Maxim Cournoyer
2022-07-27 19:46 ` bug#56799: (gnu services configuration) usage of *unspecified* is problematic Maxim Cournoyer
2022-07-27 20:20 ` bug#56799: [PATCH v2] gexp: Handle *unspecified* as a gexp input Maxim Cournoyer
2022-07-27 21:43 ` Maxime Devos
2022-07-28 14:58 ` Maxim Cournoyer
2022-07-28 4:41 ` bug#56799: [PATCH v3] " Maxim Cournoyer
2022-08-01 5:08 ` Maxim Cournoyer [this message]
2022-08-01 10:00 ` bug#56799: (gnu services configuration) usage of *unspecified* is problematic Maxime Devos
2022-08-01 12:46 ` Maxim Cournoyer
2022-08-01 13:44 ` Ludovic Courtès
2022-08-01 16:55 ` Maxim Cournoyer
2022-07-28 4:55 ` bokr
2022-07-28 10:26 ` Maxime Devos
2022-07-28 15:09 ` Maxim Cournoyer
2022-08-01 13:49 ` Ludovic Courtès
2022-08-01 15:55 ` Maxim Cournoyer
2022-08-02 7:31 ` Ludovic Courtès
2022-08-02 8:45 ` bokr
2022-08-02 15:06 ` Maxim Cournoyer
2022-08-04 12:19 ` Ludovic Courtès
2022-08-07 22:44 ` Ludovic Courtès
2022-08-08 22:27 ` Attila Lendvai
2022-08-08 23:35 ` Attila Lendvai
2022-08-10 2:17 ` Maxim Cournoyer
2022-08-10 3:26 ` Maxim Cournoyer
2022-08-11 10:15 ` Attila Lendvai
2022-08-13 6:31 ` Maxim Cournoyer
2022-08-13 16:47 ` Attila Lendvai
2022-08-14 2:57 ` Maxim Cournoyer
2022-08-16 14:00 ` Attila Lendvai
2022-08-17 13:16 ` Maxim Cournoyer
2022-08-17 16:00 ` paren--- via Bug reports for GNU Guix
2022-08-10 0:43 ` Maxim Cournoyer
2022-08-24 12:40 ` bug#56799: [PATCH 1/5] services: configuration: Add a 'maybe-value-set?' procedure Attila Lendvai
2022-08-24 12:40 ` bug#56799: [PATCH 2/5] services: configuration: Add %unset-value exported variable Attila Lendvai
2022-08-24 12:40 ` bug#56799: [PATCH 3/5] services: configuration: Add maybe-value exported procedure Attila Lendvai
2022-08-24 12:40 ` bug#56799: [PATCH 4/5] services: Use the new maybe/unset API Attila Lendvai
2022-08-25 4:18 ` bug#56799: (gnu services configuration) usage of *unspecified* is problematic Maxim Cournoyer
2022-08-24 12:40 ` bug#56799: [PATCH 5/5] services: configuration: Change the value of the unset marker Attila Lendvai
2022-08-25 4:14 ` bug#56799: (gnu services configuration) usage of *unspecified* is problematic Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtco4kkw.fsf_-_@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=56799@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).