Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!cgfsv1.dec.com!drew
From: drew@cgfsv1.dec.com (Steve Drew)
Newsgroups: comp.sys.amiga
Subject: Weird Bug under 1.2 (Shell 204m Disk Trash'g)
Message-ID: <6977@decwrl.DEC.COM>
Date: Wed, 17-Dec-86 11:59:33 EST
Article-I.D.: decwrl.6977
Posted: Wed Dec 17 11:59:33 1986
Date-Received: Thu, 18-Dec-86 02:42:09 EST
Sender: daemon@decwrl.DEC.COM
Organization: Digital Equipment Corporation
Lines: 59


I've  found what appears to be a very bizarre bug under 1.2, that
cause's disk's to get trashed. After writing the commandline editing code
for shell and using it and 1.2 for a couple of months I kept getting the
odd disk go bad. Seem'd to usually be when doing a makedir or a copy
or creating a new file. We'll I happend to pick up a 5 1/4" transformer
drive this weekend and the problem was even worse on it, in fact I
could easily reproduce it: All I had to do was fire up two shells in one
of them I did a 'forever copy df2:tmp/* ram:' and the other shell all
I had to do was hit a few RETURNS and then df2: would stop with a read
error. The only way to get df2: to read again was to power it off.
Now I have tried this on other Amiga's and another 5 1/4" drive. I was'nt
able to reproduce it on a 3 1/2" drive it seemed more intermittent on them.

After playing arround with my code for a while I determined that the problem
occured when setting the console back to a raw. (I set it to a raw, get 
the line and then set it back to con while command is executing).
So then I thought maybe I'm missing something with the packet handling
to/from the console port, but no go.

To make a long story short, turns out that I had a WaitForChar(Input(),1L)
check to see if there is  already a full  terminated line of  input
just before doing a setraw() on the console. If I removed the WaitFor..
call then no disk problems. More interesting I found that I could use
the WaitForChar() as long as I used anything other than 1L for the wait time.

Just to make sure that it was'nt anything else in my code doing this I
took Phillip Lindsay's example Sendpacket.c where he changes the console
to/from raw mode, and change the while statement to something like this:
And yes this still caused read errors'. So I guess then it must be a weird
bug under 1.2. (I'm using 1.2 33.46)

	arg[0] = DOSTRUE;   /* change to raw */
        res1 = sendpkt(conid,ACTION_SCREEN_MODE,arg,NARGS);
	while((c1 = getchar()) != 27) {
	  putchar(c1);
	  if (c1 == 13)
                arg[0] = FALSE;     /* change to con */
                res1 = sendpkt(conid,ACTION_SCREEN_MODE,arg,NARGS);

		WaitForChar(Input(),1L);  <====== This causes the problem.

	        arg[0] = DOSTRUE;   /* change to raw */
                res1 = sendpkt(conid,ACTION_SCREEN_MODE,arg,NARGS);

          }
       }

I have had at least 2 other people who have seen this disk problem
using shell. So now that I've found the workaround I will post a
new uuencode Shell 204m. Because of the number of request's I will also 
post the sources to Shell 204M here.


==========================================================================
    	Steve Drew at	ENET:    CGFSV1::DREW
    			ARPA:    drew%cfgsv1.dec.com@decwrl.dec.com
    			USENET:  {decvax!decwrl}!cgfsv1.dec.com!drew    
==========================================================================