[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#38122] [PATCH 010/197] services: ntp: Ensure no double quotes are o
From: |
Hartmut Goebel |
Subject: |
[bug#38122] [PATCH 010/197] services: ntp: Ensure no double quotes are output to config file. |
Date: |
Fri, 8 Nov 2019 11:33:38 +0100 |
From: Maxim Cournoyer <address@hidden>
* gnu/services/networking.scm (ntp-server->string): Use the textual
representation of the values as printed by 'display' rather than 'write', to
avoid inserting double quotes in the generated config.
* tests/networking.scm (%ntp-server-sample): Add a comment and make one of the
options a string, to exercise the fix.
("ntp-server->string"): Move the expected value to the first argument.
("ntp configuration servers deprecated form"): Likewise.
("openntpd generated config string ends with a newline"): Likewise.
---
gnu/services/networking.scm | 2 +-
tests/networking.scm | 19 ++++++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 93d9b6a15e..841fbd741e 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -345,7 +345,7 @@ Protocol (DHCP) client, on all the non-loopback network
interfaces."
(res '()))
(if (list? x)
(fold loop res x)
- (cons (format #f "~s" x) res)))))
+ (cons (format #f "~a" x) res)))))
(match ntp-server
(($ <ntp-server> type address options)
diff --git a/tests/networking.scm b/tests/networking.scm
index 439cca5ffc..c494a48067 100644
--- a/tests/networking.scm
+++ b/tests/networking.scm
@@ -36,22 +36,23 @@
(ntp-server
(type 'server)
(address "some.ntp.server.org")
- (options `(iburst (version 3) (maxpoll 16) prefer))))
+ ;; Using either strings or symbols for option names is accepted.
+ (options `("iburst" (version 3) (maxpoll 16) prefer))))
(test-equal "ntp-server->string"
- (ntp-server->string %ntp-server-sample)
- "server some.ntp.server.org iburst version 3 maxpoll 16 prefer")
+ "server some.ntp.server.org iburst version 3 maxpoll 16 prefer"
+ (ntp-server->string %ntp-server-sample))
(test-equal "ntp configuration servers deprecated form"
+ (ntp-configuration-servers
+ (ntp-configuration
+ (servers (list "example.pool.ntp.org"))))
(ntp-configuration-servers
(ntp-configuration
(servers (list (ntp-server
(type 'server)
(address "example.pool.ntp.org")
- (options '()))))))
- (ntp-configuration-servers
- (ntp-configuration
- (servers (list "example.pool.ntp.org")))))
+ (options '())))))))
;;;
@@ -106,8 +107,8 @@ the sanity check:\n~a~%" config)
#t))))
(test-equal "openntpd generated config string ends with a newline"
+ "\n"
(let ((config (openntpd-configuration->string %openntpd-conf-sample)))
- (string-take-right config 1))
- "\n")
+ (string-take-right config 1)))
(test-end "networking")
--
2.21.0
- [bug#38122] [PATCH 0/1] qtwebkit: Uses sqlite-with-column-metadata., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 001/197] gnu: Add emacs-eshell-prompt-extras., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 1/1] gnu: qtwebkit: Uses sqlite-with-column-metadata., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 003/197] gnu: Fix attribution., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 002/197] gnu: Add emacs-eshell-did-you-mean., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 004/197] gnu: make-nsis: Fix cross-compilation., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 005/197] gnu: Add dxvk., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 006/197] gnu: Fix make-gcc-libc., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 007/197] gnu: Add gitg., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 010/197] services: ntp: Ensure no double quotes are output to config file.,
Hartmut Goebel <=
- [bug#38122] [PATCH 012/197] gnu: pingus: Adjust for GCC 7., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 011/197] gnu: pingus: Update source URI., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 008/197] gnu: Add python-keyutils., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 013/197] gnu: Remove python2-feather-format., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 009/197] gnu: Add udiskie., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 015/197] gnu: pocl: Update to 1.4., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 017/197] gnu: Chibi-Scheme: Update to 0.8., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 018/197] gnu: Chibi-Scheme: Do not use unstable tarball., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 021/197] gnu: musescore: Update to 3.3., Hartmut Goebel, 2019/11/08
- [bug#38122] [PATCH 020/197] services: ntp: Fix a crash when using legacy configuration., Hartmut Goebel, 2019/11/08