unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 30355@debbugs.gnu.org
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	[thread overview]
Message-ID: <20180210230711.693d1452@scratchpost.org> (raw)
In-Reply-To: <877erlygas.fsf@gnu.org>

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	other threads:[~2018-02-10 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05  8:15 [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services Danny Milosavljevic
2018-02-09 13:51 ` Ludovic Courtès
2018-02-09 19:49   ` Danny Milosavljevic
2018-02-09 22:00     ` Ludovic Courtès
2018-02-10 22:07       ` Danny Milosavljevic [this message]
2018-02-13 22:04         ` Ludovic Courtès

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=20180210230711.693d1452@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=30355@debbugs.gnu.org \
    --cc=ludo@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).