From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,NUMERIC_HTTP_ADDR autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27796 invoked from network); 4 Jan 2023 01:38:50 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 4 Jan 2023 01:38:50 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id D04CC4253D; Wed, 4 Jan 2023 11:38:44 +1000 (AEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by minnie.tuhs.org (Postfix) with ESMTPS id DA42942538 for ; Wed, 4 Jan 2023 11:38:40 +1000 (AEST) Received: by mail-pg1-f179.google.com with SMTP id q9so4332200pgq.5 for ; Tue, 03 Jan 2023 17:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20210112.gappssmtp.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=i4Z4F0QmlT/1A25Q3bGkiwhNjyO1FrQtFAT9nwca/cI=; b=L5zCzrYdM1BSeNfJj9LKSbrdfrGzA9pqbPXgcqMnoXwT8OQZNU9YEEYL+WbaKMzzUE C0qesVYIwqlYnsuHRlgakKQFoVLk8JVOGumWCklMFp5hPKiQe5mC1GmEEEamqrQISf70 E77Ju6Fmy49c5ojSOEj4g5+w0gq2xGL/vSk+GyBGuW1sUZ1DSpMYvnQoFj2Y2N8pKF2E W/SPoiegCneuObwWwMK9HfOYHu/fLBnsEaXmfmZ+gnwmPporN2WsljsIcWqf1Xq30Xo8 EoP3pVLuL7eCxHUel8lnZx63gT4mOludjbP7pLWu/5NTL2uv+TZ17HPM/1O7i8/9N58r ScwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i4Z4F0QmlT/1A25Q3bGkiwhNjyO1FrQtFAT9nwca/cI=; b=ufsDHj24/sUbiepExoFtnO+19t89t2vjyc/4OJjjuoReAN5YPUuGuhG46ECOyJ+v3v WejWHWiOoL5opeB2CDdO+1cjgVA8JGVTsSrT4ScZlIPU+9b7uLPeUqZD5tTBRCh5ICCE zqggbU2bfYVk0JX4k+mhywp1yqFUlfQn3A6rVQShNko1tjypMk2/lMGqcvlgm+mGzHBj AdPNJqHupL5YUcoAZeSOsdedfHMaOvJEYj84Bsn3CxWTEZKeJGsM/gO7kR/z81AWmv73 VkIZ/EqNIyR6jOIjEQfQN0LYXDIsn2vtap7TDHlTMEaw3/wdzpLKYMjcpCskbd4rZ14O PJbw== X-Gm-Message-State: AFqh2kpyZIMjmRQA8TYNZNSR63mcC9G7od81F0KQdNOtgYhhKMOAK5xs ysXn1I+Eu8D3AFiFVJXyQCEOPA== X-Google-Smtp-Source: AMrXdXuN/JnEyhnJXGqQ9tGKdHqHC6EtMb2uZ86JhE9xedNA6THp5trvxi+biRyTIwA827j+udKTng== X-Received: by 2002:a05:6a00:d1:b0:580:eb71:40f0 with SMTP id e17-20020a056a0000d100b00580eb7140f0mr40025763pfj.23.1672796260255; Tue, 03 Jan 2023 17:37:40 -0800 (PST) Received: from smtpclient.apple (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id c21-20020a621c15000000b00581498190efsm15197802pfc.161.2023.01.03.17.37.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2023 17:37:39 -0800 (PST) From: Bakul Shah Message-Id: <325DF7E4-37BE-4432-9447-0B392B57DC69@iitbombay.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_21F3989F-ED78-48AA-BDED-DA866273A418" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Date: Tue, 3 Jan 2023 17:37:28 -0800 In-Reply-To: To: ron minnich References: <20230103201900.oR1Qq%steffen@sdaoden.eu> X-Mailer: Apple Mail (2.3731.300.101.1.3) Message-ID-Hash: AUNM53HOO275KVTZ3PJOBUYS2WSOKD4L X-Message-ID-Hash: AUNM53HOO275KVTZ3PJOBUYS2WSOKD4L X-MailFrom: bakul@iitbombay.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: TUHS main list X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: A few comments on porting the Bourne shell List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --Apple-Mail=_21F3989F-ED78-48AA-BDED-DA866273A418 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I write shell one liners all the time[1]. Go is just too verbose for scripting. I use it for larger programs but = typically these don't start out as shell scripts. [1] In fact I use find (or zsh's **/*), xargs, grep, sort, uniq, field = picking often enough that I wish they were built-in a shell but I = haven't figured out a simple syntax for it as yet. > On Jan 3, 2023, at 3:03 PM, ron minnich wrote: >=20 > I apologize for this too long message, but context in this case = matters.=20 >=20 > tl;dr: I agree with the Go folks: past about 10 lines, write a = program. But not everybody will agree, as I learned with u-root. Many = people love shell programming. I never have. >=20 > u-root is a set of Go programs deployed on a couple million data = center systems at many companies, including Google. >=20 > u-root originally used a compile-on-demand model: type a command name, = if it's not in /ubin, it gets built. This was fast, in early Go, = typically 250 ms or so. And, in the early days of Go, the Go toolchain, = u-root, and all support source easily fit in a 16M SPI part. >=20 > The original scripting language for u-root was Go.=20 >=20 > There were two commands for this: script and builtin. script would run = Go fragments; builtin would take supplied commands and build a custom = shell with those built in. Each took 250ms to run. >=20 > script took what we called a 'Go fragment', wrapped it with boiler = plate, compiled it, and ran it.=20 > e.g. > script fmt.Printf("hi\n") > would build the program and run that code.=20 > So you could, e.g,, do math: > script fmt.Printf("%d\n", 6*7) >=20 > It could get complex: to see things about interfaces: > script 'ifaces, _ :=3D net.Interfaces() > for _, v :=3D range ifaces { > addrs, _ :=3D v.Addrs() > Printf("%v has %v", v, addrs) > }' >=20 > you'd get: > ip: {1 1500 lo up|loopback} has [127.0.0.1/8 = ::1/128] > ip: {5 1500 eth0 fa:42:2c:d4:0e:01 up|broadcast} has [172.17.0.2/16 = fe80::f842:2cff:fed4:e01/64] >=20 > The second command was called builtin. It did not work as other shells = do: it built a new shell for you. So, you type: > bulitin hi fmt.Printf("hi") there fmt.Printf("there\n") >=20 > builtin would convert the Go fragments to functions callable in the = u-root shell, build a private name space (on Linux or Plan 9 anyway), = rebuild the shell with those new functions, and at that point: > you type > hi > in the shell, and it types > hi > back. This was built in to your private shell in your private name = space. Once you left the shell, it was gone. > Again, this process of creating and starting the new shell always took = about 250 ms (in Go 1.2 that is). >=20 > I learned a lesson: people love their shell scripting languages. = Nobody wanted to script with Go. It made me sad, but that's how it = Go-es. >=20 > ron > p.s. the 'script' command is still available as an experimental u-root = command. Source mode is now independent: github.com/u-root/sourcery = >=20 >=20 > On Tue, Jan 3, 2023 at 2:35 PM Steffen Nurpmeso > wrote: >> Steve Nickolas wrote in >> >: >> |On Tue, 3 Jan 2023, Dan Cross wrote: >> |> Something I've noticed is that lots of people try to increase >> |> complexity to solve problems, and it rarely occurs to them to >> |> eliminate complexity to solve problems. Sometimes the reasons for = this >> |> are good; most of the time they are not. >> |> >> |> - Dan C. >> | >> |I think of the saying: "Perfection is not when there is nothing = left to=20 >> |add, but when there is nothing left to remove." >>=20 >> He (Exup=C3=A9ry) was then shot down. >>=20 >> I always seem to response this to that. >> Hmm, openpgp@ietf.org (to which i have = almost zero to add >> technically shall someone think that, nor do i want) lastly >>=20 >> |"Perfection is achieved not when there is nothing more to add but = when \ >> |there >> |is nothing left to take away" - Antoine de Saint-Exup=C3=A9ry. >>=20 >> He was then shot down. >>=20 >> But yes, he then really went missing. >>=20 >> The topic .. >> I do not miss times where suddenly a shell script breaks because >> ": > FILE" does not work (just recently 'realized from reading code >> of Paul Eggert of GNU/IANA TZ, "hey, > FILE" is of course >> sufficient!"), i fixed it via "printf '' > FILE" by then; whatever >> the reason. May it be bugs or (local) miscompilations, not >> detected due to missing unit tests and a too small user base. >>=20 >> Portable? If i find /usr/xpg4/bin i quickly add it to $PATH for >> the much better awk (but beware of documented double expansion >> issues) and the much much better sh(1). >> Some things just require that, noclobber I/O redirection (set -C) >> for example. (mktemp(1) is still not part of the POSIX standard.) >>=20 >> Besides i miss(ed) the history; the author of bmake (and >> verieexec) just last year asked me why i would use stty for >> a purpose ("(<&1 >/dev/null stty -a) 2>/dev/null") instead of >> simply using "[ -t 1 ]", and indeed, i found that as soon as BSD >> 4.1 and Research V7, but it surprised me. >> Without an oversight of the history and the lack of many systems >> to test, perl(1) was omnipresent and if only for OpenSSL and so >> using it for almost anything seemed save. >>=20 >> To love is not to look at one another: it is to look, >> together, in the same direction. Antoine de Saint-Exup=C3=A9ry. >>=20 >> A happy and healthy new Year 2023 is now overdue. >> Even Giants have to die, but with holding hands it can wait a bit >> longer, i hope. >> I wish that from Germany to all of you, and deliberately beyond >> NATO readership. >>=20 >> --steffen >> | >> |Der Kragenbaer, The moon bear, >> |der holt sich munter he cheerfully and one by one >> |einen nach dem anderen runter wa.ks himself off >> |(By Robert Gernhardt) --Apple-Mail=_21F3989F-ED78-48AA-BDED-DA866273A418 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
I write = shell one liners all the time[1].

Go is just = too verbose for scripting.  I use it for larger programs but = typically these don't start out as shell = scripts.

[1] In fact I use find = (or zsh's **/*),  xargs, grep, = sort, uniq, field picking often enough that I wish they were built-in a = shell but  I haven't figured out a simple syntax for it as = yet.

On Jan 3, 2023, = at 3:03 PM, ron minnich <rminnich@gmail.com> wrote:

I apologize = for this too long message, but context in this case = matters. 

tl;dr: I agree with the Go folks: past = about 10 lines, write a program. But not everybody will agree, as I = learned with u-root. Many people love shell programming. I never = have.

u-root is a set of Go programs deployed on a = couple million data center systems at many companies, including = Google.

u-root originally used a = compile-on-demand model: type a command name, if it's not in /ubin, it = gets built. This was fast, in early Go, typically 250 ms or so. And, in = the early days of Go, the Go toolchain, u-root, and all support = source easily fit in a 16M SPI part.

The = original scripting language for u-root was = Go. 

There were two commands for this: = script and builtin. script would run Go fragments; builtin would take = supplied commands and build a custom shell with those built = in. Each took 250ms to run.

script took = what we called a 'Go fragment', wrapped it with boiler plate, compiled = it, and ran it. 
e.g.
script = fmt.Printf("hi\n")
would build the program and run that = code. 
So you could, e.g,, do math:
script = fmt.Printf("%d\n", 6*7)

It could get = complex: to see things about interfaces:
script 'ifaces, _ :=3D = net.Interfaces()
for _, v :=3D range ifaces {
= addrs, _ :=3D v.Addrs()
Printf("%v has = %v", v, addrs)
}'

you'd = get:
ip: {1 1500 lo  up|loopback} has [127.0.0.1/8 ::1/128]
ip: {5 1500 eth0 = fa:42:2c:d4:0e:01 up|broadcast} has [172.17.0.2/16 = fe80::f842:2cff:fed4:e01/64]

The second = command was called builtin. It did not work as other shells do: it built = a new shell for you. So, you type:
bulitin hi = fmt.Printf("hi") there = fmt.Printf("there\n")

builtin would convert the = Go fragments to functions callable in the u-root shell, build a private = name space (on Linux or Plan 9 anyway), rebuild the shell with = those new functions, and at that point:
you = type
hi
in the shell, and it = types
hi
back. This was built in to your private = shell in your private name space. Once you left the shell, it was = gone.
Again, this process of creating and starting the new = shell always took about 250 ms (in Go 1.2 that = is).

I learned a lesson: people love their = shell scripting languages. Nobody wanted to script with Go. It made me = sad, but that's how it = Go-es.

ron
p.s. the 'script' command = is still available as an experimental u-root command. Source mode is now = independent: github.com/u-root/sourcery<= /div>


On Tue, Jan 3, 2023 at 2:35 PM Steffen = Nurpmeso <steffen@sdaoden.eu> = wrote:
Steve Nickolas wrote in
 <alpine.DEB.2.21.2301031307001.9988@sd-119843.dedibox.fr<= /a>>:
 |On Tue, 3 Jan 2023, Dan Cross wrote:
 |> Something I've noticed is that lots of people try to = increase
 |> complexity to solve problems, and it rarely occurs to them = to
 |> eliminate complexity to solve problems. Sometimes the = reasons for this
 |> are good; most of the time they are not.
 |>
 |>        - Dan C.
 |
 |I think of the saying: "Perfection is not when there is nothing = left to
 |add, but when there is nothing left to remove."

He (Exup=C3=A9ry) was then shot down.

I always seem to response this to that.
Hmm,
openpgp@ietf.org (to which i have almost zero to = add
technically shall someone think that, nor do i want) lastly

   |"Perfection is achieved not when there is nothing more to = add but when \
   |there
   |is nothing left to take away" - Antoine de = Saint-Exup=C3=A9ry.

  He was then shot down.

But yes, he then really went missing.

The topic ..
I do not miss times where suddenly a shell script breaks because
": > FILE" does not work (just recently 'realized from reading = code
of Paul Eggert of GNU/IANA TZ, "hey, > FILE" is of course
sufficient!"), i fixed it via "printf '' > FILE" by then; = whatever
the reason.  May it be bugs or (local) miscompilations, not
detected due to missing unit tests and a too small user base.

Portable?  If i find /usr/xpg4/bin i quickly add it to $PATH = for
the much better awk (but beware of documented double expansion
issues) and the much much better sh(1).
Some things just require that, noclobber I/O redirection (set -C)
for example.  (mktemp(1) is still not part of the POSIX = standard.)

Besides i miss(ed) the history; the author of bmake (and
verieexec) just last year asked me why i would use stty for
a purpose ("(<&1 >/dev/null stty -a) 2>/dev/null") instead = of
simply using "[ -t 1 ]", and indeed, i found that as soon as BSD
4.1 and Research V7, but it surprised me.
Without an oversight of the history and the lack of many systems
to test, perl(1) was omnipresent and if only for OpenSSL and so
using it for almost anything seemed save.

  To love is not to look at one another: it is to look,
  together, in the same direction.  Antoine de = Saint-Exup=C3=A9ry.

A happy and healthy new Year 2023 is now overdue.
Even Giants have to die, but with holding hands it can wait a bit
longer, i hope.
I wish that from Germany to all of you, and deliberately beyond
NATO readership.

--steffen
|
|Der Kragenbaer,                = The moon bear,
|der holt sich munter           he = cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

= --Apple-Mail=_21F3989F-ED78-48AA-BDED-DA866273A418--