[comp.os.minix] 1.3c upgrade resultsLONG

jonathan@comp.vuw.ac.nz (Jonathan) (09/30/88)

In article <1429@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes:
>There were a lot of changes that
>people suggested for 1.3b, so here comes 1.3c.  If nobody complains within
>a week or so, I'll send it off to Prentice-Hall and that will be the end of
>1.3.

	I've had 1.3c up and running for thirteen hours now.  There are
a few glitches that need fixing; consider these complaints if you want.
I'm including a description of what I did, and numbered the problems.
If there are any obvious mistakes here, remember it's a Friday.

I'd wanted to use James daSilva's symbolic chmod since it was posted,
but decided to stick with the official one, to make applying updates
easier.  I thought it was pretty cheap to then get the very same chmod
in a shar script that depended upon a symbolic chmod (as do all the
1.3c shar files) to work.

	Postings 0, 1, 8, and 9 (introduction, /usr/include, minix/h,
mm, and fs) seem pretty non-controversial.  The diffs applied to my
minix1.3b (postings #01 through #42) without any trouble, and haven't
broken anything (yet).

I encountered four problems with Posting #2 (lib fixes)
.
	(1) One hunk of the patch for ctime.c failed.  This might be
	because my ctime.c is the wrong one, or because the posted
	ctime.c.cdif contains a redundant patch. I haven't checked
	back through all the old versions yet.

	(2) The new fputc.c and fgetc.c cause symbols _fputc and _fgetc
	to be multiply defined, from the f{put,get}c.c.new and
	from the older 1.3b definitions.  I assume it's safe to
	edit the old ones out from the source files?

	(3) Re-building a new library exercised an error message
	formatting bug in lorder; a context diff for this is included
	below.

	(4) library ordering.  Tsort and lorder aren't yet enough to
	do this on their own.
	    After fixing lorder (see above), I added/replaced the new
	and changed library components of libc.a, extracted them into
	a directory, and used  
		# lorder /usr/lib/libc.a > libc.lorder
		# ar cr /usr/lib/libc.a `tsort < libc.lorder`
	to build a new library.  There is a cycle between signal.s and
	catchsig.s; this causes tsort/lorder to put them at the end
	of the library, *after* some other modules that they depend on.
	The end result is that you can't asld some programs (eg,
	banner.s) because some symbols end up undefined.
	    I worked around this by moving signal.s, catchsig.s,
	and message.s (in that order) to the end of libc.a. This works
	for all the commands except ed.
	    Perhaps ast would care to post his libc.a ordering again?

