Zsh Mailing List Archive
Messages sorted by:
Re: adding history logging "automagically" :)
- X-seq: zsh-workers 23668
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: adding history logging "automagically" :)
- Date: Mon, 09 Jul 2007 17:47:50 -0700
- In-reply-to: <3cb6e920707091041t3b3f5c1cy7d7b08e6028c22f9@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <3cb6e920707091041t3b3f5c1cy7d7b08e6028c22f9@xxxxxxxxxxxxxx>
On Jul 9, 1:41pm, Joe D wrote:
} So in a nutshell, all I want to do is modify 'zsh' source
Ick. Don't do that.
} to always do the following options automatically (regardless of if
} these lines are present or not):
} setopt APPEND_HISTORY
} setopt SHARE_HISTORY
} setopt INC_APPEND_HISTORY
I don't think you want SHARE_HISTORY - that means the shells pass the
current history around among themselves while they are running. You
don't really want Alice to see Bob's commands, do you?
Also I think APPEND_HISTORY is redundant with INC_APPEND_HISTORY, but
it probably won't hurt anything.
In any case you're going to be defeated here by a zsh security feature
that prevents the shell from using a history file that is owned and/or
writable by someone else. Each shell will try to assume ownership of
the file and remove group/other write permission, so there will be a
mad scramble of unlinking/recreating of the file as each shell notices
that one of the others has tried to grab it. That's probably why you
can't find the file even though you can find the lock.
The best you might be able to do is
so that every user has his or her own history file in some_location.
Beyond that, I suggest placing
if [[ $USER = (list|of|problem|users) ]]; then
in /etc/zshenv, which is always run (unless the shell was configured
with --disable-zshenv). Using EXTENDED_HISTORY will give you time
stamps on the entries, so you can combine and sort the users' log
files to determine the order of events.
They could still deliberately mess you up by frobbing those setopts
later ... so I suppose if you must hack the source, the place to put
your dosetopt() calls would be in Src/init.c, in loop(), with an
"if (toplevel)" test protecting them. But if your users are so badly
behaved as to ignore your instructions to leave those options alone,
you have worse problems than just tracking down what happened when.
Messages sorted by: