[comp.unix.aux] Desktop info lost after a 'soft' crash

liam@cs.qmw.ac.uk (William Roberts;) (02/06/91)

In <1417@ucl-cs.uucp> J.Purchase@cs.ucl.ac.uk (Jan Purchase) writes:


>1) Why is it that when I log in under another account that has read
>permission on my home directory and I examine that directory with the
>Finder, that the layout is as the default (all large icons, black, in some
>weird order, with a blank in the top left icon space). Yet when I log in
>under my account the layout is once again as I'd set it.

The desktop for the "/" volume is handled by the Desktop Manager using files 
in the System Folder, but the "desktop" itself - position of disk icons, 
folders etc on the desktop, is stored in a subdirectory $HOME/.desk with one 
file per hostname. As two different users, you get two different home 
directories and so two different .desk directories. This might not answer your 
question, but it is what I know on the subject and might give you some clues.

>2) More irksome. Why after a soft crash (CommandShell dies due to a Finder
>crash and A/UX logs you out) is all this desktop info revert to the
>default!! I'm really cheesed off with having to re-arrange my icons every
>time I or some other user soft-crashes the machine (doesn't happend too
>often, but often enough).

The file structures used are not at all robust - it is easy to ruin the whole 
desktop database as well as your preferred settings.
--

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)

ron@afsg.apple.com (Ron Flax) (02/06/91)

In article <1417@ucl-cs.uucp> J.Purchase@cs.ucl.ac.uk (Jan Purchase) writes:
>
>I often customize the layout of the hierarchy under my home directory by
>using the Finder to colour, group and convert-to-small-icons the files
>therein. Indeed I often colour code and group files so that I can
>immediately grasp how important they are and how they are related.

Understood.

>
>I've noticed two things about how A/UX (the CommandShell at least) handles
>this desktop information that concerns me:

Actually it's not the CommandShell, it's startmac.

>1) Why is it that when I log in under another account that has read
>permission on my home directory and I examine that directory with the
>Finder, that the layout is as the default (all large icons, black, in some
>weird order, with a blank in the top left icon space). Yet when I log in
>under my account the layout is once again as I'd set it. I would understand
>this behaviour if each user had an individual System Folder (and thus
>desktop info), but currently all users share the System Folder in
>"/mac/sys/System Folder" (with mode 0777)

The fact that _all_ users are sharing the same System Folder *is* your
problem here.  It's not actually the System Folder but rather it is the
desktop database files; "Desktop DB", "Desktop DF", the file system
cache; ".fs_cache", and the file system directory IDs file; .fs_dirIDs
in the System Folder.  These files are used by the A/UX File Manager to
keep track of the things you refered to above. (ie., window placement,
icon color, placement, size, etc.. and so on..)  When a different user
logs on, with different access permissions their view of the file
systems changes, and hence changes the contents of these files.  One
solution is to have individual System Folders per user.  That way each
user can have his or her own view and not corrupt the "global" view.

>2) More irksome. Why after a soft crash (CommandShell dies due to a Finder
>crash and A/UX logs you out) is all this desktop info revert to the
>default!! I'm really cheesed off with having to re-arrange my icons every
>time I or some other user soft-crashes the machine (doesn't happend too
>often, but often enough).

The reason for this is due to the fact that when a crash occurs the
desktop files are left in a corrupt state, and the A/UX File Manager
simply rebuilds them from scratch.

I was upset about this one too... here's what I do as a work around.  I
have two small scripts which I will list at the end of this posting that
I use to save and restore a "known to be good" set of desktop database,
cache and dirIDs files.  I normally login to the Console Emulator,
then I start the Mac environment by hand by typing 'mac32'.  After I
have made significant changes to my environment (moved icons, colored
them, etc..) I exit from the Mac environment, then I execute the script
labeled "savedesk", which saves a backup copy of the Desktop DB, Desktop DF,
.fs_cache, and .fs_dirIDs files.  If I should crash my Mac environment
at some later time, I just exit the environment, and execute the "fixdesk"
script to restore my saved set.  This seems to work rather well and I
have been doing it since A/UX 2.0 started shipping with excellent
results.

