From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27881 invoked from network); 10 Jul 2007 00:48:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Jul 2007 00:48:07 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 89760 invoked from network); 10 Jul 2007 00:48:01 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Jul 2007 00:48:01 -0000 Received: (qmail 14089 invoked by alias); 10 Jul 2007 00:47:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23668 Received: (qmail 14080 invoked from network); 10 Jul 2007 00:47:57 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 10 Jul 2007 00:47:57 -0000 Received: (qmail 89438 invoked from network); 10 Jul 2007 00:47:57 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 10 Jul 2007 00:47:54 -0000 Received: from torch.brasslantern.com ([71.116.90.58]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JKX008KHU7R9GT3@vms048.mailsrvcs.net> for zsh-workers@sunsite.dk; Mon, 09 Jul 2007 19:47:52 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id l6A0lo7S011344 for ; Mon, 09 Jul 2007 17:47:51 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id l6A0los0011343 for zsh-workers@sunsite.dk; Mon, 09 Jul 2007 17:47:50 -0700 Date: Mon, 09 Jul 2007 17:47:50 -0700 From: Bart Schaefer Subject: Re: adding history logging "automagically" :) In-reply-to: <3cb6e920707091041t3b3f5c1cy7d7b08e6028c22f9@mail.gmail.com> To: zsh-workers@sunsite.dk Message-id: <070709174750.ZM11342@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <3cb6e920707091041t3b3f5c1cy7d7b08e6028c22f9@mail.gmail.com> Comments: In reply to "Joe D" "adding history logging "automagically" :)" (Jul 9, 1:41pm) 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): } } HISTSIZE=1000 } SAVEHIST=1000 } HISTFILE=/opt/some_location/.user.log } 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 HISTFILE=/opt/some_location/.$USER.log 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 readonly HISTSIZE=1000 readonly SAVEHIST=1000 readonly HISTFILE=/opt/some_location/.$USER.log setopt APPEND_HISTORY setopt INC_APPEND_HISTORY setopt EXTENDED_HISTORY fi 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.