[comp.os.minix] portablity bug in mkfs.

polder@ark.UUCP (04/04/87)

Sender:

When mkfs is compiled on a system where sizeof(int) is not
2 bytes, (e.g. a VAX) mkfs will build a wrong filesystem
when using indirect blocks.
The code assumes there are INTS_PER_BLOCK zone numbers per
indirect block, where it should be NR_INDIRECTS.
Consequently, on e.g. a VAX, every even zone number on the block
will be zero (== NO_ZONE).
The following diff-listing should solve this.

-------------------------------------------------
32a33,34
> #undef major		/* These defines are used as variables in the code */
> #undef minor
448c450,451
<   int b, off, blk[INTS_PER_BLOCK], indir, i;
---
>   int b, off, indir, i;
>   zone_nr blk[NR_INDIRECTS];
472c475
<   for (i = 0; i < INTS_PER_BLOCK; i++)
---
>   for (i = 0; i < NR_INDIRECTS; i++)
474c477
< 		blk[i] = z;
---
> 		blk[i] = (zone_nr) z;
-------------------------------------------------

Paul Polderman (polder@cs.vu.nl)

polder@ark.UUCP (04/11/87)

In article <515@ark.cs.vu.nl>, levy@ttrdc.UUCP (Daniel R. Levy) writes:

> In article <956@ark.cs.vu.nl>, polder@ark.cs.vu.nl (Paul Polderman) writes:
> > When mkfs is compiled on a system where sizeof(int) is not
> > 2 bytes, (e.g. a VAX) mkfs will build a wrong filesystem
> > when using indirect blocks.

> Can someone please explain to me why one would try to compile MINIX source on
> a VAX.  Just curious.

It is often convenient (and faster!) to develop user (not kernel) software
for MINIX on another system.
If the include files are on-line on your local system (as they are here,
MINIX was developed here), you can use all the defines used in MINIX.
The system-calls of MINIX are also available on your local UNIX-system.
So there is nothing to prevent you from writing software for MINIX
on your local system.

- Paul Polderman (polder@cs.vu.nl)

fnf@mcdsun.UUCP (04/12/87)

In article <1660@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes:
>Can someone please explain to me why one would try to compile MINIX source on
>a VAX.  Just curious.

How about:

	(1)	Find compiler dependencies (questionable C code that
		is acceptable to one compiler and not another).

	(2)	Find machine dependencies (byte order, primitive object
		sizes, structure alignment and padding, etc).

	(3)	Find environment dependencies (missing include files,
		missing or nonstandard library functions, etc)

	(4)	Run lint on the sources.

	(5)	Run cxref on the sources.

	(6)	Run useful minix utilities on unix (are there any
		that unix doesn't have?)

	.
	.
	.

-Fred


-- 
= Drug tests; just say *NO*!  (Moto just announced new drug testing program)  =
= Fred Fish  Motorola Computer Division, 3013 S 52nd St, Tempe, Az 85282  USA =
= seismo!noao!mcdsun!fnf    (602) 438-5976                                    =