Subject: Re : [netatalk-admins] Network Trash Folder

From: "Yann Bizeul" <[email-masked]>
Date: Thu, 11 Mar 1999 11:27:29 +0000

No problems with network trash folder

U must set recursively the group sticky bit with write permission, and that
works fine... for me !

----------
>De : Michael Han <[email-masked]>
>À : Rick Zeman <[email-masked]>
>Cc : "netatalk" <[email-masked]>
>Objet : Re: [netatalk-admins] Network Trash Folder
>Date : Jeu mars 1999 6:41
>

> Previously...
>>Hmm, I have the opposite problem.  Network Trash won't work.  Anything
>>placed in the Mac's trash has to be deleted immediately.  I see that
>>there is a Network Trash Folder in my home directory (with 707 perms, me
>>user and group) with multiple Trash Cans in it--with all of the files
>>that I thought had been trashed.
>
> Hrmm, it's been a while since this was fully hashed out, but I seem to
> recall that disabled byte-locking is the spoilsport. There's a "Trash
> Can Usage Map" (?) or somesuch hiding in the "Network Trash Folder"
> and it tracks what AFP user is using what "Trash Can #N" subfolder for
> trash. By not being able to byte-lock this file, only the first Trash
> user gets a normal Trash and subsequent users are Trash-less.
>
> There's also an unrelated problem, I believe, with the default mode
> (707) the Mac creates the "Network Trash Folder" with, and that it
> attempts to set the Group to "none", which is GID 0 in AFP...
> Naturally, GID 0 isn't unowned on Unix filesystems. Hence a "Network
> Trash Folder", when created by an AFP client, tends to be mode 707,
> owned by that user, group owned by the user's gid. This can be a
> problem if all your users are in the same group, as would be the
> case in a RedHat install (all in "users"), since mode 707 group users
> is locked out for anyone in the users group...
>
> The permissions/gid problem you can finesse. Or at least you can hack
> around it. The other problem's trickier. There's a gruesome hack
> reported here (was it Bob at h-e.com? sorry, forget your surname) that
> fixes the other problem. In it, you pre-create "Trash Can #N"
> subfolders, mode 700, one per user owned by that user... Ick. But it
> does work. Or did about 10 months ago when I first saw this problem
> reported.
>
> Anyone know if my info's dated? I haven't been keeping up with the
> netatalk sources for a couple months, so I don't know what's been
> happening, unless it's been in one of asun's announcements.
> --
> [email-masked]
> I will not pledge allegiance to Bart
>  - The collected wisdom of Bart Simpson

---

From: [email-masked] (Bob Smith, Hammett & Edison, Inc.)
Date: Thu, 11 Mar 1999 13:18:56 -0800

>does work. Or did about 10 months ago when I first saw this problem

Hi, Michael!  It's Bob _Smith_, I can see how easy that is to forget, what
with the funny spelling and all <G>.

Anyway, as far as I know this "hack" still works.  Certainly it does for older
netatalk releases (i.e. 1.4b2), but I've not tried it on the latest asun
version.  Below is a copy of my original posting, for those interested.  Mike
is right, it is "icky", but it does work!  One of these days somebody will
figure out exactly what is going on with the shared Trash.

Actually, if anyone out there is still thinking about this problem, I stumbled
on an interesting clue the other day.  The Mac will give the "Can't be left in
trash, delete immediately" message when the Trash is used on a _private_
volume if the volume has been mounted and the Trash used from a _different_
Mac.  In other words, assume that volume V is usually mounted and used only
from Mac A.  Now, Mac A is off-line and the user instead mounts V from Mac B,
and uses the Trash (the message sometimes appears from Mac B in this
situation, but not always).  When returning to Mac A, the first attempt to use
the Trash on V will _always_ give the "delete immediately" response.  Second
and subsequent attempts to use the Trash work fine.  However this will _not_
happen if V was merely mounted and accessed from B, the Trash has to actually
be _used_ from B.  This suggests something going on with the modification time
on the Trash folder(s), doesn't it?  I'd really love to spend a couple of days
attacking this, if only I didn't have all this annoying "real work" stuff to
do...

***

