From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#22588: root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY Date: Mon, 08 Feb 2016 17:48:19 +0100 Message-ID: <87pow7cfn0.fsf@gnu.org> References: <874mdk2p40.fsf@netris.org> <87r3gnilmk.fsf@gnu.org> <87twljjorf.fsf@netris.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSqJC-0006sE-51 for bug-guix@gnu.org; Mon, 08 Feb 2016 13:13:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSqJ6-0000Jx-Pu for bug-guix@gnu.org; Mon, 08 Feb 2016 13:13:10 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:51225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSqJ6-0000Jq-Nb for bug-guix@gnu.org; Mon, 08 Feb 2016 13:13:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aSqJ6-0000fV-Lc for bug-guix@gnu.org; Mon, 08 Feb 2016 13:13:04 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87twljjorf.fsf@netris.org> (Mark H. Weaver's message of "Mon, 08 Feb 2016 08:49:24 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Mark H Weaver Cc: 22588@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mark H Weaver skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: [...] >> Currently there=E2=80=99s no Bash in the initrd. Should we add one? Our >> =E2=80=98bash-static=E2=80=99 package takes 1.4 MiB (I don=E2=80=99t thi= nk we can make it >> smaller.) > > I'm not sure it would help much without also adding 'coreutils'. Good point. >> Another idea that comes to mind: what about providing a =E2=80=9Cshell= =E2=80=9D language >> in Guile? It would automatically tokenize what the user types in and >> convert it to (system* =E2=80=A6), plus it would have a few built-in com= mands >> like =E2=80=98cd=E2=80=99 and =E2=80=98ls=E2=80=99. > > I like the idea of having something like this in Guile, but I'm not sure > we should rush to implement a half-baked solution. OTOH, hacking it is very tempting, like: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use (guix build bournish) scheme@(guile-user)> ,bournish Happy hacking with Bournish! To switch back, type `,L scheme'. bournish@(guile-user)> ls . gnu-dist.go r-build-system.go=20=20= =20=20=20=20=20=20=20 .. gnu-dist.scm r-build-system.scm=20= =20=20=20=20=20=20=20 activation.scm~ gnu-dist.scm~ relocate.scm~=20=20=20= =20=20=20=20=20=20=20=20=20=20 bournish.scm gnu.scm~ rpath.go=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 bournish.scm~ graft.go rpath.scm=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 cmake-build-system.go graft.scm rpath.scm~=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 cmake-build-system.scm graft.scm~ ruby-build-system.go=20= =20=20=20=20=20 cvs.go graft.scm.115 ruby-build-system.scm= =20=20=20=20=20 cvs.scm graft.scm.bak ruby-build-system.scm.o= rig download.go gremlin.go ruby-build-system.scm.r= ej=20 download.scm gremlin.scm store-copy.go=20=20=20= =20=20=20=20=20=20=20=20=20=20 download.scm~ gremlin.scm~ store-copy.scm=20=20=20= =20=20=20=20=20=20=20=20=20 download.scm.bak haskell-build-system.go store-copy.scm~=20=20= =20=20=20=20=20=20=20=20=20 emacs-build-system.go haskell-build-system.scm svn.go=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 emacs-build-system.scm http.scm~ svn.scm=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 emacs-utils.go install.scm~ syscalls.go=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 emacs-utils.scm linux-initrd.scm~ syscalls.scm=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 ftp.scm~ perl-build-system.go syscalls.scm~=20=20=20= =20=20=20=20=20=20=20=20=20=20 git.go perl-build-system.scm union.go=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 git.scm perl-build-system.scm~ union.scm=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 git.scm~ profile.go union.scm~=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 glib-or-gtk-build-system.gprofile.scm~ url.scm~=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 glib-or-gtk-build-system.sprofiles.go utils.go=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 gnome-build-system.scm profiles.scm utils.scm=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 gnome-build-system.scm~ profiles.scm~ utils.scm~=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 gnu-build-system.go pull.go vm.scm~=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 gnu-build-system.scm pull.scm waf-build-system.go=20= =20=20=20=20=20=20 gnu-build-system.scm~ pull.scm~ waf-build-system.scm=20= =20=20=20=20=20 gnu-build-system.scm.bak python-build-system.go=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 gnu-cross-build.scm~ python-build-system.scm=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 bournish@(guile-user)> cd / bournish@(guile-user)> pwd $2 =3D "/" bournish@(guile-user)> echo $PATH $LANGUAGE $3 =3D ("/home/ludo/soft/bin:/home/ludo/.opam/system/bin:/home/ludo/.guix-p= rofile/bin:/home/ludo/.guix-profile/sbin:/run/setuid-programs:/run/current-= system/profile/bin:/run/current-system/profile/sbin" "eo") bournish@(guile-user)> touch --version touch (GNU coreutils) 8.24 Copyright =C2=A9 2015 Free Software Foundation, Inc. =C4=88i tiu estas libera programaro: vi rajtas =C4=9Din =C5=9Dan=C4=9Di kaj= redistribui. La =C4=9Dusta permesilo estas GPLv3+: GNU GPL versio 3 a=C5=AD sekva; por la kompleta (angla) teksto vidu . =C4=88i tiu programaro ne garantiatas, ene de la limoj de la le=C4=9Do. Verkita de Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie kaj Randy Smith. $4 =3D 0 bournish@(guile-user)> ,L scheme Happy hacking with Scheme! To switch back, type `,L bournish'. --8<---------------cut here---------------end--------------->8--- :-) The point is, if we can allow users to avoid typing in parentheses and long procedure names and quoted argument lists when all they want is to run fsck, we should do that. > When we have something decent along the lines of Scsh, then > definitely! Scsh makes it super easy to deal with Unix processes, redirections, and all that (it would be awesome to use it on the build side), but AFAIK it doesn=E2=80=99t try to provide a Bourne-like interface, which is what we ne= ed here. So, WDYT? :-) Ludo=E2=80=99. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline; filename=bournish.scm Content-Transfer-Encoding: quoted-printable Content-Description: Bournish! ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2016 Ludovic Court=C3=A8s ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (guix build bournish) #:use-module (system base language) #:use-module (system base compile) #:use-module (system repl command) #:use-module (system repl common) #:use-module (ice-9 rdelim) #:use-module (ice-9 match) #:use-module (ice-9 ftw) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%bournish-language)) (define (expand-variable str) ;; XXX: No support for "${VAR}". (if (string-prefix? "$" str) (or (getenv (string-drop str 1)) "") str)) (define* (display-tabulated lst #:key (columns 3) (column-width (/ 78 columns))) "Display the list of string LST in COLUMNS columns of COLUMN-WIDTH characters." (define len (length lst)) (define pad (if (zero? (modulo len columns)) 0 columns)) (define items-per-column (quotient (+ len pad) columns)) (define items (list->vector lst)) (let loop ((indexes (unfold (cut >=3D <> columns) (cut * <> items-per-column) 1+ 0))) (unless (>=3D (first indexes) items-per-column) (for-each (lambda (index) (let ((item (if (< index len) (vector-ref items index) ""))) (display (string-pad-right item column-width)))) indexes) (newline) (loop (map 1+ indexes))))) (define builtin-ls (case-lambda (() (display-tabulated (scandir "."))) (files (let ((files (filter (lambda (file) (catch 'system-error (lambda () (lstat file)) (lambda args (let ((errno (system-error-errno args))) (format (current-error-port) "~a: ~a~%" file (strerror errno)) #f)))) files))) (display-tabulated files))))) (define %not-colon (char-set-complement (char-set #\:))) (define (executable-path) (match (getenv "PATH") (#f '()) (str (string-tokenize str %not-colon)))) (define (read-bournish port env) (match (map expand-variable (string-tokenize (read-line port))) (("echo" strings ...) `',strings) (("cd" dir) `(chdir ,dir)) (("pwd") `(getcwd)) (("ls" args ...) `((@@ (guix build bournish) builtin-ls) ,@args)) (("which" command) `(search-path ((@@ (guix build bournish) executable-path)) ,command)) (("help" _ ...) (display "\ Hello, this is Bournish, a minimal Bourne-like shell in Guile! The shell is good enough to navigate the file system and run commands but n= ot much beyond that. It is meant to be used as a rescue shell in the initial = RAM disk and is probably not very useful apart from that. It has a few built-in commands such as 'ls' and 'cd'; it lacks globbing, pipes---everything.\n")) ((command args ...) (let ((command (if (string-prefix? "\\" command) (string-drop command 1) command))) `(system* ,command ,@args))))) (define %bournish-language (let ((scheme (lookup-language 'scheme))) (make-language #:name 'bournish #:title "Bournish" #:reader read-bournish #:compilers (language-compilers scheme) #:decompilers (language-decompilers scheme) #:evaluator (language-evaluator scheme) #:printer (language-printer scheme) #:make-default-environment (language-make-default-environment scheme)))) ;; XXX: ",L bournish" won't work unless we call our module (language bourni= sh ;; spec), which is kinda annoying, so provide another meta-command. (define-meta-command ((bournish guix) repl) "bournish Switch to the Bournish language." (let ((current (repl-language repl))) (format #t "Happy hacking with ~a! To switch back, type `,L ~a'.\n" (language-title %bournish-language) (language-name current)) (current-language %bournish-language) (set! (repl-language repl) %bournish-language))) --=-=-=--