Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Failing to write to history file if containing directory doesn't exist



On Wed, Oct 17, 2007 at 01:16:23PM +0200, Richard Hartmann wrote:
> On 09/10/2007, Matthew Wozniski <godlygeek@xxxxxxxxx> wrote:
> > Along that vein, and still leaning towards a solution in shell code,
> > might it be reasonable to put a precmd hook into the default
> > /etc/zshrc to check up on HISTFILE?  That seems like a compromise that
> > allows everyone to get it but for it still to be maintained in shell,
> > rather than c.
> 
> Perhaps check when the shell starts and in the history write function.
> precmd should be as light as possible.

As Bart noted earlier in this thread, history writes occur once per
command anyway for users with SHARE_HISTORY or INC_APPEND_HISTORY set.
And a solution handled during a history write can't be handled
directly in shell code.  That's exactly what my suggestion was aimed
at avoiding.  The only advantage I can see to handling it in C would
be that it would add only one extra instruction for an unexceptional
write (if (errno != ...) ) instead of the full cost of a glob and
a parameter expansion, which are presumably much more expensive.  But,
either way, I'm still against this proposed feature; I still find it
to be unnecessary at best.

~Matt



Messages sorted by: Reverse Date, Date, Thread, Author