Subject: Re: Happy New Year + 1stEd binaries run again

From: [email-masked]
Date: Tue, 4 Jan 2000 01:58:10 -0500

> 	Merry Christmas & Happy 2000 to you and your family. I hope you
 > didn't suffer too many Y2K problems. None to report here.

Likewise on all counts!  As a giggle I did fix a troff -ms bug (on Plan 9)
that is widely shared in many environments wherein the date when
converted to a string was January 1 19100. It all owes, I suppose,
to the C routine that returns year-1900 and lots of programs
catenate two digits to "19".

 > This e-mail contains some new observations, reports and requests on early
 > Unixes. I hope you don't mind my requests. It is summer break here, and I
 > have been working on my PDP-11 a.out emulator. By using your on-line 1st
 > Edition manuals, I can now run the 0405-magic a.out binaries on the `s2'

In some ways it's like summer break here (aside from the holidays)
because the temperature was 65F today.  Not the usual January.

I'm not sure what to do about the early-70s date issue.  It looks likely
that some of the files are mis-epoched, but I haven't worked out
the details.  As you know the epoch did change more than once.
The extraction program has an idea (based on whether it was a tap
or tp tape) of which to use, and the exact code that interprets the
bits is on tap tapes is now

long
cvtime(unsigned char *tp)
{
	unsigned long t = (tp[1]<<24)+(tp[0]<<16)+(tp[3]<<8)+(tp[2]<<0);
	t /= 60;
	t += 3*365*24*3600;
	return t;
}

which seems to reduce 60ths sec to sec, then normalize to 3 years
before that epoch.  It appears that there's no such routine for tp
tapes (so I guess that the "standard" epoch had been adopted by
then).

 > I'd be interested to know any details you have about the origins of the s2
 > tape, especially who are jack, peter, jay, bob, sun and lee in /etc/uids.

I don't know the origins, and in particular who jack etc. are, and why
they are the only personal names in the password file.  I can think
of some possibilities, but the tape snapshot was clearly not taken
of our main machine.  (Lee could be conceivably be Lee McMahon, whose usual
or maybe later login name was lem; peter could be Peter McIlroy,
Doug McIlroy's son; but the collection is an odd one).  I'm wondering
whether the tape might have been made on an offshoot or
cloned system.

I'll try to dredge up the s1 and s2 bits once I figure out the current
magical bindings for ftp.  I have never decrypted s1.

	Dennis

---

From: [email-masked]
Date: Tue, 4 Jan 2000 22:19:01 -0500

> Could you send me the program you wrote to decode s2-bits? I had a
 > quick look at s1: I don't recognise the format. I thought it might
 > be a dump of a filesystem, but there are full pathnames in the file,
 > which suggests otherwise.

I haven't done full "cryptanalysis" on s1, but I can't figure out
what it is.  But you're right that there is something there.

Attached below is  the "plugin" for tapfs (part of the plan 9 things that
mount things as file systems).  It's the only part that's tap-specific.

Just got your latest mail--as I said, I don't recognize the format of s1
either.  My headers for s2 are consistent with yours, I think, modulo
date understanding.  (And mapping of permissions etc into Plan 9).
For example: 

--r---wxrw- M 10745 79524 28 1912 Jan  3  1973 bin/form

The M 10745 79524 28 part is just Plan 9; there's a possible year
ambiguity; the day difference is probably US vs AU.

	---

#include <u.h>
#include <libc.h>
#include "tapefs.h"

/*
 * File system for old tap tapes.
 */

struct tap {
	unsigned char	name[32];
	unsigned char	mode[1];
	unsigned char	uid[1];
	unsigned char	size[2];
	unsigned char	tmod[4];
	unsigned char	taddress[2];
	unsigned char	unused[20];
	unsigned char	checksum[2];
} dir[192];

int	tapefile;
char	buffer[8192];
long	cvtime(unsigned char *);

void
populate(char *name)
{
	int i, isabs;
	struct tap *tpp;
	Fileinf f;

	replete = 1;
	tapefile = open(name, OREAD);
	if (tapefile<0)
		error("Can't open argument file");
	read(tapefile, dir, sizeof dir);
	for (i=0, tpp=&dir[8]; i<192; i++, tpp++) {
		unsigned char *sp = (unsigned char *)tpp;
		int j, cksum = 0;
		for (j=0; j<32; j++, sp+=2)
			cksum += sp[0] + (sp[1]<<8);
		cksum &= 0xFFFF;
		if (cksum!=0) {
			print("cksum failure\n");
			continue;
		}
		if (tpp->name[0]=='\0')
			continue;
		f.addr = (void *)(tpp->taddress[0] + (tpp->taddress[1]<<8));
		if (f.addr==0)
			continue;
		f.size = tpp->size[0] + (tpp->size[1]<<8);
		f.mdate = cvtime(tpp->tmod);
		f.mode = tpp->mode[0]&0777;
		isabs = tpp->name[0]=='/';
		f.name = (char *)tpp->name+isabs;
		poppath(f, 1);
	}
}

long

void
popdir(Ram *r)
{
	USED(r);
}

void
dotrunc(Ram *r)
{
	USED(r);
}

void
docreate(Ram *r)
{
	USED(r);
}

char *
doread(Ram *r, long off, long cnt)
{
	if (cnt>sizeof(buffer))
		print("count too big\n");
	seek(tapefile, 512*(int)r->data+off, 0);
	read(tapefile, buffer, cnt);
	return buffer;
}

void
dowrite(Ram *r, char *buf, long off, long cnt)
{
	USED(r); USED(buf); USED(off); USED(cnt);
}

int
dopermw(Ram *r)
{
	USED(r);
	return 0;
}