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

Re: zsh doesn't load HISTFILE from readonly directory



On Mon, 14 Jun 2010 15:05:21 +0100
Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:

> On Sun, 13 Jun 2010 13:17:37 +0000 (UTC)
> JÃrg Sommer <joerg@xxxxxxxxxxxx> wrote:
> > if the directory, containing the history file, is not writeable, zsh
> > doesn't load the data and I've not history.
> 
> Yes, it's returning after not being able to lock the file.  This is
> unhealthy because (1) there's no error, which might be arguable for
> normal interactive history but is certainly wrong for an explicit "fc
> -R" (2) there's no reason why it shouldn't just read the history.
> 
> Not immediately sure how wide the scope of the fix should be.  Get
> locking to check if the file is not writeable for some reason (which
> is a different test from checking if it can be locked)?

That's no good.  In a case like this (where the problem is directory
permissions) we might well still be able to write to the file.  However,
as zsh wouldn't be able to lock it, it would refuse to write to it.
(There's a subtlety that fcntl() file locking might still work but if
you have inconsistent file locking options you're already stuffed.)

> Or should
> we simply issue a warning when and continue any time we can't lock
> the file?

So, as long as we narrow this to make a check for why we couldn't create
the lock (EACCES in this case) maybe this is the right way to go after all?

We still need to decide when we should print an error.  I would be tempted
to do it every time.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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