>From: [email-masked]      Thu, Mar 26 1998 19:21
>To: [email-masked]
>cc: bsmith
>[netatalk-admins] Work-around for the shared Trash problem
>
>As I promised a while back (and prompted by Harry's post about his
>"shoot-out" of Linux/netatalk vs. NT vs. etc.), here is the work-around
>I have been using to allow the Trash to be shared on an afpd volume.  This
>isn't going to work for everyone, it's only manageable if you have a
>relatively small number of potential Trash users on the volume.  Also,
>the "real" problem that prevents the client from creating Trash folders on
>its own is still lurking somewhere, the work-around really shouldn't be
>necessary, but for now it does the trick.
>
>First, apply the patch to afpd that is attached to this message and
>re-compile.
>
>Two versions of the patch file are attached, one for base 1.4b2 and one for
>1.4b2+asun2.0a18.2, be sure to get the correct one.  This fixes what might
>be a bug in afpd, or it might just be an otherwise non-existent problem
>that is being created by doing funky things with the Trash folders (see a
>more detailed explanation below, if you're curious).

I have no idea how this patch would behave on the latest asun release, or even
if it is still necessary with asun, so I haven't included the asun version of
the patch this time.  The version that applies to 1.4b2 is attached, it isn't
complicated, it patches just one routine in one file, so you can probably work
out how to apply it to asun if needed.

>
>Next, from the Unix side of things, create a set of "Trash Can #N"
>directories >starting at #2 (i.e. "Trash Can #2", "Trash Can #3", etc.)
>inside the "Network Trash Folder" in the afpd volume root.  Create one
>folder for each user who needs to use the Trash on the volume.  This is
>why this only works for a few users; I have 12 users, and it works fine
>for that number, but if you had hundreds of these things to create I'm
>not sure it would fly.  Each of these directories must be owned by one
>of the specific users needing the Trash, and must have mode 700.  If
>any one of the "Trash Can #N" folders is group or world read or
>read/write, the whole thing won't work, so be sure to get the owners
>and modes right.  Finally, "chmod a-w" the "Network Trash Folder" itself,
>so the "Trash Can #N" directories can't be removed by afpd.
>
>Now shared Trash should work!  Everyone who mounts the volume with a user
>identity matching one of the "Trash Can #N" directories will be able to
>use the Trash, and all those users can put things in the Trash at the
>same time.  For any user who doesn't have a "Trash Can #N" owned by them,
>they will simply get the "can't be left in Trash, delete immediately?"
>bit.
>
>If you're interested, here is further explanation of the afpd patch.  The
>patch fixes the afp_moveandrename function to keep it from failing on a
>move or rename if an ".AppleDouble" directory doesn't already exist in
>the destination directory (the patch causes it to create the directory
>when it isn't there).  The problem occurs because the Mac client attempts
>to completely delete it's "Trash Can #N" when the volume is un-mounted.
>Although the directory itself stays put because "Network Trash Folder"
>is write-protected, everything inside the directory goes away, including
>the ".AppleDouble" directory.   Later when the volume is re-mounted,
>files are put in the Trash by afp_moveandrename calls, and since the
>".AppleDouble" directory isn't there, the moves fail; actually, the
>files get "broken" - the data files move, but the header/resource files
>stay where they were.  The chances of this happening outside these
>pre-created Trash folders is probably next to nil unless you deliberately
>tried to cause it, so whether this would really be classified as a bug or
>not is open to debate.  But if you're going to try this work-around for
>the Trash you have to apply the patch.
>
>I've been running with this setup for about two weeks, with a dozen people
>making moderate to heavy use of several shared volumes, and it continues
>to function just fine.  But I only have a single system to test this on and
>I have no idea what problems might crop up in other environments, so I
>still have to say "use at your own risk"!
>

Hope this helps!

Bob Smith
Hammett & Edison, Inc.
[email-masked]

(This file must be converted with BinHex 4.0)
:%@&QF'3YE@pfC@*eCbjND@CQ!&4&@&45+Q0S!3!!!!C*!!!!!+ee+LSU)'9dBbp
KCR"N,fCTE'8ZBbd*8f&d)%eKFL!a0#!a0$Sc0MS`0L!a16Ni#LdY,5"PG'-[B@C
`C#pQD@aP,Q-*6@pZ)%eKFL!a0L!`-6S`0$Sd-L!a16Ni#LSU+LSU+LSU+LSU+LS
U+JSU+LSJ0$-f,$3d-L!U+LSU#L!JH`SJ)#!J)#"cG(*eBh3JB@4[G@*XC3PKC$X
+)#!J)#!JFh4bG@0d)(0dBA3*#A0d1`SK)#!J)#"MD'&b#3PKC(0bBeXJ68&B8%&
85%a&6L"G1`SJ)#!J)#"TER3*#3PXC@iX)(*M1`SJ)!SJ)#!J)#![+JSY,5dJ0$-
f,$3d-L!Y,5dY#L!JH`SJ)#!J)#"cG(*eBh3JB@4[G@*XC3PKC$X+)#!J)#!JFh4
bG@0d)(0dBA3*#A0d1`SK)#!J)#"MD'&b#3PKC(0bBeXJ68&B8%&85%a&6L"G,#!
UB@4NFh3X)#TcE'&cD$X+)#!J)#!JD@jd#3N*E'9Z,#"bBcX+)#!+)#!J)#!J,bS
++LSU+LSU+LSU+LSU+LSU#LSU+L!d0MJX0$Fh)#SU+LS+)#!J)#!JI3SJ)!SJ)#!
J)#"cG(*MF(NS)'&NFh*M,#"KC&p`BA4S+#"cFQ-X)$!J+5Nl#L%J)#!J)'PQ)#J
JFQ9ZB@eP+#"KC(0bBb`JB@4IF'&dD#JJC(0d,#!`)#NT)$`J-#!T)(X+)#!*FhG
TG'0S)#JJCA*bEQmJ+5"l#L!J#@0KFf8J48j248j8)$S+)5!*)#!J)(*PG(9bELJ
J38C3Adp,)#Nl#L!J#@0KFf8J48&$3d96)$S+)#!*)#!J)(*P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