unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 30355@debbugs.gnu.org
Subject: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services.
Date: Fri, 09 Feb 2018 23:00:27 +0100	[thread overview]
Message-ID: <877erlygas.fsf@gnu.org> (raw)
In-Reply-To: <20180209204912.379ddae7@scratchpost.org> (Danny Milosavljevic's message of "Fri, 9 Feb 2018 20:49:12 +0100")

Danny Milosavljevic <dannym@scratchpost.org> skribis:

>> Please make that a single ‘filter’ or ‘remove’ call, for clarity.
>
> OK!
>
>> Rather:
>> 
>>   (match (append agetty-specs console-specs)
>>     (() #f)
>>     ((spec _ ...)
>>      (string-tokenize spec not-comma)))
>
> Crashes boot process with form error ().
>
> I can't get "match" to work at all in this location.
>
> It works fine when I start guile on a normally running system, but
> in this initrd guile thing, (use-modules (ice-9 match)) doesn't help
> either.  What does help is (@ (ice-9 match) match).  Why?
>
> (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))
>       (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)))
>         (use-modules (ice-9 match))
>         (match specs
>          (() #f) ;        form error here
>          ((spec _ ...) ; underscore is undefined
>           ;; Extract device name from first spec.
>           (match (string-tokenize spec not-comma)
>            ((device-name _ ...) ; underscore is undefined
>             device-name)))))))

Try moving the ‘use-modules’ form at the top so you have:

  (use-modules (gnu build linux-boot) (ice-9 match))

The inner ‘use-modules’ you had cannot work because the expander doesn’t
“see” it when compiling, and thus the ‘match’ macro is missing at
expansion time (thus the compiler assumes that code is calling a ‘match’
procedure that’ll be define at run time.)  However it can work when you
interpret it instead of compiling because the compiler will have
expansion and execution intermingled.

HTH,
Ludo’.

  reply	other threads:[~2018-02-09 22:01 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 [this message]
2018-02-10 22:07       ` Danny Milosavljevic
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=877erlygas.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=30355@debbugs.gnu.org \
    --cc=dannym@scratchpost.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).