Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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/