From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 05 03:16:12 2018 Received: (at submit) by debbugs.gnu.org; 5 Feb 2018 08:16:12 +0000 Received: from localhost ([127.0.0.1]:57690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eibwh-000536-Rp for submit@debbugs.gnu.org; Mon, 05 Feb 2018 03:16:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eibwg-00052u-MK for submit@debbugs.gnu.org; Mon, 05 Feb 2018 03:16:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eibwZ-0008EH-SH for submit@debbugs.gnu.org; Mon, 05 Feb 2018 03:16:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42589) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eibwZ-0008E9-PI for submit@debbugs.gnu.org; Mon, 05 Feb 2018 03:16:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eibwX-00046t-TT for guix-patches@gnu.org; Mon, 05 Feb 2018 03:16:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eibwT-0008BR-Ov for guix-patches@gnu.org; Mon, 05 Feb 2018 03:16:01 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:47450) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eibwT-0008Ae-EJ for guix-patches@gnu.org; Mon, 05 Feb 2018 03:15:57 -0500 Received: from dayas.3.home (77.118.206.253.wireless.dyn.drei.com [77.118.206.253]) by dd26836.kasserver.com (Postfix) with ESMTPSA id B798B33602D0; Mon, 5 Feb 2018 09:15:55 +0100 (CET) From: Danny Milosavljevic To: guix-patches@gnu.org Subject: [PATCH] services: agetty: Make tty optional and add agetty instance to base services. Date: Mon, 5 Feb 2018 09:15:53 +0100 Message-Id: <20180205081553.5930-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.15.1 Tags: patch X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) * gnu/system/install.scm (agetty-default-service): Delete variable. (beaglebone-black-installation-os): Do not specify tty. (a20-olinuxino-lime-installation-os): Do not specify tty. (a20-olinuxino-lime2-emmc-installation-os): Do not specify tty. (a20-olinuxino-micro-installation-os): Do not specify tty. (banana-pi-m2-ultra-installation-os): Do not specify tty. (nintendo-nes-classic-edition-installation-os): Do not specify tty. (embedded-installation-os): Move agetty-service instantiation to... * gnu/services/base.scm (%base-services): ...here. (default-serial-port): New variable. (agetty-shepherd-service): Make tty optional, default to the above. * doc/guix.texi (agetty-configuration): Update "tty" documentation. --- doc/guix.texi | 15 +++++++++- gnu/services/base.scm | 77 ++++++++++++++++++++++++++++++++++++++++---------- gnu/system/install.scm | 37 ++++++++---------------- 3 files changed, 88 insertions(+), 41 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2b27a675c..4e5d9e33f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9621,7 +9621,20 @@ man page for more information. @item @code{tty} The name of the console this agetty runs on, as a string---e.g., -@code{"ttyS0"}. This argument is mandatory. +@code{"ttyS0"}. This argument is optional, it will default to +a reasonable default serial port used by Linux. + +For this, if there is a value for an option "agetty.tty" in the Linux +command line, agetty will extract the device name of the serial port +from it and use that. + +If not and if there is a value for an option "console" with a tty in +the Linux command line, agetty will extract the device name of the +serial port from it and use that. + +In both cases, agetty will leave the other serial device settings +(baud rate etc) alone - in the hope that Linux pinned them to the +correct values. @item @code{baud-rate} (default: @code{#f}) A string containing a comma-separated list of one or more baud rates, in diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 8e30bcd34..8e740bf6c 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -817,7 +817,7 @@ the message of the day, among other things." agetty-configuration? (agetty agetty-configuration-agetty ; (default util-linux)) - (tty agetty-configuration-tty) ;string + (tty agetty-configuration-tty) ;string | #f (term agetty-term ;string | #f (default #f)) (baud-rate agetty-baud-rate ;string | #f @@ -890,6 +890,42 @@ the message of the day, among other things." ;;; (default #f)) ) +(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) + (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)))) + (filter + (lambda (spec) + (string-prefix? "tty" spec)) + (find-long-options "console" command)))) + (specs (append agetty-specs console-specs)) + (spec (if (null? specs) + #f + (car specs)))) + (and spec + ;; Extract device name. + (car (string-tokenize spec not-comma)))))) + (define agetty-shepherd-service (match-lambda (($ agetty tty term baud-rate auto-login @@ -901,7 +937,7 @@ the message of the day, among other things." (list (shepherd-service (documentation "Run agetty on a tty.") - (provision (list (symbol-append 'term- (string->symbol tty)))) + (provision (list (symbol-append 'term- (string->symbol (or tty "auto"))))) ;; Since the login prompt shows the host name, wait for the 'host-name' ;; service to be done. Also wait for udev essentially so that the tty @@ -946,6 +982,9 @@ the message of the day, among other things." ('always "--local-line=always") ('never "-local-line=never"))) #~()) + #$@(if tty + #~() + #~("--keep-baud")) #$@(if extract-baud? #~("--extract-baud") #~()) @@ -1009,7 +1048,7 @@ the message of the day, among other things." #$@(if login-pause? #~("--login-pause") #~()) - #$tty + #$(or tty (default-serial-port)) #$@(if baud-rate #~(#$baud-rate) #~()) @@ -1058,18 +1097,21 @@ the tty to run, among other things." ;; text is not lost in the middle of kernel messages (XXX). (requirement '(user-processes host-name udev)) - (start #~(make-forkexec-constructor - (list #$(file-append mingetty "/sbin/mingetty") - "--noclear" #$tty - #$@(if auto-login - #~("--autologin" #$auto-login) - #~()) - #$@(if login-program - #~("--loginprog" #$login-program) - #~()) - #$@(if login-pause? - #~("--loginpause") - #~())))) + (start #~(let ((tty #$(default-serial-port))) + (if tty + (make-forkexec-constructor + (list #$(file-append mingetty "/sbin/mingetty") + "--noclear" #$tty + #$@(if auto-login + #~("--autologin" #$auto-login) + #~()) + #$@(if login-program + #~("--loginprog" #$login-program) + #~()) + #$@(if login-pause? + #~("--loginpause") + #~()))) + (const #f)))) ; never start. (stop #~(make-kill-destructor))))))) (define mingetty-service-type @@ -2012,6 +2054,11 @@ This service is not part of @var{%base-services}." (cons tty %default-console-font)) '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) + (agetty-service (agetty-configuration + (extra-options '("-L")) ; no carrier detect + (term "vt100") + (tty #f))) ; automatic + (mingetty-service (mingetty-configuration (tty "tty1"))) (mingetty-service (mingetty-configuration diff --git a/gnu/system/install.scm b/gnu/system/install.scm index e4b2e8237..db06b7a52 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -381,19 +381,10 @@ You have been warned. Thanks for being so brave.\x1b[0m nvi ;:wq! %base-packages)))) -(define* (agetty-default-service #:optional (tty "ttyS0")) - "Return an agetty-service on the given TTY" - (agetty-service (agetty-configuration - (extra-options '("-L")) - (baud-rate "115200") - (term "vt100") - (tty tty)))) - -(define* (embedded-installation-os bootloader bootloader-target tty +(define* (embedded-installation-os bootloader bootloader-target #:key (extra-modules '())) "Return an installation os for embedded systems. The initrd gets the extra modules EXTRA-MODULES. -A getty is provided on TTY. The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." (operating-system (inherit installation-os) @@ -404,43 +395,39 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET." (initrd (lambda (fs . rest) (apply base-initrd fs #:extra-modules extra-modules - rest))) - (services (cons* (agetty-default-service tty) - (operating-system-user-services installation-os))))) + rest))))) (define beaglebone-black-installation-os (embedded-installation-os u-boot-beaglebone-black-bootloader "/dev/sda" - "ttyO0" #:extra-modules ;; This module is required to mount the sd card. '("omap_hsmmc"))) - (define a20-olinuxino-lime-installation-os (embedded-installation-os u-boot-a20-olinuxino-lime-bootloader - "/dev/mmcblk0" ; SD card storage - "ttyS0")) + ;; SD card storage + "/dev/mmcblk0")) (define a20-olinuxino-lime2-emmc-installation-os (embedded-installation-os u-boot-a20-olinuxino-lime2-bootloader - "/dev/mmcblk1" ; eMMC storage - "ttyS0")) + ;; eMMC storage + "/dev/mmcblk1")) (define a20-olinuxino-micro-installation-os (embedded-installation-os u-boot-a20-olinuxino-micro-bootloader - "/dev/mmcblk0" ; SD card storage - "ttyS0")) + ;; SD card storage + "/dev/mmcblk0")) (define banana-pi-m2-ultra-installation-os (embedded-installation-os u-boot-banana-pi-m2-ultra-bootloader - "/dev/mmcblk1" ; eMMC storage - "ttyS0")) + ;; eMMC storage + "/dev/mmcblk1")) (define nintendo-nes-classic-edition-installation-os (embedded-installation-os u-boot-nintendo-nes-classic-edition-bootloader - "/dev/mmcblk0" ; SD card (solder it yourself) - "ttyS0")) + ;; SD card storage (solder it yourself) + "/dev/mmcblk0")) ;; Return the default os here so 'guix system' can consume it directly. installation-os From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 09 08:51:15 2018 Received: (at 30355) by debbugs.gnu.org; 9 Feb 2018 13:51:15 +0000 Received: from localhost ([127.0.0.1]:34784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek959-0002P2-HK for submit@debbugs.gnu.org; Fri, 09 Feb 2018 08:51:15 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:47772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek958-0002Ot-Em for 30355@debbugs.gnu.org; Fri, 09 Feb 2018 08:51:14 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D2E421124E; Fri, 9 Feb 2018 14:51:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jf_jugDROUeW; Fri, 9 Feb 2018 14:51:13 +0100 (CET) Received: from ribbon (unknown [193.50.110.130]) by hera.aquilenet.fr (Postfix) with ESMTPSA id BD85D1119B; Fri, 9 Feb 2018 14:51:12 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Danny Milosavljevic Subject: Re: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services. References: <20180205081553.5930-1-dannym@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 21 =?utf-8?Q?Pluvi=C3=B4se?= an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 09 Feb 2018 14:51:12 +0100 In-Reply-To: <20180205081553.5930-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Mon, 5 Feb 2018 09:15:53 +0100") Message-ID: <87d11e1dbj.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30355 Cc: 30355@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hi, Danny Milosavljevic skribis: > * gnu/system/install.scm (agetty-default-service): Delete variable. > (beaglebone-black-installation-os): Do not specify tty. > (a20-olinuxino-lime-installation-os): Do not specify tty. > (a20-olinuxino-lime2-emmc-installation-os): Do not specify tty. > (a20-olinuxino-micro-installation-os): Do not specify tty. > (banana-pi-m2-ultra-installation-os): Do not specify tty. > (nintendo-nes-classic-edition-installation-os): Do not specify tty. > (embedded-installation-os): Move agetty-service instantiation to... > * gnu/services/base.scm (%base-services): ...here. > (default-serial-port): New variable. > (agetty-shepherd-service): Make tty optional, default to the above. > * doc/guix.texi (agetty-configuration): Update "tty" documentation. I would prefer the install.scm part to be a separate patch, if that=E2=80= =99s not too much of a burden for you. I have a few minor comments: > @item @code{tty} > The name of the console this agetty runs on, as a string---e.g., > -@code{"ttyS0"}. This argument is mandatory. > +@code{"ttyS0"}. This argument is optional, it will default to > +a reasonable default serial port used by Linux. s/Linux/the kernel Linux/ (to avoid ambiguities=E2=80=A6) > +For this, if there is a value for an option "agetty.tty" in the Linux > +command line, agetty will extract the device name of the serial port > +from it and use that. > + > +If not and if there is a value for an option "console" with a tty in > +the Linux command line, agetty will extract the device name of the > +serial port from it and use that. @code{agetty.tty}, @code{console}, etc. Write =E2=80=9Ckernel command line=E2=80=9D instead of =E2=80=9CLinux comma= nd line=E2=80=9D. > +In both cases, agetty will leave the other serial device settings > +(baud rate etc) alone - in the hope that Linux pinned them to the > +correct values. s/etc/etc./ s/alone - in the hope/alone---in the hope/ (The three hyphens map to an em dash in the output.) > +(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=3Ddevice,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) > + (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)= ))) > + (filter > + (lambda (spec) > + (string-prefix? "tty" spec)) > + (find-long-options "console" comman= d)))) Please make that a single =E2=80=98filter=E2=80=99 or =E2=80=98remove=E2=80= =99 call, for clarity. > + (specs (append agetty-specs console-specs)) > + (spec (if (null? specs) > + #f > + (car specs)))) > + (and spec > + ;; Extract device name. > + (car (string-tokenize spec not-comma)))))) Rather: (match (append agetty-specs console-specs) (() #f) ((spec _ ...) (string-tokenize spec not-comma))) The rest LGTM. OK to push with these changes! Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 09 14:49:21 2018 Received: (at 30355) by debbugs.gnu.org; 9 Feb 2018 19:49:21 +0000 Received: from localhost ([127.0.0.1]:35696 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekEfh-0004Si-14 for submit@debbugs.gnu.org; Fri, 09 Feb 2018 14:49:21 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:45422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekEfe-0004SX-Os for 30355@debbugs.gnu.org; Fri, 09 Feb 2018 14:49:19 -0500 Received: from localhost (178.113.144.132.wireless.dyn.drei.com [178.113.144.132]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 06C063360336; Fri, 9 Feb 2018 20:49:16 +0100 (CET) Date: Fri, 9 Feb 2018 20:49:12 +0100 From: Danny Milosavljevic To: ludo@gnu.org (Ludovic =?ISO-8859-1?Q?Court=E8s?=) Subject: Re: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services. Message-ID: <20180209204912.379ddae7@scratchpost.org> In-Reply-To: <87d11e1dbj.fsf@gnu.org> References: <20180205081553.5930-1-dannym@scratchpost.org> <87d11e1dbj.fsf@gnu.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 30355 Cc: 30355@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > Please make that a single =E2=80=98filter=E2=80=99 or =E2=80=98remove=E2= =80=99 call, for clarity. OK! > Rather: >=20 > (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=3Ddevice,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))))))) Works just fine if I execute it in a running system, mind you... From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 09 17:00:41 2018 Received: (at 30355) by debbugs.gnu.org; 9 Feb 2018 22:00:41 +0000 Received: from localhost ([127.0.0.1]:35812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekGim-0008LP-Vx for submit@debbugs.gnu.org; Fri, 09 Feb 2018 17:00:41 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:51080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekGik-0008LH-KE for 30355@debbugs.gnu.org; Fri, 09 Feb 2018 17:00:39 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 1CE0811387; Fri, 9 Feb 2018 23:00:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LTz2uHZIag_s; Fri, 9 Feb 2018 23:00:37 +0100 (CET) Received: from ribbon (vpn-0-27.aquilenet.fr [IPv6:2a0c:e300:4:27::]) by hera.aquilenet.fr (Postfix) with ESMTPSA id E177210ED3; Fri, 9 Feb 2018 23:00:36 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Danny Milosavljevic Subject: Re: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services. References: <20180205081553.5930-1-dannym@scratchpost.org> <87d11e1dbj.fsf@gnu.org> <20180209204912.379ddae7@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 21 =?utf-8?Q?Pluvi=C3=B4se?= an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 09 Feb 2018 23:00:27 +0100 In-Reply-To: <20180209204912.379ddae7@scratchpost.org> (Danny Milosavljevic's message of "Fri, 9 Feb 2018 20:49:12 +0100") Message-ID: <877erlygas.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30355 Cc: 30355@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Danny Milosavljevic skribis: >> Please make that a single =E2=80=98filter=E2=80=99 or =E2=80=98remove=E2= =80=99 call, for clarity. > > OK! > >> Rather: >>=20 >> (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=3Ddevice,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" sp= ec) > (string-prefix? "tty1" sp= ec) > (string-prefix? "tty2" sp= ec) > (string-prefix? "tty3" sp= ec) > (string-prefix? "tty4" sp= ec) > (string-prefix? "tty5" sp= ec) > (string-prefix? "tty6" sp= ec) > (string-prefix? "tty7" sp= ec) > (string-prefix? "tty8" sp= ec) > (string-prefix? "tty9" sp= ec))))) > (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 =E2=80=98use-modules=E2=80=99 form at the top so you have: (use-modules (gnu build linux-boot) (ice-9 match)) The inner =E2=80=98use-modules=E2=80=99 you had cannot work because the exp= ander doesn=E2=80=99t =E2=80=9Csee=E2=80=9D it when compiling, and thus the =E2=80=98match=E2=80= =99 macro is missing at expansion time (thus the compiler assumes that code is calling a =E2=80=98m= atch=E2=80=99 procedure that=E2=80=99ll 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=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 17:07:17 2018 Received: (at 30355) by debbugs.gnu.org; 10 Feb 2018 22:07:17 +0000 Received: from localhost ([127.0.0.1]:37323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekdIj-0005Hp-8n for submit@debbugs.gnu.org; Sat, 10 Feb 2018 17:07:17 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:40556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekdIh-0005Hf-Mn for 30355@debbugs.gnu.org; Sat, 10 Feb 2018 17:07:16 -0500 Received: from localhost (178.113.144.132.wireless.dyn.drei.com [178.113.144.132]) by dd26836.kasserver.com (Postfix) with ESMTPSA id DECBB3360071; Sat, 10 Feb 2018 23:07:13 +0100 (CET) Date: Sat, 10 Feb 2018 23:07:11 +0100 From: Danny Milosavljevic To: ludo@gnu.org (Ludovic =?ISO-8859-1?Q?Court=E8s?=) Subject: Re: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services. Message-ID: <20180210230711.693d1452@scratchpost.org> In-Reply-To: <877erlygas.fsf@gnu.org> References: <20180205081553.5930-1-dannym@scratchpost.org> <87d11e1dbj.fsf@gnu.org> <20180209204912.379ddae7@scratchpost.org> <877erlygas.fsf@gnu.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 30355 Cc: 30355@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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... From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 13 17:04:17 2018 Received: (at 30355) by debbugs.gnu.org; 13 Feb 2018 22:04:17 +0000 Received: from localhost ([127.0.0.1]:41888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eligT-0003Gn-7R for submit@debbugs.gnu.org; Tue, 13 Feb 2018 17:04:17 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:44192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eligP-0003Gb-Jz for 30355@debbugs.gnu.org; Tue, 13 Feb 2018 17:04:13 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A0B0211489; Tue, 13 Feb 2018 23:04:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XrxQtcvrd1UY; Tue, 13 Feb 2018 23:04:11 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 8083EDA91; Tue, 13 Feb 2018 23:04:11 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Danny Milosavljevic Subject: Re: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services. References: <20180205081553.5930-1-dannym@scratchpost.org> <87d11e1dbj.fsf@gnu.org> <20180209204912.379ddae7@scratchpost.org> <877erlygas.fsf@gnu.org> <20180210230711.693d1452@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 =?utf-8?Q?Pluvi=C3=B4se?= an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 13 Feb 2018 23:04:10 +0100 In-Reply-To: <20180210230711.693d1452@scratchpost.org> (Danny Milosavljevic's message of "Sat, 10 Feb 2018 23:07:11 +0100") Message-ID: <87bmgsv95x.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30355 Cc: 30355@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Heya, Danny Milosavljevic skribis: > 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=3Ddevice,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)) [...] > (match specs > (() #f) > ((spec _ ...) > ;; Extract device name from first spec. > (match (string-tokenize spec not-comma) > ((device-name _ ...) > device-name))))))) > > I get=20 > > $ ./pre-inst-env guix system reconfigure /etc/config.scm --fallback > ... > guix system: error: exception caught while executing 'eval' on service 'r= oot': > ERROR: Syntax error: > unknown location: unexpected syntax in form () That=E2=80=99s a sign that the outermost =E2=80=98match=E2=80=99 wasn=E2=80= =99t macro-expanded, hence the error about (). I got it: that=E2=80=99s because this gexp is spliced in a non-top-level context. The end result is something like: (let ((foo bar) (baz (begin (use-modules =E2=80=A6) =E2=80=A6))) =E2=80=A6) and the =E2=80=98use-modules=E2=80=99 there doesn=E2=80=99t have the desire= d effect. The fix is to remove this =E2=80=98use-modules=E2=80=99 form and instead to= pass the modules as the =E2=80=98modules=E2=80=99 field of =E2=80=98shepherd-service= =E2=80=99: (shepherd-service (modules '((ice-9 match) =E2=80=A6)) ;; =E2=80=A6 ) Does that work for you? Sorry for overlooking this before! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 10 16:12:49 2019 Received: (at control) by debbugs.gnu.org; 10 Feb 2019 21:12:49 +0000 Received: from localhost ([127.0.0.1]:42853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gswPB-0003mc-Ds for submit@debbugs.gnu.org; Sun, 10 Feb 2019 16:12:49 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:51564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gswP9-0003mR-Rk for control@debbugs.gnu.org; Sun, 10 Feb 2019 16:12:48 -0500 Received: from localhost (178.113.144.125.wireless.dyn.drei.com [178.113.144.125]) by dd26836.kasserver.com (Postfix) with ESMTPSA id ECDED33602DD for ; Sun, 10 Feb 2019 22:12:46 +0100 (CET) Date: Sun, 10 Feb 2019 22:12:43 +0100 From: Danny Milosavljevic To: Message-ID: <20190210221243.39823f05@scratchpost.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/ZiYQhnRiAwXo+4f/.qI0mL5"; protocol="application/pgp-signature" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 30355 Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [85.13.145.193 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject 0.0 TVD_SPACE_RATIO No description available. X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) --Sig_/ZiYQhnRiAwXo+4f/.qI0mL5 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable close 30355 --Sig_/ZiYQhnRiAwXo+4f/.qI0mL5 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlxgk8sACgkQ5xo1VCww uqUCmgf8DQXH3RpXMNtDuzGnTlygSmB8nIDIR0mn2DN3WuHj0loUGsu2rjqK1ZAZ glRVlWhHJq/Hw3W6tVDNVM5qjTHMNjQBt2j+KF49SrB2Xy23GddDWxyTAnK6iRnq 0JV7MzAyppAw8dglJfcJ30HCvjaCCC2Iu896BK/k7pDwiZkPb4QFjpvtDJm/NUId +NQXSKRz/e5/G2wptR9GaIFRK4+yWSPBQ5V9vxPi1uUtah/ncmGV37tSj/PHktde VivWc+N356XaJph2TLueuZ9HyYQNLXsbGIdnmGN2sAjwr1JIZtqFQxzSrT9QEK0D kIN3yUSEl+489al1+QKcEIT88VPSUg== =j5ay -----END PGP SIGNATURE----- --Sig_/ZiYQhnRiAwXo+4f/.qI0mL5-- From unknown Sat Sep 06 09:00:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 11 Mar 2019 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator