me
/
guix
Archived
1
0
Fork 0

tests: vnstat: Avoid call to 'getservbyname'.

This would break "make as-derivation" because /etc/services is
unavailable in the build environment:

  [ 38/ 80] loading...	 95.0% of 40 filesBacktrace:
  In guix/build/compile.scm:
      249:8 19 (compile-files "." "/gnu/store/s5nadqd6hkzivkxp33svwqslfn608ng5-guix-system-tests" ("gnu/tests/audio.scm" "gnu/tests/base.scm" "gnu/tests/ci.scm" "gnu/tests/cups.scm" "gnu/tests/d…" …) …)
  […]
  In unknown file:
	     0 (getserv "discard" "tcp")

  ERROR: In procedure getserv:
  In procedure getserv: no such service discard
  builder for `/gnu/store/…-guix-system-tests.drv' failed with exit code 1

* gnu/tests/vnstat.scm (run-vnstat-test): Hard-code 'guest-port' instead
of calling 'getservbyname'.
master
Ludovic Courtès 2023-05-11 18:07:21 +02:00
parent f43c029041
commit d6f6b57766
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 3 additions and 6 deletions

View File

@ -61,12 +61,9 @@
(define forwarded-port 9999) (define forwarded-port 9999)
(define vm (define vm
(let* ((inetd-service-name "discard") ;; The 'discard' port is 9. Avoid using 'getservbyname' as that might
(inetd-service-proto ;; fail depending on what /etc/services has (if it's available).
(inetd-entry-protocol inetd-service-entry-config)) (let ((guest-port 9))
(guest-port
(servent:port (getservbyname inetd-service-name
inetd-service-proto))))
(virtual-machine (virtual-machine
(operating-system os) (operating-system os)
(port-forwardings `((,forwarded-port . ,guest-port)))))) (port-forwardings `((,forwarded-port . ,guest-port))))))