| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Message-ID: | <BAY19-F14865B312D569712E6C199B5450@phx.gbl> |
| X-Originating-Email: | [karlm30 AT hotmail DOT com] |
| X-Sender: | karlm30 AT hotmail DOT com |
| In-Reply-To: | <20050329084059.GH23860@cygbert.vinschen.de> |
| From: | "Karl M" <karlm30 AT hotmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | keychain locking problem (Was test -f occasionally fails on sym links) |
| Date: | Tue, 29 Mar 2005 06:47:37 -0800 |
| Mime-Version: | 1.0 |
| X-OriginalArrivalTime: | 29 Mar 2005 14:47:38.0176 (UTC) FILETIME=[406B7C00:01C5346E] |
| X-IsSubscribed: | yes |
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |