[18639] in Athena Bugs
Re: linux 8.4.17: zctl
daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Dec 27 16:19:15 2000
Message-Id: <200012272119.QAA05597@nephthys.mit.edu>
To: Ray Jones <thouis@MIT.EDU>
cc: bugs@MIT.EDU
In-Reply-To: Your message of "Wed, 27 Dec 2000 15:54:32 EST."
<200012272054.PAA03530@pixie.mit.edu>
Date: Wed, 27 Dec 2000 16:19:10 -0500
From: Greg Hudson <ghudson@MIT.EDU>
> "strace zctl add..." shows that zctl is making a copy of
> .zephyr.subs in .zephyr.subs.temp, then calling rename to
> replace .zephyr.subs with .zephyr.subs.temp (now just a copy
> of .zephyr.subs), then finally, reopening .zephyr.subs and
> appending the new subscription. This seems a bit of a
> roundabout way of adding a subscription, since the last two
> steps should suffice.
What it's doing in those first two steps is purging any existing
subscription matching the open you're trying to add.
zctl also does the create-and-rename dance when it removes (or
potentially removes) entries from .zephyr.subs. This is to avoid the
failure mode of wiping out your subs file if zctl were to die (due to
^C, resource failure, whatever) in the middle of such an operation.
It would certainly be easy enough to make zctl opportunistically avoid
smashing the symlink when it doesn't have to delete any entries from
the subs file. But that would merely make it unpredictable whether
the symlink gets smashed. Actually fixing the problem requires making
zctl know how to follow symlinks, which is harder.