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 09/10/2007, Matthew Wozniski <godlygeek@xxxxxxxxx> wrote:

> > History is only maintained for interactive shells, so you might get
> > more traction with an option to prompt the user to create the directory
> > and/or fix $HISTFILE when the file does not exist or is not writable.

If such an option were introduced, it could have potential security issues,
leaving a shell open that the user expects to close immediately (insert
CHECK_JOBS and HUP reference here).

> 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.


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