From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bengt Richter Subject: Re: 01/01: services: Add =?utf-8?B?4oCY?= =?utf-8?B?L3Vzci9iaW4vZW524oCZ?= special file. Date: Mon, 9 Sep 2019 00:01:44 -0700 Message-ID: <20190909070144.GA5717@PhantoNv4ArchGx.localdomain> References: <20190906102509.28951.2772@vcs0.savannah.gnu.org> <20190906102510.002BE21324@vcs0.savannah.gnu.org> <87d0gdbtji.fsf@cbaines.net> <87mufhwhc6.fsf@nckx> <87d0gcgodz.fsf@devup.no> <8736h8uh05.fsf@elephly.net> <87h85m1lyp.fsf@gnu.org> Reply-To: Bengt Richter Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:35395) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7Dgj-0003Ko-QT for guix-devel@gnu.org; Mon, 09 Sep 2019 03:02:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7Dgh-0004qG-Ja for guix-devel@gnu.org; Mon, 09 Sep 2019 03:02:13 -0400 Content-Disposition: inline In-Reply-To: <87h85m1lyp.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org On +2019-09-09 00:07:10 +0200, Ludovic Court=C3=A8s wrote: > Hi, >=20 > Ricardo Wurmus skribis: >=20 > > Using a custom script with a /usr/bin/env shebang is pretty common. = You > > don=E2=80=99t need to be a power user for that, and certainly not a *= Guix* power > > user. >=20 > Like I wrote in and in the > message it refers to, although I was initially mildly reluctant to > having /usr/bin/env by default, I=E2=80=99ve come to think that lack of > /usr/bin/env is a gratuitous annoyance=E2=80=94not to me of course, but= to > newcomers as we=E2=80=99ve seen repeatedly, be they seasoned GNU/Linux = users or > not. > > With that in mind, adding /usr/bin/env by default is probably a good mo= ve. > Hi Ludo, I may be one of those (over-) seasoned (past best-before) users you menti= on :) -- but with all due respect, is this not a compromise of the fundamental idea of guix _transactional_ package management? Or did I misunderstand? I thought the idea was that each mod to the system drew one unique transaction-arc from current to next state (whether the mod was by guix install, guix pull, or guix whatever) -- with the ideal goal of being able to walk the graph transactionally back to any other state, with no loose ends. ISTM that the current state defining the behaviour of my system includes the various config files such as ~/.bash_profile and ~/.guix-profile and ~/.emacs.d/* and all the rest, that programs read to condition their beha= viour. Not only that, but the whole deep tree of references used -- including scripts and programs called in the body of scripts, not just in the hash-bang line. Does that not mean that, ideally :) the particular state of such referenced entities ought to be captured in a closure belonging to a particular generation, for that generation's sovereign use? Implementation optimization is another matter. Things that in practice don't change much could be shared COW entities, I guess? I certainly agree with the goal of being able to share scripts without manual changes, such as what a friend might attach to or include in an em= ail, or what one might copy/paste from a browser view of gitlab contents, etc. But not at the price of fundamental compromises :) Could emacs grow an "M-x pack-region-as" command to produce something that could be installed with guix install, automatically taking care of name collisions with existing foo to install foo-from-origin-mnemonic? Then modding your system would produce a proper generation and could be controlled. If there are no tools to do things safely with pure transactions the result will IME (doing it to myself :) be an unholy mess of unpredictable future error messages with no easy way to figure out what happened, and lots of rewrite work to make everything play nicely together for real. IMO "works" "most of the time" is not a good rationale for compromising fundamental principles. I see this as a version of the pythonic (see python -c 'import this') arg= ument that "pacticality beats purity". Yes it does, but IMO _only_ in emergenci= es -- because if left to persist, each emergency hack adds to an eventual rats-= nest of tangled dependencies for which there is no "revert" but painful manual an= alysis and re-implemention. BTW, is there a guixian version of "python -c import this" ? "guix descri= be this"? ;-) > Now, we can add a snippet in the manual with the =E2=80=98modify-servic= es=E2=80=99 trick > to remove /usr/bin/env. :-) >=20 > > The argument that /usr/bin/env could make software work by accident w= hen > > testing on a Guix System is not very convincing to me. We don=E2=80=99= t have > > /bin/sh or /usr/bin/env in the build environment. Software behaviour= is > > also affected by the presence of /usr, /lib, /bin, etc, and these can > > all exist at runtime. We assume that building in an isolated > > environment is usually sufficient; and yet we sometimes find that > > applications behave differently when run inside of containers > > (e.g. applications that call out to coreutils that are usually availa= ble > > in a normal system). >=20 > Yeah. >=20 > Well anyway, if we take a step back, we=E2=80=99re talking about a real= ly tiny > issue in the grand scheme of things, and it=E2=80=99s certainly not wor= th losing > our hair over it. :-) >=20 > Thanks, > Ludo=E2=80=99. > Here follows an example of a script one might receive in an email from a = friend ;-) What automation could be brought to bear to include this safely and trans= actionally into your system to try? As a tool that could be used by a sender or by t= he receiver. It shows unicode information about characters in its command line argumen= ts or piped in split by whitespace, e.g., (with control char for good measur= e :) Invoked like: unicode-info Ludovic Court=C3=A8s $(echo -e "\x07") "Ludovic": glyph codepoint .....int name... _L_ +U00004c 76 LATIN CAPITAL LETTER L =20 _u_ +U000075 117 LATIN SMALL LETTER U =20 _d_ +U000064 100 LATIN SMALL LETTER D =20 _o_ +U00006f 111 LATIN SMALL LETTER O =20 _v_ +U000076 118 LATIN SMALL LETTER V =20 _i_ +U000069 105 LATIN SMALL LETTER I =20 _c_ +U000063 99 LATIN SMALL LETTER C =20 "Court=C3=A8s": glyph codepoint .....int name... _C_ +U000043 67 LATIN CAPITAL LETTER C =20 _o_ +U00006f 111 LATIN SMALL LETTER O =20 _u_ +U000075 117 LATIN SMALL LETTER U =20 _r_ +U000072 114 LATIN SMALL LETTER R =20 _t_ +U000074 116 LATIN SMALL LETTER T =20 _=C3=A8_ +U0000e8 232 LATIN SMALL LETTER E WITH GRAVE =20 _s_ +U000073 115 LATIN SMALL LETTER S =20 "\a": glyph codepoint .....int name... _^G_ +U000007 7 ASCII bel, aka #\alarm I used /usr/bin/env in the hash-bang which let me use the -S option (which I wonder if guile couldn't be taught to emulate if called directly instead of via env, BTW) Sorry if this is an inappropriate way to pass on a jelly-bean... Regards, Bengt Richter Oh, gpl3+ on the following, forgot to edit it in ;-/ ------------------------------------------------ #!/usr/bin/env -S guile -e unicode-info -s !# (use-modules (ice-9 unicode)) (use-modules (ice-9 format)) (use-modules (ice-9 regex)) (use-modules (ice-9 rdelim)) ;;(use-modules (ice-9 textual-ports)) ;; 1 ! printf -v cc "\\\x%02x" {0..32};echo -ne "$cc"|od -a|c= ut -d ' ' -f2- ;; nul soh stx etx eot enq ack bel bs ht nl vt ff cr so si ;; dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us ;; sp ;; 0000041 ;;;; ctl-names from od -a -- see above ... emacs shell command to ca= pture names (define ctl-names (map cons (iota 33) (map match:substring (list-matches "[a-z]+" (string-append =20 "nul soh stx etx eot enq ack bel bs ht nl vt ff cr so si " "dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us sp " )= )))) (define (show-char c) (begin (let*((c_int (char->integer c)) (glyph_c (format #f "~:c" c))) (cond ((charformal-name c)) (glyph_a (if (not c_formal) "n/a" glyph_a)) (big_glyph (>=3D (string-length glyph_a) 4)) (glyph_out (if big_glyph "see->" glyph_a))) (begin (format #t ; glyph codepoint .....int name... =20 " ~4,a +U~6,'0X ~8,d ~a \n" glyph_out c_int c_int c_formal)))= )))))) (define (show-str s) (begin (format #t "\n~s:\n glyph codepoint .....int name...\n" s) (map show-char (string->list s)))) (define (strings-from-readlines p) (let lp ((line (read-delimited "\n" p 'concat)) (slist '())) (if (eof-object? line) slist (lp (read-delimited "\n" p 'concat) (append slist (map match:substring (list-matches "([ \t\f\n]*|[^ \t\= f\n]+)[\n]?" line))))))) (define (unicode-info args) (let*((as (cdr args)) (ss (if (pair? as) as (strings-from-readlines (current-input-port))))) (map show-str ss))) ------------------------------------------------