... when he declared all the parameters for this procedure"
I'm sure some of you remember this quote expressing John Lions'
puzzlement over the declaration of printf in the UNIX kernel:
printf(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9,xa,xb,xc)
Note that parameters x2 and following are never referenced by name
in the function body, only by pointer arithmetic from &x1.
The historical reason for this long list of parameters is probably
not well known, so I want to explain it and hope that you will find
it as enjoyable as I did when I came across it some time ago while
studying leftover files of B.
To call a function in B, there's a little dance you have to do:
first push the function address onto the stack, remember the stack
pointer, push all the arguments, then restore the stack pointer and
do the actual call.
In diagrams, this is what happens to the B stack:
push func addr:
+------------+
| | <- sp
+------------+
| func addr |
+------------+
mark (n2):
+------------+
| | <- sp
+------------+
| | <- old sp (saved on native stack)
+------------+
| func addr |
+------------+
push arguments:
+------------+
| | <- sp
+------------+
| arg n |
+------------+
| ... |
+------------+
| arg 0 |
+------------+
| | <- old sp (saved on native stack)
+------------+
| func addr |
+------------+
call (n3):
pop old sp from stack
jump to func addr on stack
set ret addr and old fp
+------------+
| arg n |
+------------+
| ... |
+------------+
| arg 0 |
+------------+
| ret addr |
+------------+
| old fp | <- sp, fp
+------------+
The callee then sets sp, so has to know how many args and automatics!
+------------+
| | <- sp
+------------+
| auto n |
+------------+
| ... |
+------------+
| auto 0 |
+------------+
| arg n |
+------------+
| ... |
+------------+
| arg 0 |
+------------+
| ret addr |
+------------+
| old fp | <- fp
+------------+
So because the arguments to a functions were grouped together with
the automatics and not below the ret addr and saved fp, there has
to be space on the stack lest they clash. This of course means that
this printf in B would probably break if called with more arguments
than it expects.
So there you have it. Just a line of B code that wasn't updated to C.
Cheers,
aap
Hello,
I'm currently trying out the rc shell (using Byron Rakitzis'
implementation for Unix). Compared to Bash, which I normally use, this
shell has a rather small feature set (which isn't to say that that's
necessarily a bad thing).
Now, one of the features that Bash has and rc doesn't have is the
ability to perform arithmetic expansion. That's not really a problem
because you can just use `expr` instead. I wonder, though, when
arithmetic expansion as a shell built-in became a thing, especially in
POSIX sh.
POSIX has included that feature since at least 2001, and probably quite
some years earlier, given that Bash already had it in 1995 (going by
the manual page of version 1.14.7, the oldest I could find).
So, maybe someone here can help me find out when this was actually
standardized.
Thanks.
--
Michael
even tho it was there, in-shell integer arithmetic had a few
issues before ksh86.
pre-ksh86 these had problems --
A. decimal point in a number
$ integer I
$ I=2.2
would error on the assignment, but with ksh86 $I is truncated to 2
(yes "integer" is an builtin alias to typeset -i and ksh courses at the time
instructed to use that over typset)
B. negative numbers
$ integer I
$ I=-2
here pre-86 $I would be assigned a large value like 2147483646
also ksh was not stardard until SVR4 (very late 80s) so it was found
in paths like /usr/add-on/bin/ksh or /usr/exptools/bin/ksh, or not even
there at all, you could not reliably #! ksh scripts
also with ksh86 the double paren ((...)) notation was exactly the same as
"let ..." and were completely optional if the variable was predefined as
an integer, so
$ I=0
$ ((I=I+1))
and
$ integer I
$ I=0
$ I=I+1
are the same.
All internal integers in ksh were C longs (at least 32-bits)
where Bourne shell all vars are strings so you would need to do this --
$ I=`expr $I + 1`
But also at that time expr(1) could NOT deal with negative numbers on input,
they became strings. So
$ expr -9 + 1
is an error with "non-numeric argument", and
$ expr -11 '<' -1
returns 0, a false statement, which are hidden bugs with variables.
expr(1) was also 32-bits, as was test (i.e [ ) which could deal with
negative numbers just fine.
for arbitrarily large numbers you needed use dc(1) or bc(1). but dc(1)
also has a issue with inputing negative numbers as it uses an _ not
a - to denote a negatve number on input, but does use the - on output.
$ I=`echo _9 1 - p | dc`
is how you would do ((I=-9 - 1)) in bourne with dc
which is cumbersome if you have a variable with a neagtive number in it,
and required a "tr - _" first.
however
$ I=`echo -9 - 1 | bc`
worked just fine in bourne.
-Brian
Chet Ramey wrote:
> On 6/21/21 5:57 AM, arnold at skeeve.com wrote:
> > Arithmetic expansion dates back at least as far as ksh88.
>
> ksh had the `let' builtin from at least 1983. The ((...)) compound command
> was there by ksh-86.
>
> > Bash likely picked it up from there.
>
> Sort of, see below.
>
> > The original was only integer math and Bash remains that way (IIRC,
> > Chet can correct me if I'm wrong). ksh93 added floating point math.
>
> Yes, bash only has integer arithmetic, since it's all POSIX requires.
>
> > POSIX would have picked it up from ksh88.
>
> The $((...)) form of arithmetic expansion is something POSIX picked up
> from ksh-88, eventually. The early drafts of the standard (through 1003.2
> d9, at least), used $[...], but they eventually adopted $((...)) because
> ksh-88 had already implemented it, though it's not documented in Bolsky
> and Korn.
>
> I put $[...] into bash first (it's still there, though deprecated), then
> `let', then $((...)) after POSIX added it, and finally `((' for
> compatibility.
>
> Chet
I’m still researching John Reiser’s 32V with demand paging, copy-on-write and mmap.
Unfortunately, JFR does not have the bits or a listing for this version of 32V.
I’ve read the MSc theses of Leffler and Shannon with interest (https://www.tuhs.org/Archive/Documentation/Theses/) The thesis of Shannon has an interesting discussion of a demand paged version of his Harris/6 Unix (Chapter 5). It is based on the Tenex ideas, just as JFR mentioned for his version. The thesis of Leffler contains a gant chart that shows that the demand paged version was written in the first months of 1980 -- concurrently with or slightly after the 32V version.
I’ve also (superficially) read the papers on Tenex memory management. The design is closely tied to PDP-10 MMU that BBN designed for Tenex. Some of its data structuring is recognisable in Shannon’s version. One defining aspect is that the design for both is for a virtual address space that is smaller than the physical address space; on a 1980 VAX it was the reverse.
If 32V followed the same design ideas (a big if), it most likely limited processes to a capped address space (e.g. 2MB). It might also have contained an in-core flag/data vector with as many entries as there are pages frames in swap space. If true, these downsides may have been why it did not go on to become the root for SysVR1 or R2 paging.
The demand paging code for SysVR2 was written by Keith A. Kelleman and Steven J. Buroff, and in contemporary conference talks they were saying that they wanted to combine the best parts of demand-paged 32V and BSD. They may have some additional memories that could help with getting a better understanding of the final version of 32V.
Does anybody have contact details for these two gentlemen?
Not Unix in particular.
At least in Germany it is already the 16th, and my BSD calendar
notifies that "first programming error is encountered at the
U. S. Census Bureau".
As not being hard-to-the-core i may have missed it, but also in
1951, in March, the wonderful Grace Hopper "conceives the first
compiler, called A-O and later released as Math-Matic. Hopper is
also credited with coining the term 'bug' following an incident
involving a moth and a Mark II.
All (hm!) according to COMPUTERWORLD January 18th, 1999 (i was
young!), with assistance of the Computer Museum of Boston.
Like McCartney said in the legendary 1999 concert at the Cavern
club, the first after his wonderful wife Linda died, "See, with
this band, if we don't get it right ... we start again!".
Thank you.
--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)
Rob Pike:
Although upon reflection, I think what I did was fix 'adb' and call it
'db'. Haven't had my coffee yet this morning.
====
I don't think so. I did quite a lot of work on adb during my
time at the Labs. I remember clearly that it still used all
the Bournegol macros when I started; I doubt Rob would have
left that there. (It was Rob who translated the shell
back to C, I believe.)
I got into adb because it still used ptrace and everyone else
seemed scared to touch the code to convert it to use /proc.
So I fixed that, and fixed sdb too, and finally removed
the ptrace call from the kernel. I remember celebrating
by expunging ptrace from the UNIX Room copy of the V8
manual. ptrace happened to occupt two facing pages, which
I glued together.
I did a lot more hacking on adb after that, ranging from
little stuff like making # a synonym for 0x in input
(so that adb's output could be picked up from the screen
and re-used as input, a principle established firmly and
correctly by Rob!) to a major restructuring to isolate
machine-dependent pieces like instruction decoding and
word formats, so that it was simpler not only to make
adb work on a new processor architecture but even to make
a sort of cross-adb that could, say, correctly interpret
a PDP-11 core image on a VAX. (This actually mattered;
by the time I arrived Research had no PDP-11s running
general-purpose UNIX, but did have LSI-11s acting as
Datakit controllers and a standalone power-backed-up
LSI-11 that decoded the time signal from WWVB.)
I was never really happy about the restructuring; it did
more or less what I wanted but it wasn't really graceful.
And cross-adb needed a distinct binary for each target.
I had thoughts of trying to make a meta-language to
describe the target's data formats (simple except for
floating point) and how to print its instructions
(messier, but I remember being inspired by the clever
table-driven code in an disassembler Ken wrote for,
I think it was, the NS32000), so that one could load
a table from a file at startup; never had the time or
the courage to carry through on it.
Norman Wilson
Toronto ON
> From: Henry Bent
> From what I can gather the only way to reasonably examine the
> disassembly of a program in the early days of Unix was adb. Is this
> true? Was there a way to easily produce a full disassembly?
'adb' is quite late. We had it on the PWB1 (V6 enhanced, basically) system at
MIT, so its roots lie before V7. (Every time I run across people who think V7
is early, I go into 'get off my lawn' mode.)
The first thing I know of that could disassemble PDP-11 code on Unix was 'db',
which dates back to V1:
https://minnie.tuhs.org//cgi-bin/utree.pl?file=V1/man/man1/db.1
It wasn't optimal for doing disassembly, because it was non-trivial to
dump an entire object file as assembler source - but it could be done.
Later (V5 era) there was something called 'cdb', which was 'db' with
extensions to make it useful for debugging code whose source was in C:
https://minnie.tuhs.org//cgi-bin/utree.pl?file=V4/man/man1/cdb.1
There were other non-Unix disassembler (such as DDT), also.
Noel
A new journal issue published today carries this paper:
Diomidis Spinellis and Paris Avgeriou
Evolution of the Unix System Architecture: An Exploratory Case Study
IEEE Transactions on Software Engineering 47(6) 1134--1163 June 2021
https://doi.org/10.1109/TSE.2019.2892149
A preprint is available here:
https://www.researchgate.net/publication/332826685_Evolution_of_the_Unix_Sy…
However, it is dated four years ago, and after removing its cover
page, diffpdf shows numerous changes compared to today's publication.
In the new version, a footnote on the first page says
Manuscript received 19 May 2018; revised 18 Dec. 2018;
accepted 28 Dec. 2018. Date of publication 2 May 2019;
date of current version 14 June 2021.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe(a)math.utah.edu -
- 155 S 1400 E RM 233 beebe(a)acm.org beebe(a)computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
Sounds very "Deus ex machina" like. Although it's hard to staple a ghost
to your notebook.
-----Original Message-----
From: Bakul Shah
To: Rob Pike
Cc: The Eunuchs Hysterical Society
Sent: 6/16/21 12:13 PM
Subject: Re: [TUHS] 70th anniversary of (official) programming errors
https://spectrum.ieee.org/the-institute/ieee-history/did-you-know-edison
-coined-the-term-bug
<https://spectrum.ieee.org/the-institute/ieee-history/did-you-know-ediso
n-coined-the-term-bug>
Like Edison, she (Grace Hopper) was recalling the word’s older origins
in the Welsh bwg, the Scottish bogill or bogle, the German bögge, and
the Middle English bugge: the hobgoblins of pre-modern life, resurrected
in the 19th century as, to paraphrase philosopher Gilbert Ryle, ghosts
in the machine.
Electrical circuits can have "bad connections" so I do wonder if Edison
coined this word based on "ghost like" faults that magically appear and
disappear!
-- Bakul
On Jun 15, 2021, at 8:48 PM, Rob Pike <robpike(a)gmail.com> wrote:
There are citations from Edison in the 19th century using the word, and
a quote somewhere by Maurice Wilkes about the stairwell moment when he
realized much of the rest of his life would be spent finding programming
errors.
That moth was not the first bug, nor the first "bug", it was the first
recorded "actual bug".
-rob
On Wed, Jun 16, 2021 at 9:46 AM Dan Cross < crossd(a)gmail.com
<mailto:crossd@gmail.com> > wrote:
On Tue, Jun 15, 2021 at 6:55 PM John Cowan < cowan(a)ccil.org
<mailto:cowan@ccil.org> > wrote:
On Tue, Jun 15, 2021 at 6:25 PM Steffen Nurpmeso < steffen(a)sdaoden.eu
<mailto:steffen@sdaoden.eu> > wrote:
As not being hard-to-the-core i may have missed it, but also in
1951, in March, the wonderful Grace Hopper "conceives the first
compiler, called A-O and later released as Math-Matic. Hopper is
also credited with coining the term 'bug' following an incident
involving a moth and a Mark II.
Yes, but wrongly. The label next to the moth is "First actual case of
bug being found", and the word "actual" shows that the slang term
already existed then. Brief unexplained faults on telephony (and before
that telegraphy) lines were "bugs on the line" back in the 19C.
Vibroplex telegraph keys, first sold in 1905, had a picture of a beetle
on the top of the key, and were notorious for creating bugs when
inexperienced operators used them. (Vibroplex is still in business,
still selling its continuous-operation telegraph keys, which ditt as
long as you hold the paddle to the right.)
Indeed, the Vibroplex key is called a "bug". I suspect this has
something to do with its appearance more than anything else, though (it
kinda sorta looks like, er, a bug).
- Dan C.
I understand the preference for a bottom-up entry, with somebody already sympathetic.
If there is no such entry point, top-down may work at Microfocus. I guess the ask is for a statement for SysV similar to the Nokia statement for 8th-10th Edition:
https://media-bell-labs-com.s3.amazonaws.com/pages/20170327_1602/statement%…
According to Companies’ House, the general counsel is Jane Smithard:
https://find-and-update.company-information.service.gov.uk/company/01504593…
She appears to be 67, to have a long tenure with Microfocus and maybe is just the right person:
"Jane has more than 25 years’ experience as a lawyer in the IT industry and software sector. She has worked with Micro Focus for over 20 years providing a wide range of commercial and corporate legal services, from leading the efforts through the 2005 IPO to driving the legal aspects of the group’s mergers, acquisitions and divestitures strategy including the acquisition of HPE Software and divestiture of SUSE. Jane leads a team of approximately 60 lawyers and other professionals worldwide, the majority of whom are focused directly on supporting the Company’s commercial teams and business.”
https://www.microfocus.com/en-us/about/leadership-about
Her e-mail appears to be jane (dot) smithard (at) microfocus (dot) com
But I guess that Dan Doernberg already knows all that. His book project sounds intriguing, by the way.
Paul