[conspire] vi (was: Re: Technical Interview Performance by Editor/OS/Language - Triplebyte Blog)

Michael Paoli Michael.Paoli at cal.berkeley.edu
Mon Mar 11 21:51:24 PDT 2019


> From: "Rick Moen" <rick at linuxmafia.com>
> Subject: Re: [conspire] vi (was: Re: Technical Interview Performance  
> by Editor/OS/Language - Triplebyte Blog)
> Date: Mon, 11 Mar 2019 14:48:02 -0700

> For those who are determined to run Bill Joy's primordial vi and ex
> code, for antiquarian or any other reasons, source code is available
> here:  http://ex-vi.sourceforge.net/

Cool!  Thanks for tracking that down!  :-)
[me: adds to [todo,task,wish]list ... 5923 --> 5924 items on list]

> As the notice on the index page says, the code was finally liberated by
> Caldera International (during the sequence of events that turned that
>   January 23, 2002
> The licence was a BSD variant with noxious advertising clause.
> Caldera's full initial 2002 code dump, with some updates, as hosted by
> the Unix Heritage Society (tuhs.org), is here:
> https://www.tuhs.org/Archive/
>
> Why run traditional vi (1976)?  Dunno, people have their reasons, or
> maybe they just want to for no particular reason, or to have a vi even
> tinier than Keith Bostic's nvi (released as part of 4BSD in 1980,
> https://www.oreilly.com/openbook/opensources/book/kirkmck.html ).

I'd be interested to run it - on (semi-)rare occasion - mostly when I might
wish to compare it to [n]vi - or maybe even vim.  I do also have older
Solaris x86 image I can run it on ... but that's a whole lot 'o image
to run something that's still - at least based upon - classic vi (but
maybe still relatively useful for comparison purposes ... I wonder how
it also differs from ~1980 classic vi?)

Most of my comparisons in more recent years between [n]vi and
(classic) vi, my reference copy of classic vi has generally been in
wetware - which may be a bit mushy and have some bit rot (or more
commonly (further) lossy compression).

I do have 7th edition Unix I can fire up under PDP-11 emulator,
but alas, that image I have doesn't have any (or hardly any?) of
the BSDisms.  Yes, sometimes cool/fun to fire it up ... e.g. check
extreme backwards compatibility.  8-O  (Yes, this code has worked fine
since and would work on 1979/1980 7th edition Unix ... me thinks ...
let me check ...).  Nostalgia - it looks better in fond recollection
than the nitty gritty reality of what it actually was.  Many thing I'm so
used to being there, and for *so long*, I expect 'em also to be there
"way back then" - but alas, some/many of those fiddly little bits I rather
expect, just weren't there back then.  Many/most I know about, ...
some(/many?) I forget that they just weren't there "way back then".

And, "way back then", Unix/vi wasn't very secure, so ... maybe I'd want to
only run it in a suitably secured/isolated environment.  Just grabbing
source and compiling it (even minimal tweaking as needed), would likely give
one a vi implementation that's probably hazardously insecure on a general
purpose Unix/Linux/BSD operating system.  "Way back then" /tmp & /var/tmp
world writable, no sticky bit, race conditions abound, K&R C, little
in the way of tools to check for coding errors (it was presumed programmers
knew what the hell they were doing ... they did, ... but the also weren't
perfect, so bugs, including security bugs, happened - and probably more
commonly (at least per line of code) compared to now ... now there's just
a helluva lot more lines of code for folks to make mistakes on).

> Personally, I think Bostic improved on Bill Joy's original, but OTOH I'm
> one of those vim heretics, so what would I know?  ;->

Many "religious" wars happen over editors.  ;-)  My personal favorite is
[n]vi ... it ain't perfect, but for what I want (and don't want) in an
editor - it comes dang close.

Also, ed, and ex are very useful/handy too ... but nowadays folks would
more typically use GNU sed's edit-in-place (non-POSIX) extension,
or similar capabilities in perl - or I presume python can also likely
do similarly.  Heck, ed is still very handy in some rare
occasions/circumstances.  Want a reasonably powerful editor with a teensy
footprint?  Yes, ed is still quite good for that ... but nowadays RAM
and drive space are comparatively very cheap - so folks more typically
put much more capable editor(s) in there - even for "small" recovery
environments - as nowadays, "small" is much much much bigger than it
once was.  (When is the last time you booted an operating system from
magnetic tape?  Or booted recovery environment from floppy or magnetic
tape into RAM and ran the recovery environment from there?  How 'bout
punched paper tape or punched cards?)

