KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/lib/python2.4/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/lib/python2.4/test/test_tarfile.pyc
m
=5Dc@sdkZdkZdkZdkZdkZdkZdkZdklZydk	Z	e	i
Wneefj
o
dZ	nXy
dkZWnej
o
dZnXdZedZeiieideidZeiZdZddZd	Zd
ZdeifdYZd
efdYZdefdYZdefdYZdefdYZ defdYZ!defdYZ"defdYZ#defdYZ$defdYZ%defd YZ&d!e$fd"YZ'd#eifd$YZ(d%eifd&YZ)d'efd(YZ*d)efd*YZ+d+efd,YZ,d-efd.YZ-d/e$fd0YZ.d1e'fd2YZ/d3efd4YZ0d5e fd6YZ1d7e!fd8YZ2d9e"fd:YZ3d;e#fd<YZ4d=eifd>YZ5d?efd@YZ6eodAe,fdBYZ7dCe-fdDYZ8dEe$fdFYZ9dGe/fdHYZ:dIefdJYZ;dKe fdLYZ<dMe!fdNYZ=dOe"fdPYZ>dQe#fdRYZ?dSeifdTYZ@ne	p[,[-[.[/ndUZAeBdVjoeAndS(WN(stest_supportcCs
ti|S(N(ttest_supporttfindfiletpath(R((t'/usr/lib/python2.4/test/test_tarfile.pyRsstesttar.tarttesttartdiri
tcCs2|ptSntiitdtti|fS(Ns%s%s%s(tcompRtosRtjointtempdirtextsep(R((RttarnamescCs(tiitptitntS(N(RRtexistsR
tmkdir(((Rtdirname$scCstS(N(ttempname(((Rttmpname)stBaseTestcBs,tZdZdZdZdZdZRS(NRtrt:cCs9|i|i|i}tit|i||_dS(N(tselftmodetsepRttarfiletopenRttar(RR((RtsetUp2scCs|iidS(N(RRtclose(R((RttearDown6s(t__name__t
__module__RRRRR(((RR-s
	tReadTestcBsYtZdZdZdZdZdZdZdZdZ	d	Z
RS(
NcCsd}xp|iD]e}|d7}|ipqn|ii|}|it|i	|i
jd|iqW|i|tjddS(s Test member extraction.
        iis&size read does not match expected sizescould not find all membersN(
tmembersRRttarinfotisregtextractfiletftassert_tlentreadtsizeRtmembercount(RR%R!R"((Rttest;s


cCs^|idjoJ|iid}|iid}|i|i|ijdndS(s'Test sparse member extraction.
        t|sS-SPARSEsS-SPARSE-WITH-NULLSs(_FileObject failed on sparse file memberN(RRRR$tf1tf2R&R((RR-R.((Rttest_sparseKscCs|idjod}|ii|tttii	t|d}|i}|i
|ii|i}|i||jdndS(s0Test readlines() method of _FileObject.
        R,s0-REGTYPE-TEXTtrUs._FileObject.readline() does not work correctlyN(RRtfilenameRtextractRRRRR	R%t	readlinestlines1RR$tlines2R&(RR%R4R1R5((Rttest_readlinesTs!
cCs|idjod}|ii|tttii	t|d}|i}|i
g}|ii|D]
}||qz~}|i||jdndS(NR,s0-REGTYPE-TEXTR0s.ExFileObject iteration does not work correctly(RRR1RR2RRRRR	R%R3R4Rt_[1]R$tlineR5R&(RR%R4R1R7R5R8((Rt	test_iteras!
-cCs|idjod}|ii|tttii	t|d}|i}|i
|ii|}
|ii|
}|i}|id|id|ijd|idd|id|ijd|idd	|id
|ijd|id
d	|id|ijd|id
}|i||dd!jd|idd|i|
i|ijd|i|idjd|i|
id|id|ijd|id|i}	|id|i}|i|	|jd|id|it|i|ijd|id|it|id|ijd|id|i}|i|i|t|jd|i
ndS(sATest seek() method of _FileObject, incl. random reading.
        R,s0-REGTYPE-TEXTtrbisseek() to file's start failedis"seek() to absolute position failediiis+seek() to negative relative position faileds+seek() to positive relative position failedi
i
sread() after seek failedisseek() to file's end failedRs0read() at file's end did not return empty strings&relative seek() to file's start failedisreadlines() after seek failedstell() after readline() faileds)tell() after seek() and readline() failedsread() after readline() failedN(RRR1RR2RRRRR	R%R(tdataRt	getmemberR"R$tfobjttexttseekR&ttelltsR)R3ts1ts2R'treadlineR8(RRCR%R1R=RAR;R>R8RBR"((Rt	test_seekmsd!




!
%
cCst}tid}ti|_t|d}|i	|i
|iz_ti|}|i
d}|i|i|itij|i|iidWdyti|WnnXXdS(s6Test old style dirtype member (bug #1336623).
        s
directory/twit/N(RR1RtTarInfoR"tREGTYPEttypeRR=twritettobufRRt
getmembersRR&tDIRTYPEtnametendswithRtunlink(RRR=R1R"((Rttest_old_dirtypes$	

cCs`xY|iD]N}|io;|i|iid|i|id idq
q
WdS(NRGi(RRR"tisdirR&RORP(RR"((Rttest_dirtypes


cCsTtidjodSnti}tid|dd}xHdD]@}ti|}ti
|_d|_d|_
|i|qCW|i|id	tiitd
}tid|}|i|xn|iD]`}tii||i}|i|i
ti|id@|i|itii|qW|idS(
Ntwin32tfileobjRsw:tfoosfoo/bari>iisextract-testi(RWsfoo/bar(tsystplatformtStringIOR=RRRRORHR"RNRJtmtimeRtaddfileRR?RRR	RtTEMPDIRt
extractallRMRtassertEqualtstattst_modetgetmtime(RRORR=R]RR"((Rttest_extractalls,		



##cCs;y|iidWn tj
o|idnXdS(Ns7-STARs.finding 7-STAR member failed (mangled prefix?)(RRR<tKeyErrortfail(R((Rt	test_stars(RRR+R/R6R9RERRRTRcRf(((RR 9s				
		7			tReadStreamTestcBs tZdZdZdZRS(NR,cCsLti||iid}|ii|}|it	i
|idS(sWTest member extraction, and for StreamError when
           seeking backwards.
        iN(R R+RRRMR"R$R%tassertRaisesRtStreamErrorR((RR"R%((RR+s

cCs"|i}titd}x|i}|i}|djoPn|i
|dj	d|ip
|io |i
ti|i|q!n|i|}|i|}|djoq!n|i
|dj	d|i
|i|ijdq!W|i|idS(s3Compare the normal tar and the stream tar.
        Risstream.next() failed.sstream.extractfile() failedsstream extraction failedN(RRtstreamRRRtnexttt1tt2tNoneR&tislnktissymRhRiR$tv1tv2R(R(RRjRRmRlRqRr((Rttest_streams*	

'
(RRRR+Rs(((RRgs		tReadDetectTestcBstZdZRS(NcCs%tit|i|i|_dS(N(RRRRRRR(R((RRs(RRR(((RRtstReadDetectFileobjTestcBstZdZRS(NcCs=t|i}ti|d|idt|d|_dS(NRRVR:(RRRRORRRR(RRO((RRs(RRR(((RRustReadAsteriskTestcBstZdZRS(NcCs6|i|id}tit|i||_dS(Nt*(RRRRRRRR(RR((RRs(RRR(((RRvstReadStreamAsteriskTestcBstZdZRS(NcCs6|i|id}tit|i||_dS(NRw(RRRRRRRR(RR((RR%s(RRR(((RRx#stReadFileobjTestcBstZdZRS(NcCs4|ii|ii}|i}|i}|ii|i}|ii	|i
djo
ti}n$|i
djo
ti}nt}|t|i
d}|i|tit|i
dd||_|ii}|i|i||ii|i|ii|i|ddS(Ntgztbz2R:sr:RVsseek back did not work(RRRkttROtoffsetR$R(R;RRtgziptGzipFilet_openR{tBZ2FileRRR=R?RR_RM(RRORR=R|R}R;((Rttest_fileobj_with_offset+s&
		



$
(RRR(((RRy)st	WriteTestcBsMtZdZdZdZdZdZdZdZdZ	RS(	NRFcCs]|i|i|i}tit|id|_t|_	ti|i	||_
dS(NR(RRRRRRRtsrcRtdstnametdst(RR((RRLscCs|ii|iidS(N(RRRR(R((RRRs
cCsd|i_|idS(Ni(RRtposixt_test(R((Rt
test_posixVscCsd|i_|idS(Ni(RRRR(R((Rt
test_nonposixZscCs[|iitiitiitd|ii|i	ti
|iiddS(Nscfgparser.1i(
RRtaddRRR	Rt__file__RtassertNotEqualR`Rtst_size(R((Rt
test_small^s+
cCsx|iD]}|ipq
n|ii|}|iioIt|i	t
ijo0d|i	jo |it
|ii||q
|ii||q
WdS(NRG(RRR"R#R$R%RRR'RORtLENGTH_NAMERht
ValueErrorR\(RR%R"((RRcs

6cCstii|i}|i|ii|d|ii||i|ii	gdti
}tit
|ii|ti||i|ii	gddS(Nsarchive name must be absolutesadded the archive to itself(RRtabspathRRR_RRORtgetnamestgetcwdtcwdtchdirR(RRR((Rt
test_add_selfns
(
RRRRRRRRRR(((RRIs						tWrite100TestcBs#tZdZdZdZRS(NcCsxd|_|id7_titd|_ti|i}|ii||ii	tit|_dS(Nt201234567890123456789012345678901234567890123456789RF(
RRORRRRRHR|R\R(RR|((RRs	
cCs|iidS(N(RRR(R((RRscCs'|i|iid|iddS(Nis!failed to store 100 char filename(RR_RRRO(R((RR+s(RRRRR+(((RR}s		tWriteSize0TestcBs;tZdZdZdZdZdZdZRS(NRFcCs4t|_t|_ti|id|_dS(NRF(RRttmpdirRRRRR(R((RRscCs|iidS(N(RRR(R((RRscCstii|id}t|d}|i|ii	|}|i|idt|d}|i
d|i|ii	|}|i|iddS(NtfileRFitaaai(RRR	RRRR%RRt
gettarinfoR"R_R)RK(RR%RR"((Rt	test_files


cCsrtii|id}tii|oti|nti||i	i
|}|i|i
ddS(Nt	directoryi(RRR	RRR
tshutiltrmtreeRRRR"R_R)(RRR"((Rttest_directorys
cCsettdoQtii|id}tid||ii|}|i
|idndS(Ntsymlinktlink_targeti(thasattrRRR	RRRRRR"R_R)(RRR"((Rttest_symlinks
(RRRRRRRR(((RRs				
tWriteStreamTestcBstZdZdZRS(NR,cCs|ii|idjo,ti|i}|i}|in|idjoPt
i}t|ii}|i
|}|it|iddn&t|i}|i}|i|i|idtiddS(NRzR{is
trailing datatsincorrect zero padding(RRRRR~RRR%R(RAR{tBZ2DecompressorRt
decompressR_R'tunused_datatcountRt
RECORDSIZE(RR%RA((Rttest_paddings
 
(RRRR(((RRstWriteGNULongTestcBstZdZdZedZedZdZdZdZ	dZ
dZd	Zd
Z
dZdZRS(
sGThis testcase checks for correct creation of GNU Longname
       and Longlink extensions.

       It creates a tarfile and adds empty members with either
       long names, long linknames or both and compares the size
       of the tarfile with the expected size.

       It checks for SF bug #812325 in TarFile._create_gnulong().

       While I was writing this testcase, I noticed a second bug
       in the same method:
       Long{names,links} weren't null-terminated which lead to
       bad tarfiles when their length was a multiple of 512. This
       is tested as well.
    cCs<tt|dd\}}|o|d7}n|dS(Nii(tdivmodR'RAtblockst	remainder(RRARR((Rt_lengthscCsd}t|tijo!|d7}||i|7}n|dj	o7t|ti	jo!|d7}||i|7}n|S(Ni(
RR'RORRRRtlinkRntLENGTH_LINK(RRORR((Rt
_calc_sizes
#
cCsti|}|o||_ti|_ntit	d}t|_|i
||i||}|i}|i||d|itit	}|i}|i|djd|i|i|ijo|i|ijddS(NRFs%GNU longname/longlink creation failedsunable to read longname member(RRHROR"RtlinknametLNKTYPERJRRRtFalseRR\RRRqR}RrR_RRktmembertfailIfRnR&(RRORRRqRRrR"((RRs 		
	
(cCs|iddddS(Nslongnam/itlongnam(RR(R((Rttest_longname_1023scCs|iddddS(Nslongnam/itlongname(RR(R((Rttest_longname_1024scCs|iddddS(Nslongnam/it	longname_(RR(R((Rttest_longname_1025scCs|idddddS(NROslonglnk/itlonglnk(RR(R((Rttest_longlink_1023scCs|idddddS(NROslonglnk/itlonglink(RR(R((Rttest_longlink_1024!scCs|idddddS(NROslonglnk/it	longlink_(RR(R((Rttest_longlink_1025$scCs$|idddddddS(Nslongnam/iRslonglnk/R(RR(R((Rttest_longnamelink_1023'scCs$|idddddddS(Nslongnam/iRslonglnk/R(RR(R((Rttest_longnamelink_1024+scCs$|idddddddS(Nslongnam/iRslonglnk/R(RR(R((Rttest_longnamelink_1025/s(RRt__doc__RRnRRRRRRRRRRR(((RRs									tReadGNULongTestcBs>tZdZdZdZdZdZdZRS(NcCstit|_dS(N(RRRRR(R((RR5scCs|iidS(N(RRR(R((RR8scCsvddd}y|ii|}Wntj
o
d}nX|i|dj	d|i|it	i
jddS(s1Test reading of longname (bug #1471427).
        stest/is	0-REGTYPEslongname not foundsread longname as dirtypeN(RORRR<R"RdRnR&RJRRN(RROR"((Rttest_1471427;scCsZddd }y|ii|}Wntj
o
d}nX|i|dj	ddS(Ns0-LONGNAME-i
ieslongname not found(RORRR<R"RdRnR&(RROR"((Rttest_read_nameFscCsddd }ddd }y|ii|}Wntj
o
d}nX|i|dj	d|i|i	|jddS(Ns1-LONGLINK-i
ies0-LONGNAME-slonglink not foundslinkname wrong(
RRORRR<R"RdRnR&R(RRORR"((Rttest_read_linkNscCsytt}ti|id}|itiddd|}|i
t|idjd|idS(NiROsfoo.tarRViR(
RRR%RZR(R=RRRRR&R'RM(RRR%R=((Rttest_truncated_longnameXs
"(RRRRRRRR(((RR3s					
tExtractHardlinkTestcBstZdZRS(NcCsd|i_|iidty|iidtWnBtj
o6}dk}|i|ijo|i	dqnXdS(s/Test hardlink extraction (bug #857297)
        is	0-REGTYPEs	1-LNKTYPENshardlink not extracted properly(
RRt
errorlevelR2RtEnvironmentErrorteterrnotENOENTRe(RRR((Rt
test_hardlinkcs	(RRR(((RRastCreateHardlinkTestcBs2tZdZdZdZdZdZRS(sTest the creation of LNKTYPE (hardlink) members in an archive.
       In this respect tarfile.py mimics the behaviour of GNU tar: If
       a file has a st_nlink > 1, it will be added a REGTYPE member
       only the first time.
    cCstitd|_tiitd|_	tiitd|_
tii|i	oti|i	ntii|i
oti|i
nt|i	d}|id|i|ii|i	dS(NRFRWtbar(RRRRRRRR	RRWRR
tremoveR%RKRR(RR%((RRys

cCs2|ii|i}|i|itiddS(Nsadd file as regular failed(	RRRRWR"R_RJRRI(RR"((Rttest_add_twicescCsvti|i|i|ii|i}|i|i	t
id|ii|i}|i|i	t
iddS(Nsadd file as hardlink failed(RRRRWRRRR"R_RJRR(RR"((Rttest_add_hardlinkscCsTt|i_ti|i|i|ii|i}|i
|iti
ddS(Nsdereferencing hardlink failed(tTrueRRtdereferenceRRRWRRR"R_RJRRI(RR"((Rttest_dereference_hardlinks
(RRRRRRR(((RRrs
			tReadTestGzipcBstZdZRS(NRz(RRR(((RRstReadStreamTestGzipcBstZdZRS(NRz(RRR(((RRst
WriteTestGzipcBstZdZRS(NRz(RRR(((RRstWriteStreamTestGzipcBstZdZRS(NRz(RRR(((RRstReadDetectTestGzipcBstZdZRS(NRz(RRR(((RRstReadDetectFileobjTestGzipcBstZdZRS(NRz(RRR(((RRstReadAsteriskTestGzipcBstZdZRS(NRz(RRR(((RRstReadStreamAsteriskTestGzipcBstZdZRS(NRz(RRR(((RRstReadFileobjTestGzipcBstZdZRS(NRz(RRR(((RRstFileModeTestcBstZdZRS(NcCs6|itidd|itidddS(Nis
-rwxr-xr-xiIs
---s--s--t(RR_Rtfilemode(R((Rt
test_modess(RRR(((RRstOpenFileobjTestcBs,tZdZdZdZdZRS(NcCsbtid}ytidddd|Wn/tij
o |i|iddnXdS(Nsfoo
RRRRVisfileobj's position has moved(RZR=RRt	ReadErrorRR_R@(RR=((Rttest_openers
cCsMttd}tid|dd}|i|iti	i
|idS(NR:RVRR(RRR=RRRR_RORRR(RRR=((Rttest_no_name_argumentscCsittdi}ti|}|itt	|dt
id|dd}|i|i
ddS(NR:RORVRR(RRR(R;RZR=RRhtAttributeErrortgetattrRRR_RORn(RRR;R=((Rttest_no_name_attributes
cCs\ttdi}ti|}d|_tid|dd}|i
|iddS(NR:RRVRR(RRR(R;RZR=RORRRR_Rn(RRR;R=((Rttest_empty_name_attributes
	(RRRRRR(((RRs			t
ReadTestBzip2cBstZdZRS(NR{(RRR(((RRstReadStreamTestBzip2cBstZdZRS(NR{(RRR(((RRstWriteTestBzip2cBstZdZRS(NR{(RRR(((RRstWriteStreamTestBzip2cBstZdZRS(NR{(RRR(((RRstReadDetectTestBzip2cBstZdZRS(NR{(RRR(((RRstReadDetectFileobjTestBzip2cBstZdZRS(NR{(RRR(((RRstReadAsteriskTestBzip2cBstZdZRS(NR{(RRR(((RRstReadStreamAsteriskTestBzip2cBstZdZRS(NR{(RRR(((RRstReadFileobjTestBzip2cBstZdZRS(NR{(RRR(((RRstPartialReadTestBzip2cBs#tZdZdZdZRS(NcCs|dtifdY}titidi}x>tt	|dD]&}tid||| d|qNWdS(Nt
MyStringIOcBstZeZdZRS(NcCsB|iotdn|i|ij|_tii||S(Ns(infinite loop detected in tarfile.open()(Rthit_eoftAssertionErrortposR'RZR(tn(RR((RR(s
(RRRRR((((RRsRWiRVR(
RZRR{tcompressRRHRLR;trangeR'txRR(RRRRR;((Rt_test_partial_inputs
cCs|iddS(NR(RR(R((Rttest_partial_inputscCs|iddS(Nsr:bz2(RR(R((Rttest_partial_input_bz2s(RRRRR	(((RRs	
	cCsttd}|i}|ito3titdd}|i||int	o3t	i
tdd}|i||inttt
ttttttttttttg}ttdo|it|itnto,|i t!t"t#t$t%t&t't(t)g	nt	o/|i t*t+t,t-t.t/t0t1t2t3g
nzt4i5|Wdtoti6tdnt	oti6tdnti7i8t9ot:i;t9nti7i8t<oti6t<nXdS(NR:RztwbR{R(=RRR%R(tfgutsRR~RRKR{RRRR RgRtRuRvRxRyRRRRRRttestsRRtappendRRtextendRRRRRRRRRRRRRRRRRRRRtrun_unittestRRR
RRRR(RRRR%((Rt	test_mains<


3
,/t__main__(CRXRRttempfileRZtunittestRR+RR~RtImportErrorRRnR{RRR	t
gettempdirRR
tTESTFNRR*RRRtTestCaseRR RgRtRuRvRxRyRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR(8RRRRRxRRRR*RRRRRR{RRRRRRRRRR
RRtRvRRRRRuRRXRRR RRRRRRRRyRZRRRRRgR~RRR((Rt?s							
	
	&			& 4)\.3	C


Anon7 - 2021