The documentation updates (posting 1.3c #07) are mostly ok.
There are still a few typos, though (what's a WD1003E?).  Are these
worth fixing?

I found 4 more problems with the commands updates.

	(5) the patch to sed.c causes the preprocessor symbol
	"CMASK" to be multiply #defined.  The standard definition
	in <stdio.h> is 0377, to defeat sign extension of characters.
	Is it safe to ignore the warning message this causes?

	(6) readclock.c calls functions port_in(), port_out(), and
	peek() that aren't defined anywhere.  (The first two used to
	be defined in klib88.s; but one of the 1.3c kernel patches
	deletes them from there and doesn't replace them anywhere
	else.  I guess there's a file missing somewhere. A substitute
	for it (portio.s) is included below.  
	    And why use a peek to get a BIOS variable when the kernel
	already has a variable that indicates whether it's running on
	an AT? 

	(7) Lorder.c has a bug, mentioned in point (3) above.
	A context diff fixing it is included below.

	(8) ls.c (still!) has a formatting bug printing user and group
	names. It's most noticeable with user/group names longer than
	6 characters. utmp.h (at least) allows usernames to be this
	long, so ls should cope with them too.
	A context diff fixing this is included below.
	
The tools update has a number of problems.

	(9) Four characters are missing from each of the new
	makefiles.  (ie, the sizes don't match when you unshar them).
	From inspection of the old makefile, I assume they are Ctrl-G's.

	(10) the new bootblok.s seems broken.  When I try and build a
	boot floppy with it, the BIOS in my machine never seems to
	be able to read a boot block; it seems to be in an infinite
	loop, reading a block from the floppy, failing, resetting the
	disk, then attempting an automatic reboot. 
 	   Going back to the 1.2 bootblok.s fixes this.

	(11) The patch for fsck.c didn't match my source.  I'm pretty
	sure I have the latest fsck.c, with the 1.3a/1.3b posting #31
	patch. (I may be wrong.) I edited fsck.c to match the .cdif;
	a patch from what I had to something the .cdif matches is
	included below.

MM and FS seem okay.

The kernel has a major slip-up:
	(12) port_in() and port_out() are taken out of klib88.s, but
	I can't find them anywhere else!!!  I put the deleted
	routines into the file portio.s, along with the peek() routine
	that readclock.c needs.  Of course, you will have to add it to
	the makefile...

That's all.  I still want to know if there are going to be any
1.3c Amoeba postings.  Some officially sanctioned patches, and new
makefiles to track the changes to the rest of the kernel.

Shar'ed context diffs follow.
echo x - fsck.c-1.3bpat
gres '^X' '' > fsck.c-1.3bpat << '/'
X*** fsck.c	Fri Jul 22 04:45:23 1988
X--- foo.c	Thu Sep 29 03:08:32 1988
X***************
X*** 6,13 ****
X  #include "../fs/type.h"
X  
X  /* #define DOS			/* compile to run under MS-DOS */
X! #define STANDALONE		/* compile for the boot-diskette */
X! 
X  
X  /* Fsck may be compiled to run in any of two situations. For each
X   * a different symbol must be defined:
X--- 6,15 ----
X  #include "../fs/type.h"
X  
X  /* #define DOS			/* compile to run under MS-DOS */
X! /* #define STANDALONE		/* compile for the boot-diskette */
X! #ifndef STANDALONE
X! #include "stdio.h"
X! #endif /*STANDALONE*/
X  
X  /* Fsck may be compiled to run in any of two situations. For each
X   * a different symbol must be defined:
X***************
X*** 59,71 ****
X   *
X   */
X  
X- 
X- #ifndef STANDALONE
X- #  ifndef DOS
X-     -error: no system defined.
X- #  endif
X- #endif
X- 
X  #define BITSHIFT	  4	/* = 2log(#bits(int)) */
X  #define BITMAPSHIFT	 13	/* = 2log(#bits(block)); 13 means 1K blocks */
X  #define MAXPRINT	  8	/* max. number of error lines in chkmap */
X--- 61,66 ----
X***************
X*** 1850,1856 ****
X  		case 'h':
X  			get_partition();
X  			drive = (partition < PARB ? 0x80 : 0x81);
X! 			cylsiz = 68;
X  			tracksiz = 17;
X  			printf("Checking hard disk.  %s\n", answer);
X  			if (read_partition() < 0) continue;
X--- 1845,1851 ----
X  		case 'h':
X  			get_partition();
X  			drive = (partition < PARB ? 0x80 : 0x81);
X! 			cylsiz = 68;	/* sectors per cylinder */
X  			tracksiz = 17;
X  			printf("Checking hard disk.  %s\n", answer);
X  			if (read_partition() < 0) continue;
/
echo x - lorder.c.pat
gres '^X' '' > lorder.c.pat << '/'
X*** lorder.c-1.3b	Fri Sep 30 12:39:59 1988
X--- lorder.c	Fri Sep 30 12:41:01 1988
X***************
X*** 237,243 ****
X  
X  	if (n = finddef(s)) {
X  		if (n->file != NULL) 
X! 			fprintf(stderr,"Error %s - %s defined twice in %s and %s", progname, s, n->file, yyfile);
X  		else
X  			n->file = yyfile;
X  	}
X--- 237,245 ----
X  
X  	if (n = finddef(s)) {
X  		if (n->file != NULL) 
X! 			fprintf(stderr,
X! 				"Error %s - %s defined twice in %s and %s\n",
X! 				 progname, s, n->file, yyfile);
X  		else
X  			n->file = yyfile;
X  	}
/
echo x - ls.c.pat
gres '^X' '' > ls.c.pat << '/'
X*** ls.c-1.3c	Fri Sep 30 12:39:31 1988
X--- ls.c	Fri Sep 30 14:54:20 1988
X***************
X*** 402,408 ****
X    }
X    buf = getuidgid(xid);
X    if (buf != 0)
X! 	fprintf(stdout, "%6s ",buf);
X    else
X  	fprintf(stdout, "%6d ",xid);
X  }
X--- 402,409 ----
X    }
X    buf = getuidgid(xid);
X    if (buf != 0)
X! 	/* Assuming the number 8 is not a good idea. */
X! 	fprintf(stdout, "%-8.8s ",buf);
X    else
X  	fprintf(stdout, "%6d ",xid);
X  }
/
echo x - portio.s
gres '^X' '' > portio.s << '/'
X| This file contains a number of assembly code utility routines needed by the
X| kernel _and_ by commands.  They are:
X|
X|   port_out:	outputs data on an I/O port
X|   port_in:	inputs data from an I/O port
X|   peek:	return word from arbitrary (low) address. Yuk. Sick.
X
X| The following procedures are defined in this file and called from outside it.
X.globl _port_out, _port_in, _peek
X
X|*===========================================================================*
X|*				port_out				     *
X|*===========================================================================*
X| port_out(port, value) writes 'value' on the I/O port 'port'.
X
X_port_out:
X	push bx			| save bx
X	mov bx,sp		| index off bx
X	push ax			| save ax
X	push dx			| save dx
X	mov dx,4(bx)		| dx = port
X	mov ax,6(bx)		| ax = value
X	out			| output 1 byte
X	pop dx			| restore dx
X	pop ax			| restore ax
X	pop bx			| restore bx
X	ret			| return to caller
X
X
X|*===========================================================================*
X|*				port_in					     *
X|*===========================================================================*
X| port_in(port, &value) reads from port 'port' and puts the result in 'value'.
X_port_in:
X	push bx			| save bx
X	mov bx,sp		| index off bx
X	push ax			| save ax
X	push dx			| save dx
X	mov dx,4(bx)		| dx = port
X	in			| input 1 byte
X	xorb ah,ah		| clear ah
X	mov bx,6(bx)		| fetch address where byte is to go
X	mov (bx),ax		| return byte to caller in param
X	pop dx			| restore dx
X	pop ax			| restore ax
X	pop bx			| restore bx
X	ret			| return to caller
X
X|*===========================================================================*
X|*				peek					     *
X|*===========================================================================*
X| peek(seg, offset) reads a word from seg:offset and returns it in ax.
X| it must have been written by a long-time BASIC addict.
X| FIXME: need interrupts be disabled in here while we fiddle with segment resisters?
X_peek:
X	push	bx		| set up call frame...
X	mov	bx, sp
X	push	es		| save es
X	push	si		| and si
X	mov	ax, 4(bx)	| ax = seg...
X	mov	es, ax		| now in es
X	mov	si, 6(bx)	| offset now in si
X	    seg	es
X	mov	ax, (si)	| get word into accumulator
X	xorb	ah,ah		| clear high byte
X	pop	es		| restore ex
X	pop	si		| restore si
X	pop	bx		| restore bx
X	ret			| return to caller, result in ax
X
/
-- 
-----------------------------------------------------------------------------
sane mailers: jonathan@comp.vuw.ac.nz |    Industrial democracy:
UUCP path: ...!uunet!vuwcomp!jonathan |           One factory, one vote!

