[comp.sys.mac.programmer] Puzzle

ts@cup.portal.com (Tim W Smith) (02/24/89)

Here's a puzzle.  Suppose a Macintosh disk driver had the following
bug:

	The ioActualCount and ioPosition fields of the parameter
	block are not updated after IO operations like they are
	supposed to be.  Instead, they are left whatever they
	were when the _Read or _Write call was made.

What would happen?  Would most programs only look at the result code
and ignore these fields, or would most programs break?

						Tim Smith

alexis@ccnysci.UUCP (Alexis Rosen) (02/26/89)

Well, so far most of my File Manager stuff uses the high-level calls (except
when I need to play with directories, or iterate on all files in a folder,
etc.)  But I think that that's irrelevant, since the high-level routines
return something which must be the ioActualCount field. I don't know about
others, but I always check this. And always feel like I'm wasting my time,
until I remember that there are some people out there who still use floppy
disks. :-)

So I think that the driver would cause problems, IF the write failed in some
way. I'm a little less certain about ioPosition, but the same probably holds
true.

Why ask? You planning on writing some bugs? :-)

Alexis Rosen
alexis@ccnysci.uucp

ts@cup.portal.com (Tim W Smith) (02/27/89)

A few days ago, I posted a couple of Macintosh puzzles.  Here was
one of them:

< Here's a puzzle.  Suppose a Macintosh disk driver had the following
< bug:
< 
< 	The ioActualCount and ioPosition fields of the parameter
< 	block are not updated after IO operations like they are
< 	supposed to be.  Instead, they are left whatever they
< 	were when the _Read or _Write call was made.
< 
< What would happen?  Would most programs only look at the result code
< and ignore these fields, or would most programs break?

( by the way, ioPosition should have been dCtlPosition in the above ).

Here is the ( surprising ) answer: most things work just fine with
this buggy disk driver.  In six months that I ran with this disk
driver before I became aware of the bug and fixed it, only two
programs cared about these two fields.

HD Partition, from Symantec Utilities, had trouble mounting volumes,
and could never mount passworded volumes.

Other Macintoshes could not use TOPS to mount the disk.  They could
mount any folder on the disk, but they could not mount the whole
disk.

The company we wrote this disk driver for has had it in beta testing
for the last several months with several beta testers, and the TOPS
problem was the only one any beta tester ever found.

I guess that most programs don't look at these fields unless ioResult
is non-zero.

						Tim Smith