--
Ron Flax
ron@afsg.apple.com	
Apple Federal Systems Group


#
# @(#) savedesk.sh
#
if [ ! -d /mac/sys/.save ]; then
	mkdir /mac/sys/.save
fi
cp "/mac/sys/System Folder/.fs_cache" /mac/sys/.save
cp "/mac/sys/System Folder/.fs_dirIDs" /mac/sys/.save
cp "/mac/sys/System Folder/Desktop DB" /mac/sys/.save
cp "/mac/sys/System Folder/Desktop DF" /mac/sys/.save
#


#
# @(#) fixdesk.sh
#
cp "/mac/sys/.save/.fs_cache"  "/mac/sys/System Folder/"
cp "/mac/sys/.save/.fs_dirIDs"  "/mac/sys/System Folder/"
cp "/mac/sys/.save/Desktop DB" "/mac/sys/System Folder/"
cp "/mac/sys/.save/Desktop DF" "/mac/sys/System Folder/"
#

urlichs@smurf.sub.org (Matthias Urlichs) (02/06/91)

In comp.unix.aux, article <1417@ucl-cs.uucp>,
  J.Purchase@cs.ucl.ac.uk (Jan Purchase) writes:
< 
< I've noticed two things about how A/UX (the CommandShell at least) handles
< this desktop information that concerns me:
< 
[ General Desktop problems ]

< What have I misunderstood? 
< 
The Desktop information is stored in a bunch of special filess in your System
folder. These belong to you, and they are marked invalid when the MacOS
crashes.
To fix that, you create two scripts named "save" and "restore":

~/bin/save:
#!/bin/csh
cd ~/System?Folder
cp .fs_* Desk* Backup

~/bin/restore:
#!/bin/csh
cd ~/System?Folder
cp Backup/.fs_* Backup/Desk* .

Also create a folder named "Backup" in your System Folder.

Now, each time you quit the MacOS subsystem normally, you say "save".
Each time you crash it, you say "restore".

You'll have to start in the Console emulator and call "mac32" or "mac24"
manually, of course. I don't know if the exit status of startmac (or
startmac24) tells whether there was a crash -- then you may be able to
incorporate this into the standard startup scripts (they're in /mac/bin).

-- 
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de     /(o\
Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(0700-2330)   \o)/

ron@afsg.apple.com (Ron Flax) (02/08/91)

In article <2900@redstar.cs.qmw.ac.uk> liam@cs.qmw.ac.uk (William Roberts;) writes:
>The desktop for the "/" volume is handled by the Desktop Manager using files 
>in the System Folder, but the "desktop" itself - position of disk icons, 
>folders etc on the desktop, is stored in a subdirectory $HOME/.desk with one 
>file per hostname. As two different users, you get two different home 
>directories and so two different .desk directories. This might not answer your 
>question, but it is what I know on the subject and might give you some clues.

Actually this is incorrect.  The $HOME/.desk/<hostname> files only
contains position info for objects that are "on the desktop", on a per
usr basis.  So things like your $HOME Folder get mounted on the desktop
for easy access, and if you place files/folders onto the desktop they
too will be remembered here.  But that's all that .desk is used for.
The rest of the desktop database is stored in the System Folder in 4
files: Desktop DB, Desktop DF, .fs_cache, and .fs_dirIDs.

--
Ron Flax
ron@afsg.apple.com	
Apple Federal Systems Group

liam@cs.qmw.ac.uk (William Roberts;) (02/13/91)

The .desk/* files are ASCII text and human readable (sort of) - just look at 
one and you'll get the idea.

The Desktop D? files are associated with the Desktop Manager (according to the 
/FILES summary of the A/UX 2.0 distribution) and hold details like the icons 
associated with files and the whereabouts of the applications associated with 
particular document types.

The .fs_* files are something different again, presumably part of the 
emulation which makes the UNIX filestore useable by the Finder etc - 
.fs_dirIDs is clearly human readable....
--

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)