zsh-users
 help / color / mirror / code / Atom feed
* locking failed for /home/whoever/.zhistory: no such file or directory
@ 2011-07-10 14:22 Cesar Romani
  2011-07-10 16:53 ` Peter Stephenson
  2011-07-10 17:13 ` Bart Schaefer
  0 siblings, 2 replies; 8+ messages in thread
From: Cesar Romani @ 2011-07-10 14:22 UTC (permalink / raw)
  To: zsh-users

I'm using zsh 4.3.12-dev-1
Whenever I start zsh I always get the following message:
zsh: locking failed for /home/whoever/.zhistory: no such file or 
directory: reading anyway

and when I exit the shell I get:
zsh: locking failed for /home/whoever/.zhistory: no such file or directory

But the file .zhistory is present on my system, on /home/whoever and my
HOME is set to /home/whoever
I tried to delete and create .zhistory again, but it's no use.
On my .zshrc I have, among other things:

export HISTSIZE=200
export HISTFILE=~/.zhistory
export SAVEHIST=200

Many thanks in advance,

-- 
Cesar


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-10 14:22 locking failed for /home/whoever/.zhistory: no such file or directory Cesar Romani
@ 2011-07-10 16:53 ` Peter Stephenson
  2011-07-13 13:50   ` Cesar Romani
  2011-07-10 17:13 ` Bart Schaefer
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2011-07-10 16:53 UTC (permalink / raw)
  To: zsh-users

Cesar Romani wrote:
> I'm using zsh 4.3.12-dev-1
> Whenever I start zsh I always get the following message:
> zsh: locking failed for /home/whoever/.zhistory: no such file or 
> directory: reading anyway

That means a system call to lock the file for reading failed.  It
depends on the file system whether locking is enabled.  So long as you
are not attempting to use the history file with multiple terminals at
once, you shouldn't hit problems.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-10 14:22 locking failed for /home/whoever/.zhistory: no such file or directory Cesar Romani
  2011-07-10 16:53 ` Peter Stephenson
@ 2011-07-10 17:13 ` Bart Schaefer
  1 sibling, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2011-07-10 17:13 UTC (permalink / raw)
  To: Cesar Romani, zsh-users

On Jul 10,  9:22am, Cesar Romani wrote:
} Subject: locking failed for /home/whoever/.zhistory: no such file or direc
}
} I'm using zsh 4.3.12-dev-1
} Whenever I start zsh I always get the following message:
} zsh: locking failed for /home/whoever/.zhistory: no such file or 
} directory: reading anyway

This probably means that your system doesn't support zsh's preferred
form of locking, so zsh is trying to create a file in the directory
named by your $TMPPREFIX.  Does *that* directory exist?  What do you
see if you run

    print =(:)

?  Do you change TMPPREFIX at any time in your startup files?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-10 16:53 ` Peter Stephenson
@ 2011-07-13 13:50   ` Cesar Romani
  2011-07-13 14:01     ` Peter Stephenson
  0 siblings, 1 reply; 8+ messages in thread
From: Cesar Romani @ 2011-07-13 13:50 UTC (permalink / raw)
  To: zsh-users

On 10/07/2011 11:53 a.m., Peter Stephenson wrote:
 > Cesar Romani wrote:
 >> I'm using zsh 4.3.12-dev-1
 >> Whenever I start zsh I always get the following message:
 >> zsh: locking failed for /home/whoever/.zhistory: no such file or
 >> directory: reading anyway
 >
 > That means a system call to lock the file for reading failed.  It
 > depends on the file system whether locking is enabled.  So long as you
 > are not attempting to use the history file with multiple terminals at
 > once, you shouldn't hit problems.

But my .zhistory is always empty. Isn't there a workaround for it?
With zsh 4.3.10 I didn't have that problem.

Best regards,

-- 
Cesar


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-13 13:50   ` Cesar Romani
@ 2011-07-13 14:01     ` Peter Stephenson
  2011-07-13 14:54       ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2011-07-13 14:01 UTC (permalink / raw)
  To: zsh-users

On Wed, 13 Jul 2011 08:50:07 -0500
Cesar Romani <cesar.romani@gmail.com> wrote:
> On 10/07/2011 11:53 a.m., Peter Stephenson wrote:
>  > Cesar Romani wrote:
>  >> I'm using zsh 4.3.12-dev-1
>  >> Whenever I start zsh I always get the following message:
>  >> zsh: locking failed for /home/whoever/.zhistory: no such file or
>  >> directory: reading anyway
>  >
>  > That means a system call to lock the file for reading failed.  It
>  > depends on the file system whether locking is enabled.  So long as you
>  > are not attempting to use the history file with multiple terminals at
>  > once, you shouldn't hit problems.
> 
> But my .zhistory is always empty. Isn't there a workaround for it?
> With zsh 4.3.10 I didn't have that problem.

