delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/29/10:10:32

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
Date: Tue, 29 Mar 2005 17:08:44 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: keychain locking problem (Was test -f occasionally fails on sym links)
Message-ID: <20050329150843.GA2495@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20050329084059 DOT GH23860 AT cygbert DOT vinschen DOT de> <BAY19-F14865B312D569712E6C199B5450 AT phx DOT gbl>
Mime-Version: 1.0
In-Reply-To: <BAY19-F14865B312D569712E6C199B5450@phx.gbl>
User-Agent: Mutt/1.4.2i

On Mar 29 06:47, Karl M wrote:
> 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.

No chance.  Cygwin is not the OS and the OS doesn't support native symlinks
and consequentially no atomic symlink creation.

>    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?

Yes, AFAICS.  File creation and setting of permissions is atomic, as
long as you don't rely on "ntea".  But that's old stuff, just ignore it.

> 3) Should this problem be fed to the upstream keychain maintainer?

The symlink creation problem?  If the upstream maintainer cares, sure.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019