[comp.sys.atari.st] ***HELP*** Floppy gone crazy!?!?!

Friesen@HIS-PHOENIX-MULTICS.ARPA (08/01/88)

I just decided that the floppy I use to store my word processor files
and some other misc.  things, probably had a lot of files I could get
rid of.  I decided to take a look at them and see which ones to throw
out.  I had never noticed anything strange about this disk before (the
only time I access the disk is from file selector boxes, and I always
know exactly what I want) so I really hadn't "looked" at the disk.
Well, I got the directory up and much to my surprise, there were many
groups of two files with exactly the same name.  I opened the files
(they were DOC files so I could view them on the desktop).  One of the
files had zero K and the other seemed ok.  I opened another file from
another group of two with the same names.  These files were both
garbage.  I opened all the files and many of them (not just ones that
had "copies") were garbage.  None of the information was recagnizable,
and the ones that shared the same names, sometimes had the same data,
and other times didn't.  One file (which had originally been a letter to
GFA) actually had a list of all of the files on the disk amoung a small
amount of garbage!  Most of the files were older and hadn't been
accessed for a while, and my new files (I had written some letters just
today) seemed untouched.  I decided (in a state of panic) that this must
be the work of a virus.  I quickly pulled out the VKILLER.PRG and
PENICLN.TTP.  First I checked the disk with VKILLER, then engaged
PENICLN.  Accourding to VKILLER the disk was fine.  I then did some file
copies to a ramdisk, and then a newly formatted disk and, well I did a
lot, but I think it should have taken care of the problem.



********Please if anyone has any info.  on what could have done this,
tell me, I am very scared!!!  :=( <---This is a crying sad face!


Thanks in advance


Aric Friesen

Addresses:  Genie:  A.FRIESEN ARPA:  Friesen%PCO@BCO-MULTICS.ARPA

"I'd rather face the Daleks then loose my files!"

                                        --Aric Friesen

leo@philmds.UUCP (Leo de Wit) (08/03/88)

In article <880801064254.135611@HIS-PHOENIX-MULTICS.ARPA> Friesen%PCO@BCO-MULTICS.ARPA writes:
  [stuff deleted]...
>Well, I got the directory up and much to my surprise, there were many
>groups of two files with exactly the same name.  I opened the files
  [stuff deleted]...

Note that this doesn't have to be the work of a virus. It is perfectly
possible in GEMDOS to have two files with the same pathname (whether
this is desirable or documented is another question: you get lots of
problems deleting or accessing one or the other).
I did something like:
    0) Start first program
    1) first program opens the file readonly
    2) Pexec second program
    3) second program opens the same file write-only
    4) writes into the file
    5) closes it and exits
    6) first program closes file and exits
and then I had two copies of the file. The program in question was in
fact a 'more' utility which can fork a 'vi'; this option I no longer
use because of the duplicate files problem.

Perhaps you have an analoguous problem; for instance if your shell for some
reason keeps files opened (e.g. shell scripts, files to which redirection
is done) you will encounter the same problem.
I suggest you check all your tools and programs for weird behaviour by
keeping constant track of the contents of your directories for a while.

Hope this has put you at ease somewhat - it could still be a virus 8-).
Happy virus-hunting!
                         Leo.

dlm@druhi.ATT.COM (Dan Moore) (08/03/88)

in article <880801064254.135611@HIS-PHOENIX-MULTICS.ARPA>, Friesen@HIS-PHOENIX-MULTICS.ARPA says:
> I just decided that the floppy I use to store my word processor files
> and some other misc.  things, probably had a lot of files I could get
> rid of.  I decided to take a look at them and see which ones to throw
> out.  I had never noticed anything strange about this disk before (the
> only time I access the disk is from file selector boxes, and I always
> know exactly what I want) so I really hadn't "looked" at the disk.
> Well, I got the directory up and much to my surprise, there were many
> groups of two files with exactly the same name.  I opened the files
>...
> 
> Aric Friesen
> 
> Addresses:  Genie:  A.FRIESEN ARPA:  Friesen%PCO@BCO-MULTICS.ARPA

	You have just found one of the more bothersome bugs in GEMDOS. 
When GEMDOS opens a file for write it sometimes fails to delete the
current file first.  This means you can end up with 2 (or 50 for that
matter) files with the exact same name.  Most people won't notice that
this has happened since the standard desktop code won't display
duplicates (the sort routine used in DESKTOP.APP deletes duplicated
entries).  Some shells will show duplicated files, some won't.

	FIXES:  Find a shell (eg. Micro C-Shell from BDT) that will
rename a single file, not all files with the same name.  Rename each
duplicate to a scratch name (eg. dup1, dup2, etc.).  Then look at each
copy and decide whether or not to keep it.  Delete all the unwanted ones
and rename the one you kept back to the original name.

	PREVENTION: there is *no* 100% sure way of preventing this from
happening.  It is distantly related to the "40 folder limit" (common
data structures are used for folders and files; sometimes GEMDOS will
create several entries for a single file or folder which can lead to
duplicated files).  I would really suggest using GEMBOOT, it checks the
number of folders online and creates enough entries for them in the
table.  The next best solution is FOLDERXXX.PRG which allows you to add
any number of additional entries to the table.  Finally, reboot on a
semi-regular basis.  That lets you start over with a "virgin" machine,
which is more likely to work correctly.

	I'd also suggest looking at your disks at least once a day (if
you use the machine a lot) to check for duplicated files.  It's also a
good idea to run a disk test program on a regular basis.  Dave Small and
I wrote one called CHK that was published in ST-Log a couple of months
ago.  There are others that seem to work pretty well also.  These
programs will check for errors in the file system on the disk and then
give you a status report based on what they find.  Very similar to what
CHKDSK does for MSDOS.

 ------------------------------------------------------------------------------
	Dan Moore				ex-Data Pacific programmer,
	AT&T Denver				technical support, hardware
	dlm@druhi.ATT.COM			tester and general go-fer.
 ------------------------------------------------------------------------------

neil@cs.hw.ac.uk (Neil Forsyth) (08/04/88)

In article <880801064254.135611@HIS-PHOENIX-MULTICS.ARPA> Friesen%PCO@BCO-MULTICS.ARPA writes:


>
 Intro deleted

>Well, I got the directory up and much to my surprise, there were many
>groups of two files with exactly the same name.  I opened the files
>(they were DOC files so I could view them on the desktop).  One of the
>files had zero K and the other seemed ok.

This sounds like the Fcreate bug that Allan Pratt addressed some time ago.
I was actually going ask if this is fixed in the new ROMs but I guess it
is since he knew about it.
The problem is that Fcreate doesn't check to see if the Fdelete it does to
remove the old file is successful and goes and makes another file.
Being the foolhardy git that I am I would storm in there weilding a disk editor
and change the names of the duplicate names directly. Re-open the disk and
save what was useful.

 _____________________________________________________________________________
/ "I think all right thinking people in this country are sick and tired of    \
! being told that ordinary decent people are fed up in this country with      !
! being sick and tired. I'm certainly not and I'm sick and tired of being     !
! told that I am!" - Monty Python                                             !
!                                                                             !
! Neil Forsyth                           JANET:  neil@uk.ac.hw.cs             !
! Dept. of Computer Science              ARPA:   neil@cs.hw.ac.uk             !
! Heriot-Watt University                 UUCP:   ..!ukc!cs.hw.ac.uk!neil      !
! Edinburgh                                                                   !
! Scotland                                                                    !
\_____________________________________________________________________________/

david@bdt.UUCP (David Beckemeyer) (08/05/88)

It sounds like the TOS directory structure and FAT tables are corrupted.
If you know the layout of TOS disks, you could use a low-level disk
editor to try to repair the damage.

Plug Warning:  The program Hard Disk Sentry will fix these sorts of
problems on floppy disks and hard disk (worse on hard disks becuase
there are a lot more files at stake).  It retails for $49.95.  Sentry
also optimizes (un-fragments) files too.
-- 
David Beckemeyer (david@bdt.uucp)	| "Don't call me Stupid!"
Beckemeyer Development Tools		| "No.  That would be an insult
478 Santa Clara Ave, Oakland, CA 94610	|  to all the stupid people!"
UUCP: {unisoft,sun}!hoptoad!bdt!david 	|         - A fish called Wanda