guix-patches
[Top][All Lists]
Advanced

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

[bug#30355] [PATCH] services: agetty: Make tty optional and add agetty i


From: Danny Milosavljevic
Subject: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services.
Date: Sat, 10 Feb 2018 23:07:11 +0100

Hi Ludo,

I tried this now:

(define (default-serial-port)
 "Return a gexp that determines a reasonable default serial port
to use as the tty.  This is primarily useful for headless systems."
  #~(begin
      ;; console=device,options
      ;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial).
      ;; options: BBBBPNF. P n|o|e, N number of bits,
      ;; F flow control (r RTS)
      (use-modules (gnu build linux-boot) (ice-9 match))
      (let* ((not-comma (char-set-complement (char-set #\,)))
             (command (linux-command-line))
             (agetty-specs (find-long-options "agetty.tty" command))
             (console-specs (filter (lambda (spec)
                                     (and (string-prefix? "tty" spec)
                                          (not (or
                                                (string-prefix? "tty0" spec)
                                                (string-prefix? "tty1" spec)
                                                (string-prefix? "tty2" spec)
                                                (string-prefix? "tty3" spec)
                                                (string-prefix? "tty4" spec)
                                                (string-prefix? "tty5" spec)
                                                (string-prefix? "tty6" spec)
                                                (string-prefix? "tty7" spec)
                                                (string-prefix? "tty8" spec)
                                                (string-prefix? "tty9" spec)))))
                                    (find-long-options "console" command)))
             (specs (append agetty-specs console-specs)))
        (match specs
         (() #f)
         ((spec _ ...)
          ;; Extract device name from first spec.
          (match (string-tokenize spec not-comma)
           ((device-name _ ...)
            device-name)))))))

I get 

$ ./pre-inst-env guix system reconfigure /etc/config.scm --fallback
...
guix system: error: exception caught while executing 'eval' on service 'root':
ERROR: Syntax error:
unknown location: unexpected syntax in form ()

(works totally fine with (@ (ice-9 match) match) instead)

Maybe (ice-9 match) was imported already and the use-module is ignored.

I get the same effect when I do the following in a new guile interpreter:

,use (ice-9 match)
(define match 42)
,use (ice-9 match)
(match #t (() #f))

So maybe there's a "match" variable captured from somewhere.  Icky...





reply via email to

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