ast@cs.vu.nl (Andy Tanenbaum) (10/03/88)

In article <14243@comp.vuw.ac.nz> jonathan@comp.vuw.ac.nz (Jonathan) writes:
>	    Perhaps ast would care to post his libc.a ordering again?
Ok.  I'll do this shortly, but be warned that my libc.a does not contain
Everything in lib (to keep libc.a manageable for floppy-only users).
>The documentation updates (posting 1.3c #07) are mostly ok.
>There are still a few typos, though (what's a WD1003E?).  Are these
>worth fixing?
>
>I found 4 more problems with the commands updates.
>
>	(5) the patch to sed.c causes the preprocessor symbol
>	"CMASK" to be multiply #defined.  The standard definition
>	in <stdio.h> is 0377, to defeat sign extension of characters.
>	Is it safe to ignore the warning message this causes?
Yes, ignore it. Sorry about that.

>	(6) readclock.c calls functions port_in(), port_out(), and
>	peek() that aren't defined anywhere.  
I moved them to portio.s in lib.  I guess I forgot to post it.  Soon.

>	(10) the new bootblok.s seems broken.  
Good grief.  I have made up the 1.3 diskettes and put them in a box full
of styrofoam and sealed it and am waiting to send it off.  I am not
enthusiastic about starting all over, but this bug, if true, is deadly.
My suspicion is that the trouble is with the changes made for the PS/2,
namely trying to use 720K diskettes.  Will people please reassemble
bootblok.s and build a new boot diskette, and report back on what happens.

>	(11) The patch for fsck.c didn't match my source.  
I may well have screwed up on some files.  Once everything is stable, I
will list everything and maybe we can figure out which files are wrong.
If it's not too many, I will just report them.
No more Amoeba postings.  Only one person has reported using it, so no bug
reports have come in.

Andy Tanenbaum (ast@cs.vu.nl)

brucee@runx.ips.oz (Bruce Evans) (10/07/88)

jonathan@comp.vuw.ac.nz (Jonathan) writes:

>	(5) the patch to sed.c causes the preprocessor symbol
>	"CMASK" to be multiply #defined.  The standard definition
>	in <stdio.h> is 0377, to defeat sign extension of characters.
>	Is it safe to ignore the warning message this causes?

Since I "fixed" it, let me reply. Sed.c didn't compile (here) because
it was missing the #define for CMASK. I supplied the value 0x7F after
examining old multi-file sed where it is hard-coded. I was trusted
(too much :-)) and fix got into 1.3c. CMASK became multiply defined
(harmless, but should have been caught).

How standard is the CMASK in stdio.h? I don't use Minix stdio, having
written a better one :-). Hence the "fix". My stdio.h also has cruft
to handle sign extensions, but done more portably with casts, and more
or less private to the library. Signed chars are bad and undefined
signed-ness is worse.

>X| peek(seg, offset) reads a word from seg:offset and returns it in ax.
>X| it must have been written by a long-time BASIC addict.

BASIC addict is right. peek() returns a word and not a byte in some DOS C
compilers. peekb() is for bytes. Actually, these are not so bad, they are
just small model's far pointers.

>X| FIXME: need interrupts be disabled in here while we fiddle with segment resisters?

Interrupt routines now preserve segment registers. Was there a prehistoric
version of Minix where they didn't? The comments in the assembler code are
out of date and aimed too low.

Bruce Evans
Internet: brucee@runx.ips.oz.au    UUCP: uunet!runx.ips.oz.au!brucee