You did have the problem, but the shell didn't warn you it wasn't going
to be able to manage history safely.

Is there a good reason you need to have the .zhistory file even though
it's empty?  If not, delete it, or if this means you aren't using
history files at all unset HISTFILE in ~/.zshrc.

If there's a good reason to have a valid HISTFILE variable pointing to a
file that's empty, we can add a special case to test for a zero file
before reading, but I can't offhand think of a case why you need this.

-- 
Peter Stephenson <pws@csr.com>            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
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-13 14:01     ` Peter Stephenson
@ 2011-07-13 14:54       ` Bart Schaefer
  2011-07-13 18:53         ` Peter Stephenson
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2011-07-13 14:54 UTC (permalink / raw)
  To: zsh-users

On Jul 13,  3:01pm, Peter Stephenson wrote:
} Subject: Re: locking failed for /home/whoever/.zhistory: no such file or d
}
} > But my .zhistory is always empty. Isn't there a workaround for it?
} > With zsh 4.3.10 I didn't have that problem.
} 
} You did have the problem, but the shell didn't warn you it wasn't going
} to be able to manage history safely.
} 
} Is there a good reason you need to have the .zhistory file even though
} it's empty?

I think he means zsh is never writing anything to the file, not that it
is intentionally always empty.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-13 14:54       ` Bart Schaefer
@ 2011-07-13 18:53         ` Peter Stephenson
  2011-07-14 15:04           ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2011-07-13 18:53 UTC (permalink / raw)
  To: zsh-users

On Wed, 13 Jul 2011 07:54:44 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jul 13,  3:01pm, Peter Stephenson wrote:
> } Subject: Re: locking failed for /home/whoever/.zhistory: no such file or d
> }
> } > But my .zhistory is always empty.
> } 
> } Is there a good reason you need to have the .zhistory file even though
> } it's empty?
> 
> I think he means zsh is never writing anything to the file, not that it
> is intentionally always empty.

That's not related to the locking problem, though, is it?

It's very easy to ignore empty files completely.  We always stat anyway
in the "fast" case, so this only adds the operation in the normal case,
where an extra stat is lost in the noise.

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.113
diff -p -u -r1.113 hist.c
--- Src/hist.c	12 Jul 2011 08:37:11 -0000	1.113
+++ Src/hist.c	13 Jul 2011 18:50:15 -0000
@@ -2246,10 +2246,12 @@ readhistfile(char *fn, int err, int read
 
     if (!fn && !(fn = getsparam("HISTFILE")))
 	return;
+    if (stat(unmeta(fn), &sb) < 0 ||
+	sb.st_size == 0)
+	return;
     if (readflags & HFILE_FAST) {
-	if (stat(unmeta(fn), &sb) < 0
-	 || (lasthist.fsiz == sb.st_size && lasthist.mtim == sb.st_mtime)
-	 || lockhistfile(fn, 0))
+	if ((lasthist.fsiz == sb.st_size && lasthist.mtim == sb.st_mtime)
+	    || lockhistfile(fn, 0))
 	    return;
 	lasthist.fsiz = sb.st_size;
 	lasthist.mtim = sb.st_mtime;


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: locking failed for /home/whoever/.zhistory: no such file or directory
  2011-07-13 18:53         ` Peter Stephenson
@ 2011-07-14 15:04           ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2011-07-14 15:04 UTC (permalink / raw)
  To: zsh-users

On Jul 13,  7:53pm, Peter Stephenson wrote:
} Subject: Re: locking failed for /home/whoever/.zhistory: no such file or d
}
} On Wed, 13 Jul 2011 07:54:44 -0700
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} > 
} > I think he means zsh is never writing anything to the file, not that it
} > is intentionally always empty.
} 
} That's not related to the locking problem, though, is it?

It might be -- that is, they might both stem from the same underlying
cause, which is probably an issue with his system (perhaps his home
directory permissions, for example, though I'm at a loss as to the
exact reason).  But the point is that his runtime history is non-empty
and he's set SAVEHIST to a non-zero value, yet nothing is ever written
to the file, so *something* is failing, and the only error he's seeing
is the lock warning at startup.

Maybe starting a login shell ("zsh -l" for those who don't know) from
within another shell, and then exiting from that inner shell, would
provide an opportunity to see error messages that are otherwise being
hidden by the closing of a terminal emulator window or the like.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-14 15:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-10 14:22 locking failed for /home/whoever/.zhistory: no such file or directory Cesar Romani
2011-07-10 16:53 ` Peter Stephenson
2011-07-13 13:50   ` Cesar Romani
2011-07-13 14:01     ` Peter Stephenson
2011-07-13 14:54       ` Bart Schaefer
2011-07-13 18:53         ` Peter Stephenson
2011-07-14 15:04           ` Bart Schaefer
2011-07-10 17:13 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).