[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.129.211.228: ~ $
�
V
�Qc@s�dZddlZddlZddlZddlZdZdZdZdZdZ	ddd	��YZ
d
e
fd��YZddd
��YZd�Z
defd��YZdefd��YZed�Zd�Zedkr�e�ndS(s�CVS locking algorithm.

CVS locking strategy
====================

As reverse engineered from the CVS 1.3 sources (file lock.c):

- Locking is done on a per repository basis (but a process can hold
write locks for multiple directories); all lock files are placed in
the repository and have names beginning with "#cvs.".

- Before even attempting to lock, a file "#cvs.tfl.<pid>" is created
(and removed again), to test that we can write the repository.  [The
algorithm can still be fooled (1) if the repository's mode is changed
while attempting to lock; (2) if this file exists and is writable but
the directory is not.]

- While creating the actual read/write lock files (which may exist for
a long time), a "meta-lock" is held.  The meta-lock is a directory
named "#cvs.lock" in the repository.  The meta-lock is also held while
a write lock is held.

- To set a read lock:

        - acquire the meta-lock
        - create the file "#cvs.rfl.<pid>"
        - release the meta-lock

- To set a write lock:

        - acquire the meta-lock
        - check that there are no files called "#cvs.rfl.*"
                - if there are, release the meta-lock, sleep, try again
        - create the file "#cvs.wfl.<pid>"

- To release a write lock:

        - remove the file "#cvs.wfl.<pid>"
        - rmdir the meta-lock

- To release a read lock:

        - remove the file "#cvs.rfl.<pid>"


Additional notes
----------------

- A process should read-lock at most one repository at a time.

- A process may write-lock as many repositories as it wishes (to avoid
deadlocks, I presume it should always lock them top-down in the
directory hierarchy).

- A process should make sure it removes all its lock files and
directories when it crashes.

- Limitation: one user id should not be committing files into the same
repository at the same time.


Turn this into Python code
--------------------------

rl = ReadLock(repository, waittime)

wl = WriteLock(repository, waittime)

list = MultipleWriteLock([repository1, repository2, ...], waittime)

i����Ni
is#cvs.lcks	#cvs.rfl.s	#cvs.wfl.tErrorcBs#eZd�Zd�Zd�ZRS(cCs
||_dS(N(tmsg(tselfR((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyt__init__`scCs
t|j�S(N(treprR(R((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyt__repr__cscCs
t|j�S(N(tstrR(R((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyt__str__fs(t__name__t
__module__RRR(((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR^s		tLockedcBseZRS((RR	(((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR
jstLockcBsVeZded�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	t.cCsx||_||_d|_d|_ttj��}|jt	�|_
|jt|�|_|jt
|�|_dS(N(t
repositorytdelaytNonetlockdirtlockfileRtostgetpidtjointCVSLCKtcvslcktCVSRFLtcvsrfltCVSWFLtcvswfl(RR
Rtpid((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyRps				cCsdGH|j�dS(Nt__del__(tunlock(R((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyRzscCs�x�y'|j|_tj|jd�dSWqtjk
r�}d|_|dtkr�ytj|j�}Wntjk
r�qnX|j|�qnt	d|j
|f��qXqdS(Ni�isfailed to lock %s: %s(RRRtmkdirterrorRtEEXISTtstattsleepRR
(RRtst((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyt
setlockdir~s 	
cCs|j�|j�dS(N(t
unlockfilet	unlockdir(R((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR�s
cCsP|jrLdG|jGHytj|j�Wntjk
r?nXd|_ndS(Ntunlink(RRR'RR(R((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR%�s	cCsP|jrLdG|jGHytj|j�Wntjk
r?nXd|_ndS(Ntrmdir(RRR(RR(R((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR&�s	cCst||j|j�dS(N(R"R
R(RR#((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR"�scCstjj|j|�S(N(RtpathRR
(Rtname((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR�s(RR	tDELAYRRR$RR%R&R"R(((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyRns
								cCs�|dkrt|��n|tj}ytj|�}|d}Wntk
rbd|}nXdtjtj��dd!Gd|G|GHtj|�dS(Nisuid %ds[%s]iisWaiting for %s's lock in(	R
R!tST_UIDtpwdtgetpwuidtKeyErrorttimetctimeR"(R#R
Rtuidtpwenttuser((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR"�s


tReadLockcBseZed�ZRS(cCsztj|||�d}z<|j�|j|_t|jd�}|j�d}Wd|sk|j�n|j�XdS(Nitwi(	RRR$RRtopentcloseR%R&(RR
Rtoktfp((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR�s



(RR	R+R(((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR5�st	WriteLockcBseZed�Zd�ZRS(cCs|tj|||�|j�x0|j�}|s6Pn|j�|j|�q |j|_t|jd�}|j	�dS(NR6(
RRR$t
readers_existR&R"RRR7R8(RR
RR2R:((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR�s

cCswtt�}xdtj|j�D]P}|| tkrytj|j|��}Wntjk
rjqnX|SqWdS(N(	tlenRRtlistdirR
R!RRR(RtnR*R#((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR<�s(RR	R+RR<(((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyR;�s
cCsixbg}xC|D]:}y|jt|d��Wqtk
rI}~PqXqWPt|j||�qtS(Ni(tappendR;R
R"Rtlist(trepositoriesRtlockstrtinstance((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pytMultipleWriteLock�s
	cCs�ddl}|jdr)|jd}nd}d}d}zDdGHt|�}dGH|j�dGHt|�}dGH|j�WddgGHd|_dgGH|r�|j�ndgGH|r�|j�nd	gGHd}d
gGHd}dgGHXdS(Ni����iRsattempting write lock ...sgot it.sattempting read lock ...iiiii(tsystargvRR;RR5t
exc_traceback(RGR
trltwl((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyttest�s8

	

t__main__(((t__doc__RR0R!R-R+R RRRRR
RR"R5R;RFRLR(((s*/usr/lib64/python2.7/Demo/pdist/cvslock.pyt<module>Gs&?		!

Filemanager

Name Type Size Permission Actions
.FSProxy.pyo.40009 File 12.49 KB 0644
.RCSProxy.pyo.40009 File 7.57 KB 0644
.client.pyo.40009 File 6.57 KB 0644
.cmdfw.pyo.40009 File 5.12 KB 0644
.cmptree.pyo.40009 File 5.98 KB 0644
.cvslib.pyo.40009 File 12.83 KB 0644
.cvslock.pyo.40009 File 8.36 KB 0644
.mac.pyo.40009 File 597 B 0644
.makechangelog.pyo.40009 File 3.04 KB 0644
.rcsclient.pyo.40009 File 2.05 KB 0644
.rcslib.pyo.40009 File 11.28 KB 0644
.rcvs.pyo.40009 File 14.08 KB 0644
.rrcs.pyo.40009 File 5.5 KB 0644
.security.pyo.40009 File 1.64 KB 0644
.server.pyo.40009 File 5.83 KB 0644
.sumtree.pyo.40009 File 903 B 0644
FSProxy.py File 7.64 KB 0644
FSProxy.pyc File 12.49 KB 0644
FSProxy.pyo File 12.49 KB 0644
RCSProxy.py File 4.61 KB 0755
RCSProxy.pyc File 7.57 KB 0644
RCSProxy.pyo File 7.57 KB 0644
README File 4.16 KB 0644
client.py File 4.6 KB 0644
client.pyc File 6.57 KB 0644
client.pyo File 6.57 KB 0644
cmdfw.py File 4.53 KB 0644
cmdfw.pyc File 5.12 KB 0644
cmdfw.pyo File 5.12 KB 0644
cmptree.py File 5.64 KB 0644
cmptree.pyc File 5.98 KB 0644
cmptree.pyo File 5.98 KB 0644
cvslib.py File 9.94 KB 0644
cvslib.pyc File 12.83 KB 0644
cvslib.pyo File 12.83 KB 0644
cvslock.py File 6.61 KB 0644
cvslock.pyc File 8.36 KB 0644
cvslock.pyo File 8.36 KB 0644
mac.py File 352 B 0644
mac.pyc File 597 B 0644
mac.pyo File 597 B 0644
makechangelog.py File 2.92 KB 0755
makechangelog.pyc File 3.04 KB 0644
makechangelog.pyo File 3.04 KB 0644
rcsbump File 742 B 0755
rcsclient.py File 1.76 KB 0644
rcsclient.pyc File 2.05 KB 0644
rcsclient.pyo File 2.05 KB 0644
rcslib.py File 10.08 KB 0644
rcslib.pyc File 11.28 KB 0644
rcslib.pyo File 11.28 KB 0644
rcvs File 114 B 0755
rcvs.py File 13.33 KB 0755
rcvs.pyc File 14.08 KB 0644
rcvs.pyo File 14.08 KB 0644
rrcs File 114 B 0755
rrcs.py File 3.9 KB 0755
rrcs.pyc File 5.5 KB 0644
rrcs.pyo File 5.5 KB 0644
security.py File 1.07 KB 0644
security.pyc File 1.64 KB 0644
security.pyo File 1.64 KB 0644
server.py File 4.47 KB 0644
server.pyc File 5.83 KB 0644
server.pyo File 5.83 KB 0644
sumtree.py File 518 B 0644
sumtree.pyc File 903 B 0644
sumtree.pyo File 903 B 0644