Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 127471 - Keychain can go to an endless loop when trying to remove an empty lock file
Summary: Keychain can go to an endless loop when trying to remove an empty lock file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Aron Griffis (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-24 13:08 UTC by Petteri Räty (RETIRED)
Modified: 2006-09-08 13:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petteri Räty (RETIRED) gentoo-dev 2006-03-24 13:08:49 UTC
betelgeuse@pena ~ $ startssh

KeyChain 2.6.2; http://www.gentoo.org/proj/en/keychain/
Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL

 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file
 * Warning: removing empty lock file

startssh:

startssh() {
        keychain ~/.ssh/id_dsa
        . ~/.keychain/pena-sh
}

Situation:
I had my desktop running for a week without me doing anything with it and when I came back this happened when I issued startssh on Konsole tabs that probably already had the environment setup.

After I issued startssh in a new tab, startssh works fine in all tabs again.

I was using keychain-2.6.1 at the time but diffing against 2.6.2 does not show anything relevant to this bug.

betelgeuse@pena ~ $ emerge --info
Portage 2.1_pre6-r5 (default-linux/x86/2005.1, gcc-3.4.5, glibc-2.4-r1, 2.6.15-gentoo-r7 i686)
=================================================================
System uname: 2.6.15-gentoo-r7 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.12.0_pre16
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-lang/python:     2.4.2-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe -mfpmath=sse -ffast-math -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -pipe -mfpmath=sse -ffast-math -fomit-frame-pointer"
DISTDIR="/usr/src/distfiles"
FEATURES="autoaddcvs autoconfig ccache collision-protect confcache cvs distlocks fixpackages metadata-transfer sandbox sfperms strict stricter verify-rdepend"
GENTOO_MIRRORS=" http://trumpetti.atm.tut.fi/gentoo  http://lame.lut.fi/linux/gentoo "
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LINGUAS="fi"
MAKEOPTS="-j2 "
PKGDIR="/home/pkg/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/mnt/checkouts/overlays/betelgeuse /mnt/checkouts/gentooexperimental/gentoo-java-experimental"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 aac acl acpi alsa apm arts audiofile avi bash-completion berkdb bitmap-fonts bluetooth bzip2 bzlib cairo cdb cddb cdparanoia crypt cups dbus divx4linux dri dts dvd dvdr dvdread emboss esd firefox foomaticdb freetype gif gstreamer gtk2 hal java jpeg kde kdeenablefinal libg++ libwww logitech-mouse mad makecheck mikmod mjpeg mmx mmx2 mp3 mpeg ncurses network nptl nptlonly nsplugin nvidia offensive ogg oggvorbis opengl pam pdflib png qt quicktime readline real rtc samba spell sse sse2 ssl subversion svg symlink tcpd theora threads truetype truetype-fonts type1-fonts unicode usb userlocales vorbis win32codecs xcomposite xml xml2 xv xvid zlib elibc_glibc input_devices_mouse input_devices_keyboard kernel_linux linguas_fi userland_GNU video_cards_none video_cards_nvidia"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LDFLAGS
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2006-03-24 22:23:14 UTC
Sounds like a permissions problem prevented keychain from removing the empty lockfile.  I'll put in a check for that.
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2006-09-08 13:46:34 UTC
Thanks, fixed in 2.6.5 (unreleased).  I might wait for some more interesting changes to appear before making a release, since this is a highly unlikely situation.

--- keychain.sh (revision 89)
+++ keychain.sh (working copy)
@@ -6,7 +6,7 @@
 # Maintained April 2004 - present by Aron Griffis <agriffis@gentoo.org>
 # $Id$
 
-version=2.6.4
+version=2.6.5
 
 PATH="/usr/bin:/bin:/sbin:/usr/sbin:/usr/ucb:${PATH}"
 
@@ -216,6 +216,7 @@
 
     tl_faking=false
     tl_emptyonce=false
+    tl_removedempty=false
     unset tl_oldpid tl_lastmesg
 
     # Set up timer
@@ -236,7 +237,8 @@
     # Try to lock for $lockwait seconds
     while [ $lockwait -eq 0 -o $tl_current -lt $tl_end ]; do
 
-        if tl_error=`umask 0377; echo $$ 2>&1 >"$lockf"`; then
+        tl_pid=$$
+        if tl_error=`umask 0377; echo $tl_pid 2>&1 >"$lockf"`; then
             havelock=true
             return 0
         fi
@@ -284,14 +286,16 @@
 
             # nb: fall through to sleep...
 
-        else # tl_pid is blank
-            if $tl_emptyonce; then
-                warn "removing empty lock file"
-                rm -f "$lockf"
-                tl_emptyonce=false
-                # give this another go-around, no sleep required
-                continue
-            fi
+        # tl_pid is blank
+        elif $tl_removedempty; then
+            die "failed to remove empty lock file"
+        elif $tl_emptyonce; then
+            warn "removing empty lock file"
+            rm -f "$lockf"
+            tl_removedempty=true
+            # give this another go-around, no sleep required
+            continue
+        else
             tl_emptyonce=true
             # fall through to sleep
         fi