keychain locking problem (Was test -f occasionally fails on sym links)
Karl M
karlm30@hotmail.com
Tue Mar 29 16:44:00 GMT 2005
Hi All...
The reason I ask is that keychain uses
if tl_error=`ln -s $$ "$lockf" 2>&1`; then
inside its takelock function as an atomic operation for creating a lock. It
then uses
if [ -f "$lockf" ]; then
to test for an old style lock file, and this sometimes fails (incorrectly
succeeds) and generates an error message.
>From what I can find, this is expected to be an atomic operation and one of
the ways programs do file locking.
I ran into this when I did high load testing for the ssh-add hang problem.
In preparation for a keychain-service release, I provide an example, where I
only run keychain on the first launched (login) shell (which also has the
advantage of speeding things up substantially). To do this, I launch
keychain as follows
if (umask 0377; : > ~/.keychain/${HOSTNAME}-keys) 2>/dev/null; then
keychain --quiet ~/.ssh/identity ~/.ssh/id_dsa ~/.ssh/id_rsa
fi
and the lock file is cleaned up by the keychain-service. This does seem to
be safe (only verified by load testing under Cygwin). I found this method in
the UNIX CD Bookshelf.
So...my questions are
1) Is this a safe method?
2) Is there a better method for me to use in Cygwin?
3) Should this problem be fed to the upstream keychain maintainer?
Thanks,
...Karl
>From: Corinna Vinschen
>Subject: Re: test -f occasionally fails on sym links (keychain related)
>Date: Tue, 29 Mar 2005 10:40:59 +0200
>
>On Mar 25 09:37, Karl M wrote:
> > Sometimes doing a [ -f foo ]; will show a false true while the symlink
>is
> > being created. You can see this by opening two bash shells and executing
>
>Creating symlinks is not an atomic process in Cygwin. It requires
>several OS calls to create a symlink.
>
>
>Corinna
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list