Subject: Mac Aliases changing

From: Matt McLean <[email-masked]>
Date: Mon, 23 Jun 1997 17:54:21 -0400 (EDT)

Folks,

Netatalk 1.4b2 on Solaris 2.5.1, no afs.

I have more than one Mac user who claims to have made an alias to a
folder on the Sun box that, overnight, 'changed' and now points to a
different directory on the Sun box.  Anyone else seen this?  They've
done it several times, so I don't think they are the ones messing up.

Peace,
--
  Matt McLean                                      Systems Administrator
  School of Information & Library Studies                  Tifosi

---

From: James Herre <[email-masked]>
Date: Fri, 27 Jun 97 11:21:03 -0500

>  I've followed the discussion for some time, and I think
>  Helios (Ethershare) has done "the right thing" in this
>  case:
>
>  First, they have a single database for each volume,
>  .Desktop, holding APPL-Signatures, Icons, and the file-
>  and directory id database. This db is managed by a single
>  process, called desksrv. The afp server processes
>  communicate with the desksrv via RPCs.  Second, they have
>  the id of each file/directory stored in a file named
>  ".rsrc/<file/directory name>". This is to reduce RPC
>  overhead, as afp servers open this file anyway to get
>  the finder information, and to rebuild the desktop
>  database if it became corrupted.
>
>  I'm working on this approach inside netatalk for 3 moths
>  now (in my spare time, which is not that much :-()

I think you're correct that the "right" way to do this is to run
separate server.  I'm wondering whether the ".rsrc/<file/directory name>"
files might get messed up if you have overlapping afpd's (eg multiple servers
exporting the same dirs via NFS)?

Anyway,  I'm the person who keeps babbling about hash functions. Below is the  
function used to assign new DID's into the afpd tree in the version we use.    
This returns a DID which is both unique and invariant. It doesn't require any  
RPC, IPC, files or file locking.  The only problems are that it won't  
"always" work (the worst that will happen is that an alias will fail to find  
its original) and that it makes aliases work slightly differently than they do  
on a regular AppleShare server (if you move the original the alias is stops  
working).

Still, if you're lazy like me, you might consider this approach.  It will  
make your aliases work a very high percentage of the time and, personally, I  
prefer aliases that break if you move or rename the original.

-J

--------------------------------------------------------
Jamie Herre
Gettys Group Software, Inc.
[email-masked]

#ifdef ALIAS_FIX
/* hash function used to generate directory ids (jfh 3/3/96)
   I admit that very little thought went into this hash.
*/
static int dirnamehash( vol, directory_path )
	struct vol	*vol;
	char	*directory_path;
{
	const char		*p;
	unsigned int	result = 0;

	for (p=directory_path; *p; p++) {
		result = result * 33 + *p;
	}
	while (result < 5 || dirsearch(vol, htonl(result)) != NULL) {
		syslog( LOG_DEBUG, "hash collision: %s", directory_path );
		result += 1;
	}
	return htonl( result );
}
#endif