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

Re: Unable to read history on latest Cygwin



On Wed, 16 Dec 2009, Wayne Davison wrote:

On Mon, Dec 14, 2009 at 6:19 AM, Thorsten Kampe
<thorsten@xxxxxxxxxxxxxxxx>wrote:

The result of that is that I'm not able to run zsh "portable" from a
FAT32 USB thumb drive: "zsh: failed to create hard link as lock file
/home/thorsten/.zhistory.LOCK: operation not permitted".

One simple possibility is to change the two #ifdef HAVE_LINK lines in hist.c
to this:

#if defined HAVE_LINK && !defined __CYGWIN__

I'll get to testing that possible usage, as well as Peter's proposed code
changes, once I get a few spare cycles...

That should make it use the open with O_EXCL, which is hopefully atomic.

Hmm...atomic in the sense that the open vectors through the symlink to
the real file?  Yes, I believe it's "atomic" in that sense.

As for Peter's idea of using a symlink, do you know if the cygwin folks
mention if their emulation of a symlink is an atomic operation?  We could

Symlinks in Cygwin are a close analog to true filesystem supported
symlinks.  They are just a 'plain' file with a special name (and file
attribute) and contain the redirection to the target file.  So....since a
Cygwin app. must access the symlink/file through Cygwin (which is doing
the symlink resolution) you can considder it "mostly" atomic.  It's
certainly not atomic from the underlying filesystem perspective (because
it doesn't support it), but the emulation layer is the only access point
for the app. to get to the symlink file.  Does that answer your question?

completely get rid of the temp file (used in the hard-link code) and just
create a symlink named for the lock file, pointing at (essentially)
$PID/$HOST (since it doesn't matter if the link is valid, just that it
exists).  According to various web docs, symlinks are atomic on NFS, so that
might be a good thing to use in general (replacing the use of link()).

..wayne..

--
Peter A. Castro <doctor@xxxxxxxxxxxx> or <Peter.Castro@xxxxxxxxxx>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood



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