If I point the history file to /tmp it works (but no lock file is created).
The lock file is deleted if the history file has been successfully read.
There are a lot of .zsh_history.PID-files in ~/
Zsh first create .zsh_history.xxxxxx and makes a hard link of it as the name .zsh_history.LOCK, and deletes .zsh_history.xxxxxx. So I guess zsh hangs when it tries to make a hard link.
The following is a quick memo of how to debug a running (or hanging) zsh:
First, setup Terminal.app so that you can open a Terminal window with a working shell (bash, tcsh, etc.). I guess you know how to do this (or already did this).
Then oepn a Terminal window (in which bash/tcsh is running), and start a zsh in the window; the zsh hangs, right?
Then open another Terminal window, and use
ps command to find the PID of the zsh which is hanging. Also try to figure out whether the zsh is running (consuming the CPU cycle) or just waiting (sleeping); the STAT field in the output of ps command may contain 'R' if the zsh is running (You can also use the top command or the Activity Monitor.app).
Now in the new window, run
gdb as
gdb /bin/zsh nnn
where
nnn is the PID of the zsh. Then in the (gdb) prompt, type
(gdb) where
This prints the stack frames; #1 is the function in which the zsh is now, #2 is the function which called #1, etc.
If you can build zsh binary from the source code, then download the source code from the zsh website (or ftp server), and configure it with --enable-zsh-debug
./configure --enable-zsh-debug
make
make install (install into /usr/local/bin)
Then run the zsh you have just built (/usr/local/bin/zsh). If it hangs, then (in another window) go to the Src directory of the zsh and debug the hanging zsh by
gdb zsh nnn. Now you can do source-level debugging.
PowerMac G4 Mac OS X (10.4.5)