> On another personal note, when I first encountered vi during summer
> sessions at Evans Hall, UCB in the 1970s and 1980s, I bounced off it
> hard for all the usual reasons of user-hostileness.  I remember buying
> at the bookstore near the Bear's Lair a vi tutorial printout I thought a
> bit opaque at the time, and it might have been this one by Bill Joy:
> http://ex-vi.sourceforge.net/viin/paper.html
> Tips for building it on Debian:
> http://forums.debian.net/viewtopic.php?t=130599

My timing was close ... within the University of California ... 1980.
Yes, I'd almost forgotten - there was(/is) a very good vi tutorial.
That's still available with, e.g., the BSD documentation.
So I learned it from not only the vi quick reference card, and the man
page, but also that quite good tutorial (and it's still mostly quite
applicable to this day - likewise the vi quick reference card ... and of
course the man page).

> With some determination, I was able to get by in vi on ADM3 terminals
Yep, me too - Leir Seigler (if I remember the name right) adm3a ... close:
Lear Siegler ADM-3A https://en.wikipedia.org/wiki/ADM-3A
and I think on Unix the TERM type for it was adm3a ... that was before
terminfo - that was termcap.

> (IIRC) connected to Evans Hall's BSD-equipped VAXen, but barely, and I
> pretty much hated the editor.  Finally, at the end of the 1980s, I ended
> up running Unixes on my own machines and finally learned the thing
> properly, at which point the hatred went away.  This would have happened
> sooner if someone had said 'If you're new to vi, when in doubt hit the
> Esc key, just to make sure you are in a known mode.'

Oh yes, I learned that very early on - I think it was stated in the
tutorial - essentially not sure what state?  Hit <Esc> until the terminal
beeps at you.

> vim's default of always displaying your program mode in the lower left
> is a godsend in this department, IMO.
Trivial to do in [n]vi, and I think even classic vi:
:se showmode
Albeit not the default - but add it to one's ~/.exrc file, and one's set
(or back then, that would be "$HOME"/.exrc).
Anyway, I generally have it enabled.  In fact redraw and showmode
are the two options I commonly set in [n]vi.  Others I commonly
set include: autoindent shiftwidth= showmatch showmode tabstop=
... though I don't necessarily set them all the time - depends what I'm
editing (e.g. program vs. outline vs. regular written text).

> Suggestion for Michael especially, in the vein of 'Go big or go home':
>
> # apt-get install simh

... Yeah, I'll have to pay attention to how I set it up and in what
environment ... notably security concerns - I'm more concerned about that
than getting it to fire up (given the vintage and nature of the code).

And, used to be a Debian package (I still have the .deb file):
$ mktemp -d
/tmp/tmp.YYZNvTt1Rl
$ cd /tmp/tmp.YYZNvTt1Rl
$ unix-v7

PDP-11 simulator V3.8-1
Disabling XQ
@boot
New Boot, known devices are hp ht rk rl rp tm vt
: rl(0,0)rl2unix
mem = 177856
#

$ type unix-v7
unix-v7 is hashed (/usr/bin/unix-v7)
$ dpkg -S /usr/bin/unix-v7
pdp11-unix-v7: /usr/bin/unix-v7
$ apt-cache show pdp11-unix-v7
Package: pdp11-unix-v7
Status: install ok installed
Priority: extra
Section: non-free/otherosfs
Installed-Size: 10320
Maintainer: Debian QA Group <packages at qa.debian.org>
Architecture: all
Version: 1.0-7
Recommends: simh
Description: Caldera UNIX V7 images for a PDP-11 emulator
  This package contains images of the UNIX V7 operating system
  which are usable by a PDP-11 emulator.
  .
  The Debian simh package supplies a pdp11 emulator, but the images in
  this package are in a standard format usable by any other pdp11
  emulator.
  .
  The unix-v7 script will run the simh emulator
  with these images.
Description-md5: 054babee889ee40b4bdcda37ef5ee0d1

$

> Bonus humour link (in which I see myself):
> https://www.reddit.com/r/linux/comments/8udel5/what_is_a_deadgiveaway_that_someone_is_an/

$ echo $(lsb_release -d) $(uname -m) && ls -l /bin/ed
Description: Debian GNU/Linux 9.8 (stretch) x86_64
-rwxr-xr-x 1 root root 51552 Feb 20  2016 /bin/ed
$
http://www.gnu.org/fun/jokes/ed-msg.txt




More information about the conspire mailing list