U1p  dZdZdZddlmZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZ ddlZn #e$rdZYnwxYw ddlZn #e$rdZYnwxYweefZ eefz Zn #e$rYnwxYwgdZdZdZed zZd Zd Zd Zd Zd Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2e2Z3e!e"e#e$e'e(e)e%e&e*e+e,f Z4e!e"e)e,fZ5e*e+e,fZ6dZ7hdZ8e9e9e9e:e:e:d Z;ej<d!krd"Z=nej>Z=d#Z?d$Z@d%ZAd&e3fd'ZBd(ZCdedfd)ZDd*ZEGd+d,eFZGGd-d.eGZHGd/d0eGZIGd1d2eGZJGd3d4eGZKGd5d6eGZLGd7d8eLZMGd9d:eLZNGd;deLZPGd?d@eLZQGdAdBZRGdCdDZSGdEdFeTZUGdGdHeTZVGdIdJejWZXGdKdLeGZYGdMdNeYZZGdOdPeYZ[GdQdReYZ\GdSdTeYZ]GdUdVeYZ^GdWdXeYZ_eYeeHfZ`dgdZZad[Zbd\Zcd]Zdebecedd^ZeeTZfejgd_ZhGd`daeTZiGdbdceTZjddZkejjZdeZlemdfkr eldSdS)hz0.9.0u"Lars Gustäbel (lars@gustaebel.de)u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.)openN)TarFileTarInfo is_tarfileTarError ReadErrorCompressionError StreamError ExtractError HeaderErrorENCODING USTAR_FORMAT GNU_FORMAT PAX_FORMATDEFAULT_FORMATrisustar sustar00d01234567LKSxgX)pathlinkpathsizemtimeuidgidunamegname>r&r-r,r')atimectimer)r*r+r(ntutf-8c |td|||}|d||t|z tzzS)Nzmetadata cannot contain None) ValueErrorencodelenNUL)slengthencodingerrorss 2/opt/alt/python-internal/lib/python3.11/tarfile.pystnr<sPy7888 6""A WfW:#a&&C/ //cz |d}|dkr |d|}|||S)Nr)finddecode)r7r9r:ps r;ntsrCs@ u ABww bqbE 88Hf % %%r=c~ |ddvr]d}tt|dz D]}|dz}|||dzz }|ddkrdt|dz z|z }nT t|dd}t|pd d}n#t $rt d wxYw|S) Nr)r$rFasciistrict0invalid header)ranger5rCintstripr3InvalidHeaderError)r7nis r;ntirSs t~ s1vvz""  A !GA 1q5MAA Q45==#a&&1*%)*A 7Aw))AAGGII$a((AA 7 7 7$%566 6 7 Hs *5B B:rGc |}t|}d|cxkr d|dz zkr$nn!td|dz |fzdtz}n|tkrd|dz z |cxkr d|dz zkrfnnc|dkrt dg}nt dg}d|z|z}t |dz D] }|d|dz|dz}!ntd |S) NrrGr$z%0*orIrHrErFzoverflow in number field)rNbytesr6r bytearrayrMinsertr3)rQdigitsformat original_nr7rRs r;itnr[s8J AAA!!!!fqj!!!!!! &FQJ?*G 4 4s : :  36A:#6"6!"Q"Q"Q"Qcfqj>Q"Q"Q"Q"Q"Q 665'""AA5'""Av !Avz""  A HHQE " " " !GAA 3444 Hr=c dttjd|z}dttjd|z}||fS)NrH 148B8x356B 148b8x356b)sumstruct unpack_from)bufunsigned_chksum signed_chksums r; calc_chksumsresRC 2< E EFFFO#f0sCCDDDM M ))r=c |pd}|dkrdS|tj|||dSt||\}}t|D]J}||}t ||kr |d||K|dkrH||}t ||kr |d||dS)Ni@runexpected end of data)shutil copyfileobjdivmodrMreadr5write) srcdstr8 exceptionbufsizeblocks remainderbrbs r;riris"G {{ ~3W---vw//FI 6]]hhw s88g  )455 5 #A~~hhy!! s88i  )455 5 # Fr=cttjdd}|)||d|}t |ddS)Nr9backslashreplace )end)getattrsysstdoutr4rAprint)r7r9s r; _safe_printr|sVsz:t44H HHX1 2 2 9 9( C C !r=ceZdZ dS)rN__name__ __module__ __qualname__r=r;rrsDr=rceZdZ dS)r Nr~rr=r;r r s/Dr=r ceZdZ dS)rNr~rr=r;rrs0Dr=rceZdZ dS)r Nr~rr=r;r r s8Dr=r ceZdZ dS)r Nr~rr=r;r r sGDr=r ceZdZ dS)r Nr~rr=r;r r s+Dr=r ceZdZ dS)EmptyHeaderErrorNr~rr=r;rr!s&Dr=rceZdZ dS)TruncatedHeaderErrorNr~rr=r;rr$s*Dr=rceZdZ dS)EOFHeaderErrorNr~rr=r;rr's,Dr=rceZdZ dS)rPNr~rr=r;rPrP*s(Dr=rPceZdZ dS)SubsequentHeaderErrorNr~rr=r;rr-s=Dr=rc(eZdZ dZdZdZdZdS) _LowLevelFilectjtjtjztjzd|}t tdr|tjz}tj||d|_dS)NrwO_BINARYi) osO_RDONLYO_WRONLYO_CREATO_TRUNChasattrrrfd)selfnamemodes r;__init__z_LowLevelFile.__init__:sirz)BJ6    2z " " BK D'$e,,r=c8tj|jdSN)rcloserrs r;rz_LowLevelFile.closeCs r=c6tj|j|Sr)rrkrrr(s r;rkz_LowLevelFile.readFswtw%%%r=c:tj|j|dSr)rrlrrr7s r;rlz_LowLevelFile.writeIs !r=N)rrrrrrkrlrr=r;rr4sU ---&&&r=rcZeZdZ dZdZdZdZdZdZdZ dZ dd Z d Z d Z d ZdS)_Streamc d|_|t||}d|_|dkr#t|}|}|pd|_||_||_||_||_d|_ d|_ d|_ |dkr ddl }n#t$rtddwxYw||_ |d|_|d kr"|j|_|dS|dS|d krs ddl}n#t$rtd dwxYw|d kr.d|_||_t2|_dS||_dS|d krs ddl}n#t$rtd dwxYw|d kr.d|_||_|j|_dS||_dS|dkrtd|zdS#|js|jd|_ xYw)NTF*r=rgzzzlib module is not availablerbz2bz2 module is not availablexzlzma module is not availabletarunknown compression type %r) _extfileobjr _StreamProxy getcomptyperrcomptypefileobjrprbposclosedzlib ImportErrorr crc32crcerrorro _init_read_gz_init_write_gzrdbufBZ2DecompressorcmpOSError BZ2CompressorlzmaLZMADecompressor LZMAErrorLZMACompressorr) rrrrrrprrrs r;rz_Stream.__init__Xs  ?#D$//G$D  s??#7++G**,,H        - 4UKKKK"UUU*+IJJPTTU  ::c??3;;%)ZDN&&((((('')))))U""TJJJJ"TTT*+HIItST3;; #DI"2244DH%,DNNN"0022DHHHT!!UKKKK"UUU*+IJJPTTU3;; #DI#4466DH%)^DNNN#2244DHHHU""&'Dx'OPPP#" # % ""$$$DK syH BHB--A H9HHDHD665H-HHFHF//5H&HH*Icdt|dr|js|dSdSdS)Nr)rrrrs r;__del__z_Stream.__del__sB 4 " " 4;  JJLLLLL    r=cB |jd|jj|jj |jjd|_t jdttj }| d|zdz|j dr|j dd|_ tj|j |_ | |j dd t"zdS) N r-1Y-@,@,0I,C,-//Kc$)++&6&677  (94{BCCC 9  e $ $ ' #2#DIG$$TY//  TY%%lI>>DEEEEEr=c |jdkr%|j||j|_|xjt |z c_|jdkr|j|}||dS)Nrr) rrrrrr5rcompressrrs r;rlz _Stream.writesx =D yq$(33DH CFF =E ! !!!!$$A Qr=c* |xj|z c_t|j|jkrd|j|jd|j|j|jd|_t|j|jkbdSdSr)rbr5rprrlrs r;__writez_Stream.__writes  A $(mmdl** L  tx  6 7 7 7x .DH$(mmdl******r=c |jrdSd|_ |jdkr2|jdkr'|xj|jz c_|jdkr|jr|j|jd|_|jdkrg|jtj d|j |jtj d|j dz|j s|j dSdS#|j s|j wwxYw)NTrrr=rrl)rrrrbrflushrrlr`rrrrrrs r;rz _Stream.closes?  ;  F  %yCDMU$:$:DHNN,,,yCDH ""48,,,=D((L&&v{4'B'BCCCL&&v{4J9N'O'OPPP# % ""$$$$$ % %4# % ""$$$$ %s C'D#Ec |j|jj |_d|_|ddkrt d|ddkrtdt|d}|d|d zr]t|dd t|dzz}| ||d zr% |d}|r |tkrn$|d zr% |d}|r |tkrn$|dzr|ddSdS)Nr=r%snot a gzip filer$zunsupported compression methodrHrGT) r decompressobjrrr _Stream__readrr ordrkr6)rflagxlenr7s r;rz_Stream._init_read_gzs 9**DI,?+?@@  ;;q>>[ ( (-.. . ;;q>>W $ $"#CDD D4;;q>>"" A !8 t{{1~~&&s4;;q>>/B/B)BBD IIdOOO !8  KKNNAHH  "9  KKNNAHH  !8  KKNNNNN  r=c |jSr)rrs r;tellz _Stream.tells xr=rc ||jz dkrbt||jz |j\}}t|D]}||j||nt d|jS)Nrz seeking backwards is not allowed)rrjrprMrkr )rrrqrrrRs r;seekz _Stream.seeks  >Q   &sTX~t| D D FI6]] ( ( $,'''' IIi @AA Axr=cl ||}|xjt|z c_|Sr)_readrr5)rr(rbs r;rkz _Stream.read s1Cjj CHH r=c* |jdkr||St|j}|jg}||kr|jr|j}d|_n"|j|j}|snk |j |}n"#|j $r}td|d}~wwxYw| ||t|z }||kd |}||d|_|d|S)Nrr=zinvalid compressed data)rrr5rrbrrkrpr decompressrorappendjoin)rr(ctrbes r;rz _Stream._reads* =E ! !;;t$$ $  NN YK$hhx hl'' 55 Bh))#..> B B B 9::A B HHSMMM SMA$hh HHQKKdeeH $xs=B B7"B22B7cB t|j}|jg}||krO|j|j}|sn-|||t|z }||kOd|}||d|_|d|S)Nr=)r5rbrrkrprr)rr(rrrbs r;__readz_Stream.__read.s  MM XJ$hh,##DL11C  HHSMMM SMA $hh HHQKKTUU8$xr=N)r)rrrrrrrlrrrrrrkrrrr=r;rrLs DDDLFFF ///%%%,>    6r=rc(eZdZ dZdZdZdZdS)rc\||_|jt|_dSr)rrk BLOCKSIZErb)rrs r;rz_StreamProxy.__init__Ds$ <$$Y//r=c2|jj|_|jSr)rrkrbrs r;rkz_StreamProxy.readHsL% xr=c|jdrdS|jdddkr|jdddkrd S|jd rd Sd S) NsrrsBZhr s1AY&SYr)s]s7zXZrr)rb startswithrs r;rz_StreamProxy.getcomptypeLsp 8   / / 4 Xac]f $ $!B$9)D)D5 X !C D D 45r=c8|jdSr)rrrs r;rz_StreamProxy.closeVs r=N)rrrrrkrrrr=r;rr?sU000r=rc^eZdZ d dZdZdZdZdZdZe j fdZ d d Z d Z d ZdS) _FileInFileNc||_||_||_d|_t |dd|_d|_|d|fg}d|_g|_d}|j}|D]T\}}||kr|j d||df|j d|||z|f||z }||z}U||jkr%|j d||jdfdSdS)NrrFT) roffsetr(positionrxrr map_indexmapr)rrr r( blockinfolastposrealposs r;rz_FileInFile.__init__cs    GVT22   T I+% $ $LFD >??? HOOT66D='B C C C tOGtmGG TY   HOOUGTY= > > > > >  r=cdSrrrs r;rz_FileInFile.flush|s r=cdSNTrrs r;readablez_FileInFile.readablestr=cdSNFrrs r;writablez_FileInFile.writablesur=c4|jSr)rseekablers r;rz_FileInFile.seekables|$$&&&r=c |jSr)r rs r;rz_FileInFile.tells }r=c |tjkr)tt|d|j|_n|tjkrG|dkrt|j|zd|_nst|j|z|j|_nP|tjkr1tt|j|z|jd|_ntd|jS)NrzInvalid argument) ioSEEK_SETminmaxr(r SEEK_CURSEEK_ENDr3)rr whences r;rz_FileInFile.seeks R[ Ha 0 0$)< r=r ceZdZfdZxZS) ExFileObjectct|j|j|j|j}t |dSr)r r offset_datar(sparsesuperr)rtarfiletarinfor __class__s r;rzExFileObject.__init__sBgow/B gn.. !!!!!r=rrrr __classcell__r4s@r;r-r-s8"""""""""r=r-ceZdZdS) FilterErrorNr~rr=r;r9r9sDr=r9ceZdZfdZxZS)AbsolutePathErrorcj||_td|jddS)Nzmember z has an absolute pathr3r1rrrr3r4s r;rzAbsolutePathError.__init__s6  H7<HHHIIIIIr=r5r7s@r;r;r;sAJJJJJJJJJr=r;ceZdZfdZxZS)OutsideDestinationErrorc||_||_t|jd|ddzdS)Nz would be extracted to , which is outside the destinationr3_pathr1rrrr3r&r4s r;rz OutsideDestinationError.__init__sT   GLMM4MMM=> ? ? ? ? ?r=r5r7s@r;r@r@8?????????r=r@ceZdZfdZxZS)SpecialFileErrorch||_t|jddS)Nz is a special filer=r>s r;rzSpecialFileError.__init__s3  GL>>>?????r=r5r7s@r;rIrIsA@@@@@@@@@r=rIceZdZfdZxZS)AbsoluteLinkErrorch||_t|jddS)Nz is a link to an absolute pathr=r>s r;rzAbsoluteLinkError.__init__s3  GLJJJKKKKKr=r5r7s@r;rLrLsALLLLLLLLLr=rLceZdZfdZxZS)LinkOutsideDestinationErrorc||_||_t|jd|ddzdS)Nz would link to rBrCrDrFs r;rz$LinkOutsideDestinationError.__init__sT   GLEE4EEE=> ? ? ? ? ?r=r5r7s@r;rOrOrGr=rOceZdZfdZxZS)LinkFallbackErrorc||_||_td|jdd|dzdS)Nzlink z would be extracted as a zcopy of z, which was rejectedrDrFs r;rzLinkFallbackError.__init__s`   JJJJBdBBBC D D D D Dr=r5r7s@r;rRrRsADDDDDDDDDr=rRTci}|j}tj|tjj}|dtjfr,|jdtjzx}|d<tj|rt|tjtj ||tjj}tj ||g|krt|||j }||dz}|rr|s|r|dzs|dz}|dz}n:|s|rd}nt%|||j kr||d<|r|jd|d <|jd|d <|jd|d <|jd|d <|s|rItj|jrt1|tj|j}||jkr||d <|rDtj |tj||j}n%tj ||j}tj|tjj}tj ||g|krt7|||S)N)rJ/ri@irr*r+r,r-linkname)rrr&realpath ALLOW_MISSINGrseplstripisabsr;r commonpathr@risregislnkisdirissymrIr*r+r,r-rXrLnormpathdirnamerO)member dest_pathfor_data new_attrsr target_pathr normalizeds r;_get_filtered_attrsrks(I ;D  273H III RV}%%D#);#5#5cBFl#C#CCy  w}}T( ''''""27<< 4#@#@*,'*?#AAK w; 233y@@%fk::: ;D e|  /||~~ / /e|#FND  /6<<>> /'v... 6;   $If G : !#Ie  : !#Ie  < #!%Ig  < #!%Ig  <<>> GV\\^^ Gw}}V_-- 0'///))&/::JV_,,(2 *%||~~ < gll9+-7??4+@+@+1?<< !gll9+1?<< '**;24'2G+IIKw!!; ":;;yHH1&+FFF r=c|Srr)rerfs r;fully_trusted_filterrmBs Mr=cNt||d}|r|jdi|ddiS|S)NFdeeprrkrrerfrhs r; tar_filterrrEsC#FIu==I7v~66 666666 Mr=cNt||d}|r|jdi|ddiS|S)NTroFrrprqs r; data_filterrtKsC#FIt<Zd?Zd@ZdAZ dBZ!dCZ"dDZ#dEZ$dFZ%dGZ&dHZ'dIZ(dJZ)dKZ*dLZ+dMZ,dNZ-dOZ.dPZ/dQZ0dRZ1dSZ2d$S)VrrzName of the archive member.rzPermission bits.r*z6User ID of the user who originally stored this member.r+z7Group ID of the user who originally stored this member.r(zSize in bytes.r)zTime of last modification.chksumzHeader checksum.typezFile type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.rXzcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.r,z User name.r-z Group name.devmajorzDevice major number.devminorzDevice minor number.r zThe tar header starts here.r/zThe file's data starts here. pax_headerszMA dictionary containing key-value pairs of an associated pax extended header.r0zSparse member information.r2N_sparse_structs _link_targetrc ||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS)Nirr)rrr*r+r(r)rwREGTYPErxrXr,r-ryrzr r/r0r{rrs r;rzTarInfo.__init__s              r=c |jSrrrs r;r&z TarInfo.paths 2yr=c||_dSrrrs r;r&z TarInfo.paths  r=c |jSrrXrs r;r'zTarInfo.linkpaths :}r=c||_dSrr)rrXs r;r'zTarInfo.linkpaths   r=cJd|jj|jt|fzS)Nz<%s %r at %#x>)r4rridrs r;__repr__zTarInfo.__repr__s!4>#:49RXX"NNNr=T) rr)rrXr*r+r,r-ro_KEEPc  | rtj|} ntj|} || ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _|| ur|| _ | Sr) copydeepcopyrr)rrXr*r+r,r-) rrr)rrXr*r+r,r-rorresults r;rzTarInfo.replaces  %]4((FFYt__F u  FK    FL u  FK 5 &FO e  FJ e  FJ    FL    FL r=c@ |jd}n |jdz}|j||j|j|j|j|j|j|j|j |j |j |j d }|dtkr+|dds|dxxdz cc<|S)N) rrr*r+r(r)rwrxrXr,r-ryrzrxrrU)rrr*r+r(r)rwrxrXr,r-ryrzDIRTYPEr)rrinfos r;get_infozTarInfo.get_infos 9 DD9v%D             <7 " "4<+@+@+E+E " LLLC LLL r=surrogateescapecp |}|D]\}}|td|z|tkr||||S|t kr||||S|tkr|||Std)Nz%s may not be Nonezinvalid format) ritemsr3rcreate_ustar_headerrcreate_gnu_headerrcreate_pax_header)rrYr9r:rrvalues r;tobufz TarInfo.tobufs }}::<< > >KD%} !5!<=== \ ! !++D(FCC C z ! !))$&AA A z ! !))$99 9-.. .r=c t|d<t|d||tkrt dt|d||t kr&||d||\|d<|d<||t||S)NmagicrXzlinkname is too longrprefix) POSIX_MAGICr5r4 LENGTH_LINKr3 LENGTH_NAME_posix_split_name_create_headerr)rrr9r:s r;rzTarInfo.create_ustar_headers #W tJ&&x88 9 9K G G344 4 tF|""8V44 5 5 C C+/+A+A$v,PXZ`+a+a (DNDL""4xHHHr=c t|d<d}t|d||tkr&|||dt ||z }t|d||t kr&|||dt||z }|||t||zS)Nrr=rXr) GNU_MAGICr5r4r_create_gnu_long_headerGNUTYPE_LONGLINKrGNUTYPE_LONGNAMErr)rrr9r:rbs r;rzTarInfo.create_gnu_headers !W  tJ&&x88 9 9K G G 4//Z0@BRT\^dee eC tF|""8V44 5 5 C C 4//V >NPXZ`aa aCT((z8VLLLLr=c t|d<|j}ddtfddtfddfD]h\}}}||vr ||dd n#t $r||||<Y@wxYwt|||kr ||||<id D]u\}}d }||} t| t} | rt| n| } d | cxkr d |dz zks nd ||<d}n | r| ||<d}|r||vrt| ||<v|r| |t|} nd} | ||tddzS)Nrrr&rXr')r,r, )r-r-rrIrJ))r*rG)r+rG)r( )r)rFrrGr$Tr=r)rr{rrrr4UnicodeEncodeErrorr5 isinstancefloatroundstr_create_pax_generic_headerXHDTYPErr) rrr9r{rhnamer8rX needs_paxval val_is_floatval_intrbs r;rzTarInfo.create_pax_headers $W &++-- - J /T&(>$@ 0 0 D% ## T !!'84444%   %)$Z E" 4:''%)$Z E"R - -LD&It*C%c511L$09eCjjjcG3333! "33333T   !%T   -T44$'HH D!  11+wQQCCCT((|WiPPPPsA$$A<;A<c< ||tdS)Nr1)rXGLTYPE)clsr{s r;create_pax_global_headerz TarInfo.create_pax_global_headerOs --k7GLLLr=c |d}tdt|D]}d|d|}d||d}t|||t kr.t|||t krntd||fS)NrUr$zname is too long)splitrMr5rr4 LENGTH_PREFIXrr3)rrr9r: componentsrRrs r;rzTarInfo._posix_split_nameUs ZZ__ q#j//** 1 1AXXj!n--F88JqrrN++D6==62233}DD Hf5566+EE/00 0t|r=c |dttfv}|rKt|ddd|}t|ddd|}n$t dd||}t dd||}|dt }|t dt |ddd ||t|d dd zd|t|d dd|t|d dd|t|ddd|t|ddd|d|t |ddd |||dtt |ddd||t |ddd||||t |ddd||g}tj dtzd |} t| t dd} | ddtd| zdz| ddz} | S)NrxryrrGrzrzTarInfo.type must not be Nonerrrrr*r+r(rr)s rXrr,rr-rrz%dsr=iz%06orIi)getCHRTYPEBLKTYPEr[r<rr3rr`rrrrerU) rrYr9r:has_device_fieldsryrzfiletypepartsrbrws r;rzTarInfo._create_headeres !HHV,,'0BB  4488J22Av>>H488J22Av>>HH2q(F33H2q(F33H88FG,,  <== = $$c8V < < ##f,a 8 8 ""Av . . ""Av . . ##R 0 0 !$$b& 1 1   R((#x @ @ HHWk * * "%%r8V < < "%%r8V < <   2&&Xv > > $k%)+SXXe__==c9*++.//2%4%j5F!2G<<EMPUU UGG'V V 7||V #W !!$ gyII##G,,- -s5 AAc t|dkrtdt|tkrtd|t tkrt dt|dd}|t|vrtd|}t|dd|||_ t|dd |_ t|d d |_ t|d d |_t|d d |_t|d d|_||_|dd |_t|d d|||_t|dd|||_t|dd|||_t|dd|_t|dd|_t|dd||}|jt0kr&|j dr t4|_|jt6krd}g}t9dD]h} t|||dz} t||dz|dz} n#t:$rYn!wxYw|| | f|dz }it?|d} t|dd} || | f|_ |!r|j "d|_ |r |jtFvr|dz|j z|_ |S)Nrz empty headerztruncated headerzend of file headerz bad checksumrlt|ii i)iIiQiYirUirriii)$r5rrrcountr6rrSrerPrCrrr*r+r(r)rwrxrXr,r-ryrzAREGTYPErrGNUTYPE_SPARSErMr3rboolr|rarstrip GNU_TYPES)rrbr9r:rwobjrrstructsrRr numbytes isextendedorigsizes r;frombufzTarInfo.frombufsI s88q==">22 2 s88y &'9:: : 99S>>Y & & !566 6SS\"" c** * *$^44 4cees1S5z8V44s3s7|$$c#c'l##c#c'l##s3s7|$$CG %%  s3w<3s3w<6:: CG h77 CG h77 3s3w<(( 3s3w<(( SS\8V44 8x  CH$5$5c$:$: CH 8~ % %CG1XX   Sr\!233F"3sRxb'8#9::HH!EE1222r c#hJ3s3w<((H#*J"AC  99;; ,xs++CH  /chi//|ch.CH s7J== K  K c |jt}|||j|j}|jtz |_||Sr) rrkrrr9r:rr  _proc_member)rr2rbrs r; fromtarfilezTarInfo.fromtarfilesf o""9--kk#w/@@_))++i7 (((r=c, |jttfvr||S|jtkr||S|jt ttfvr| |S| |Sr) rxrr _proc_gnulongr _proc_sparserrSOLARIS_XHDTYPE _proc_pax _proc_builtin)rr2s r;rzTarInfo._proc_member1s  9)+;< < <%%g.. . Y. ( ($$W-- - Y7G_= = =>>'** *%%g.. .r=c |j|_|j}|s|jt vr|||jz }||_| |j |j |j | r|jd|_|SNrU)rrr/r_rxSUPPORTED_TYPES_blockr(r _apply_pax_infor{r9r:rarr)rr2r s r;rzTarInfo._proc_builtin>s #?//11! ::<< -49O;; dkk$),, ,F W0'2BGNSSS ::<< . ((--DI r=c8 |j||j} ||}n/#t $r"}t t|dd}~wwxYw|j|_|j tkr!t||j |j |_n0|j tkr t||j |j |_|r|jd|_|Sr)rrkrr(rr rrr rxrrCr9r:rrrXra removesuffix)rr2rbnextrs r;rzTarInfo._proc_gnulongTs o""4;;ty#9#9:: :##G,,DD : : :'A//T 9 : k 9( ( (C!17>BBDII Y* * *W%5w~FFDM ::<< 4 ..s33DI sA A7A22A7c4 |j\}}}|`|r|jt}d}t dD]l} t |||dz}t ||dz|dz} n#t $rYn%wxYw|r| r||| f|dz }mt|d}|||_ |j |_ |j | |j z|_||_ |S)Nrrri)r|rrkrrMrSr3rrr0rr/rr(r ) rr2rrrrbrrRr rs r;rzTarInfo._proc_sparseosK )-(<%X   (/&&y11CC2YY   Sr\!233F"3sRxb'8#9::HH!EE7h7NNFH#5666r c#hJ ( "?//11)DKK ,B,BB  s7A<< B  B c |j||j}|jt kr|j}n|j}d}d}g}t||kr||dkrst ||x}std t| d}n#t$rtdwxYw|dkrtd||zt|krtd|d|zdz } ||ddz| } | d\} } } | r| dks || dkrtd||| | f| dkr|| dkr|j}nd }||z }t||kr ||dks|d }|D]q\}} } || d d |j}|t,vr#|| ||j|j}n|| d d |j}|||<r ||}n/#t0$r"}t3t5|dd}~wwxYwd |vr|||ndd |vr|||nI|d d kr0|ddkr|||||jt>t@fvr~|!||j|j|j"|_"d|vrM|j#}|$s|jtJvr|||jz }||_"|S)NrrLr$rrs hdrcharsetsBINARYr1GNU.sparse.mapGNU.sparse.sizezGNU.sparse.major1zGNU.sparse.minorrKr()&rrkrr(rxrr{rr5_header_length_prefix_rematchrPrNgroupr3r'rw partitionrr9_decode_pax_fieldr:PAX_NAME_FIELDSrr rr_proc_gnusparse_01_proc_gnusparse_00r_proc_gnusparse_10rrrr r/r_r)rr2rbr{rr9 raw_headersrr8header_value_end_offsetkeyword_and_value raw_keywordequals raw_valuerrrrr s r;rzTarInfo._proc_paxsF o""4;;ty#9#9:: 9  !-KK!-2244K  #hhnnST!1!15;;CEEEE ;()9::: ;U[[^^,, ; ; ;()9::: ;zz()9:::V|c#hh&&()9:::&+kk!nnv&=&A # #EIIaLL1$45L$L M ->-H-H-N-N *K ;&D..C8O4PTX4X4X()9:::    Y? @ @ @m++0@ ))&/HH&H 6MCM#hhnnST!1!1R  H/: ) ) *FK,,['7N$$G/))..y(GDT((..y'7(($)K  :##G,,DD : : :'A//T 9 : { * *  # #D+ 6 6 6 6 + - -  # #D+ 6 6 6 6 __/ 0 0C 7 7KOOL^<_<_cf O O O+DK$$)::<<549O#C#Cdkk$)444F!' s$9"CC68J J:J55J:c g}g}|D]\}}}|dkrS |t|B#t$rt dwxYw|dkrS |t|#t$rt dwxYwt t |||_dS)NsGNU.sparse.offsetrLsGNU.sparse.numbytes)rrNrAr3rPlistzipr0)rrr offsetsr_rrs r;rzTarInfo._proc_gnusparse_00s  !, ? ? Aw...?NN3u||~~#6#67777!???,-=>>>?222?OOC $7$78888!???,-=>>>?3 3w1122 s4A  A$.4B##B=c  d|ddD}tt|ddd|ddd|_dS)Nc,g|]}t|Sr)rN).0xs r; z.TarInfo._proc_gnusparse_01..sKKKQ#a&&KKKr=r,r%r$)rrrr0)rrr{r0s r;rzTarInfo._proc_gnusparse_01s_ KK+.>"?"E"Ec"J"JKKK3vccc{F14a4L99:: r=c \ d}g}|jt}|dd\}}t |}t ||dzkrwd|vr"||jtz }|dd\}}|t |t ||dzkw|j|_tt|ddd|ddd|_ dS)Nrr$r%) rrkrrrNr5rrr/rrr0)rrr{r2fieldsr0rbnumbers r;rzTarInfo._proc_gnusparse_10s o""9--iiq)) V&kkFQJ&&Cw++I666))E1--KFC MM#f++ & & & &kkFQJ&& #?//113vccc{F14a4L99:: r=c |D]\}}|dkrt|d||dkrt|dt|B|dkrt|dt|g|tvr^|tvr) t ||}n#t $rd}YnwxYw|dkr|d}t|||||_dS)NzGNU.sparse.namer&rr(zGNU.sparse.realsizerrU) rsetattrrN PAX_FIELDSPAX_NUMBER_FIELDSr3rrr{)rr{r9r:rrs r;rzTarInfo._apply_pax_info.s4 *//11 . .NGU+++fe,,,,---fc%jj1111111fc%jj1111J&&///" 1' :5 A A%""" !"f$$!LL--Egu---&++--sB&& B54B5c~ ||dS#t$r|||cYSwxYw)NrJ)rAUnicodeDecodeError)rrr9fallback_encodingfallback_errorss r;rzTarInfo._decode_pax_fieldEs[  D<<(33 3! D D D<< 1?CC C C C Ds  <<cV t|t\}}|r|dz }|tzS)Nr$)rjr)rrrqrrs r;rzTarInfo._blockMs9 #5)44   aKF !!r=c |jtvSr)rx REGULAR_TYPESrs r;r_z TarInfo.isregVs>yM))r=c, |Sr)r_rs r;isfilezTarInfo.isfileZs>zz||r=c$ |jtkSr)rxrrs r;raz TarInfo.isdir^+yG##r=c$ |jtkSr)rxSYMTYPErs r;rbz TarInfo.issymbs/yG##r=c$ |jtkSr)rxLNKTYPErs r;r`z TarInfo.islnkfr+r=c$ |jtkSr)rxrrs r;ischrz TarInfo.ischrjs2yG##r=c$ |jtkSr)rxrrs r;isblkz TarInfo.isblkns.yG##r=c$ |jtkSr)rxFIFOTYPErs r;isfifozTarInfo.isfifors&yH$$r=c|jduSr)r0rs r;issparsezTarInfo.issparsevs{$&&r=c: |jtttfvSr)rxrrr5rs r;isdevz TarInfo.isdevysMyWgx888r=r)r)3rrrdict __slots__rpropertyr&setterr'rrrrrr rrrr classmethodrr staticmethodrrrrrrrrrrrrrrrrrr_r)rarbr`r1r3r6r8r:rr=r;rrasv   ,, !! GF HG     -,  $# >> FF     *) *)! "/.# $54% &99' *.-+ ,$- .$/ 0t1 I60X [[X_!!_!OOO%eeuE88*HEV////" I I I M M M8Q8Q8QtMM[M  ''\'R\**[* 0-0-[0-d<<[<|))[)( / / /,68wwwr333(;;; ;;; ....DDD"""***$$$$$$$$$$$$$$$%%%'''99999r=rceZdZ dZdZdZdZeZe Z dZ e Z eZdZ d?dZedddefdZed@d ZedAd ZedAd ZedBd ZdddddZdZdZdZdZdCdZdDdddZdEdddZ dFdZ!dZ"dGddd d!Z#d"Z$dHddd d$Z%d%Z& dFd&Z'd'Z(d(Z)d)Z* dIddd*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6dJd7Z7d8Z8dFd9Z9d:Z:d;Z;d<ZZ>dS)KrrFr$Nrrc ddddd}||vrtd||_|||_|sU|jdkr-tj|sd|_d|_t ||j}d |_n]|8t|d r(t|j ttfr|j }t|d r |j|_d |_|rtj |nd|_ ||_|||_|||_|||_|||_|||_| |_| |jt*kr| |_ni|_| | |_| | |_| |_d |_g|_d |_|j|_i|_ |jd kr d|_ |!|_ |jdkr |j"|j |j#|}|j$|nY#tJ$r"|j"|jYn/tL$r"}tOt|dd}~wwxYw|jdvrxd |_|jrl|j(|j)}|j*||xjtW|z c_dSdSdS#|js|j,d |_xYw)Nrbzr+bwbxbrarr!mode must be 'r', 'a', 'w' or 'x'rGrFrrTrrGrr)-r3r_moderr&exists bltn_openrrrrrrUabspathrrYr3 dereference ignore_zerosr9r:rr{debug errorlevel copybufsizermembers_loadedrr inodes firstmemberrrrrrr rrrrlr5r)rrrrrYr3rNrOr9r:r{rPrQrRmodesrrbs r;rzTarFile.__init__s T== u  @AA A 4[  $yCt(<(< ! dj11G$D   &!9!9 7<#u66|w'' *$\ #D -1;BGOOD)))t     DK  "DL  "*D   # ,D   $DM  "t{j'@'@*D  !D   DJ  !(DO'   l''))   yC#' #'99;; yC :L%%dk222:"&,":":4"@"@ ++G4444) ))$+666&:::'A//T9: :yO++# #,,??@P@U@U@W@WXXCL&&s+++KK3s88+KKKK ,+,, # % ""$$$DK s>.not_compressed3s}X.);;r=)keyrz - method z:  z'file could not be opened successfully: :r$rr|rzmode must be 'r' or 'w'FrIzundiscernible mode)r3sortedr\rxrrr rrrrrrrr[)rrrrrpkwargsr] error_msgsrfunc saved_posrerror_msgs_summaryfilemodestreamrs` r;rz TarFile.open s! F 0G 0.// / <   < < < < <J"3=nEEE  sCM($;<<& ' I4c7==f=====!#34%%&C(&C&Ca&C&CDDD* Y///HHHH  "&:!6!6 [GY[[\\ \ D[[!%C!3!3 Hh3H(5H3=((sCM($;<<&'Dx'OPPP4h::6:: : D[[!%C!3!3 Hh3H(5Hz)) !:;;;T8XwHHF Ch99&99  !AMH _ $ $3;tT7==f== =-...s$+ A88C 2CC" F..Gc @ |dvrtd||||fi|S)NrFrH)r3)rrrrrcs r;r[zTarFile.taropengs> + + +@AA As4w11&111r=rc  |dvrtd ddlm}n#t$rt ddwxYw |||dz||}n+#t $r}||dkrt d|d}~wwxYw |j|||fi|}nR#t $r0}||dkrt d|d}~w|xYwd |_ |S) Nrrrmode must be 'r', 'w' or 'x'r)GzipFilezgzip module is not availablersrrF) r3gziprnrr rrr[rr) rrrr compresslevelrcrnrrs r;gzopenzTarFile.gzopenosX   & &;<< < M % % % % % % % M M M"#ABB L M htTCZHHGG   "ts{{ 1229    D$::6::AA    MMOOOs{{ 1229   MMOOO  s78A A6A11A6:B C+CCc ~ |dvrtd ddlm}n#t$rt ddwxYw||p|||} |j|||fi|}nY#t tf$r0}||dkrtd|d}~w|xYwd |_ |S) Nrlrmr)BZ2Filer)rprznot a bzip2 fileF) r3rrsrr r[rEOFErrorrrr) rrrrrprcrsrrs r;bz2openzTarFile.bz2opens   & &;<< < L # # # # # # # L L L"#@AAt K L''/T4}MMM  D$::6::AA"    MMOOOs{{ 233:   MMOOO  s 8 AB3.+BB3c x |dvrtd ddlm}m}n#t$rt ddwxYw||p|||} |j|||fi|}nT#|tf$r0} ||dkrtd| d} ~ w|xYwd |_ |S) Nrlrmr)LZMAFilerr)presetrznot an lzma fileF) r3rrwrrr r[rtrrr) rrrrrxrcrwrrrs r;xzopenzTarFile.xzopens   & &;<< < M 0 0 0 0 0 0 0 0 0 M M M"#ABB L M(7?dD@@@  D$::6::AA8$    MMOOOs{{ 233:   MMOOO  s :A B0++BB0r[rqrury)rrrrc |jrdSd|_ |jdvr|jtt dzz|xjt dzz c_t|jt\}}|dkr*|jtt|z z|j s|j dSdS#|j s|j wwxYw)NTrIr%r) rrrrlr6rr rj RECORDSIZErr)rrqrrs r;rz TarFile.closes  ;  F  %yO++ ""3)a-#8999 A . %+4; $C$C! q==L&&sj9.D'EFFF# % ""$$$$$ % %4# % ""$$$$ %s BC#C2c ||d}|td|z|S)NrUzfilename %r not found) _getmemberrKeyError)rrr3s r; getmemberzTarFile.getmembersD //$++c"2"233 ?2T9:: :r=cp ||js||jSr)_checkrT_loadrSrs r; getmemberszTarFile.getmemberss5  |  JJLLL|r=c@ d|DS)Ncg|] }|j Srr)rr3s r;rz$TarFile.getnames..s>>> >>>r=)rrs r;getnameszTarFile.getnamess' ?>DOO,=,=>>>>r=c |d||j}||}tj|\}}|tjd}|d}|}||_ |1|j stj |}n;tj |}n&tj |}d}|j}tj|ri|j|jf} |j s:|jdkr/| |jvr&||j| krt*} |j| }nt,} | dr ||j| <ntj|rt0} ntj|rt4} njtj|rt8} tj|}n:tj|rt>} ntj |rtB} ndS||_||_"|j#|_$|j%|_&| t,kr |j'|_(nd|_(|j)|_*| |_+||_,tZr6 t[j.|j$d|_/n#t`$rYnwxYwtbr6 tcj2|j&d|_3n#t`$rYnwxYw| t>tBfvrftitdrQtitdr$J## J0/J0;$K K-,K-T)rSc |||}|D]}|r|jtdn&ttj|jt|jp|jd|jp|j| s| r"tdd|j |j fzzntd|j z|jtdn1tdtj|jddzt|j|rdnd z|rV|rtd |jz|rtd |jzt-dS) Nz ??????????rUz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02drrz-> zlink to )rrr|rrhr,r*r-r+r1r3ryrzr(r)r localtimerrarbrXr`r{)rverboserSr3s r;rz TarFile.listfs ?G  G E<' ---- gl ; ;<<<w}'C 'C'C'.}'C 'CEFFF==??7gmmoo7$(8':J'KK!MNNNN  5666=( 56666 ="&."?"?"C!DEEE  w}}(FBG H H H ?==??:(8 8999==??? W-= =>>> GGGG5  r=filterc |d||}|jCtj||jkr|dd|zdS|d||||}||dd|zdS|(||}||dd|zdS|rAt|d5}| ||ddddS#1swxYwYdS| r| ||ryttj |D]Y}| tj||tj||||XdSdS| |dS) Nrr%ztarfile: Skipped %rr$ztarfile: Unsupported type %rtarfile: Excluded %rrCr)rrrr&rM_dbgrr_rLaddfilerarblistdiraddr)rrr recursiverr3fs r;rz TarFile.addsI  E ?G 9 RW__T%:%:di%G%G IIa.5 6 6 6 F !T//$00 ? IIa7$> ? ? ? F  fWooG !3d:;;; ==?? "4&& )! Wa((( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )]]__ " LL ! ! ! 6 4 0 01166AHHRW\\$22BGLL!4L4L%f6666 6 666 LL ! ! ! ! !s<D  D$'D$ch |dtj|}||j|j|j}|j||xjt|z c_|j }|t||j|j |t|j t\}}|dkr/|jtt|z z|dz }|xj|tzz c_|j|dS)Nr)rprr$)rrrrYr9r:rrlr r5rRrir(rjrr6rSr)rr3rrbrprqrrs r;rzTarFile.addfiles E)G$$mmDK DD 3 s3xx     w|W M M M M &w|Y ? ? FI1}} ""3)i*?#@AAA!  KK6I- -KK G$$$$$r=c|6|j}|tSt|trt d|St |r|S t |S#t$rtd|ddwxYw)NzrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.zfilter z not found) extraction_filterrmrr TypeErrorcallable_NAMED_FILTERSr~r3)rrs r;_get_filter_functionzTarFile._get_filter_functions >+F~++&#&& 76777M F   M G!&) ) G G G;v;;;<<$ F Gs AA7.) numeric_ownerrc4 g}||}||}|D]u}||||\}} ||r|| |||| ||v|dd|D]g} || |}n:#t $r-} || t| Yd} ~ Dd} ~ wwxYw||| detj ||j } tj | } n&#t$r||dYwxYwtj| js||d||| |||| ||| <#t*$r } || Yd} ~ ad} ~ wwxYwdS) N) set_attrsrfilter_functionc|jSrr)rGs r;z$TarFile.extractall.. sqvr=T)r^reversezexcluded by filtermissingznot a directory)r)r_get_extract_tarinforar _extract_onesort_FILTER_ERRORS_log_no_directory_fixupreprrr&rrrFileNotFoundErrorrrrchownutimechmodr _handle_nonfatal_error)rr&rSrr directoriesrrer3 unfilteredexcdirpathrrs r; extractallzTarFile.extractalls  33F;; ?G ? ?F"&";";#/#/ GZ}} /"":...   gt7==??7J,9.=  ? ? ? ? --t<<<& / /J /-oj$??GG%00T#YYGGGHHHH?001EGGG',,tW\::HW--EE(00)DDDH|EM2200:KLLL 7G= III 7G,,, 7G,,,, / / /++A........ /7 / /sm4 CG+ C8 #C3.G+3C88G+%G+:EG+ E2/G+1E222G+%AG++ H5HHcJ|dd|jd|ddS)Nr%z!tarfile: Not fixing up directory z ())rr)rrereasons r;rzTarFile._log_no_directory_fixup/ s: !!;;;( ) ) ) ) )r=rc ||}||||\}}||||||dSdSr)rrr) rrer&rrrrr3rs r;extractzTarFile.extract3 sk 33F;;"77 OT++     gtY F F F F F  r=c" t|tr||}n|}d} |||}nZ#ttf$r}||Yd}~n/d}~wt $r}||Yd}~nd}~wwxYw| |dd|j zdS| r>tj |}tj ||j|_||fS)Nr%r)NN)rrrrr9_handle_fatal_errorr rrrr`rrr&rrXr})rrerr&rfilteredrs r;rzTarFile._get_extract_tarinfoG sA  fc " " //JJJ +&z488HH% ( ( (  $ $Q ' ' ' ' ' ' ' ' + + +  ' ' * * * * * * * * +   IIa/*/A B B B: >>   Jy**H$&GLLx7H$I$IH !##s! ?BA** B7BBcZ |d ||tj||j||||dS#t $r }||Yd}~dSd}~wt$r }| |Yd}~dSd}~wwxYw)Nr)rrrextraction_root) r_extract_memberrr&rrrrr r)rr3r&rrrrs r;rzTarFile._extract_onee s C +  "',,tW\*J*J+4/<1@15 ! 7 7 7 7 7  ( ( (  $ $Q ' ' ' ' ' ' ' ' ' + + +  ' ' * * * * * * * * * +s#>A B*"A== B* B%%B*cR |jdkr|dd|zdS)Nr$ tarfile: %s)rQrrrs r;rzTarFile._handle_nonfatal_errory s4K ?Q    IIa* + + + + +r=cD |jdkrt|trO|j |dd|jzdS|dd|jd|jdS|ddt |jd|dS)Nrr$rz tarfile: rv)rQrrfilenamerstrerrorrxrrs r;rzTarFile._handle_fatal_error s? ?Q    7 # # Cz! !]QZ788888 !!QZZHIIIII IIaaT!WW-=-=-=qqA B B B B Br=c |dt|tr||}n|}|s|jt vr|||S|s| rQt|j trtd| ||SdS)Nrz'cannot extract (sym)link as file object)rrrrr_rxr fileobjectr`rbrrr extractfile_find_link_target)rrer3s r;rzTarFile.extractfile s C fc " " nnV,,GGG ==?? gl/AA??411 1 ]]__   $,00 I""KLLL''(>(>w(G(GHHH4r=rrc" |d}|dtj}tj|}|r3tj|stj||s| r&| d|j d|j n| d|j | r|||n|r|||n|r|||n|s|r|||n}|s| r|||||n;|jt0vr|||n||||rY||||| s0||||||dSdSdS)NrUr$z -> r)rrrr[r&rdrKmakedirsr`rbrrrXr_makefileramakedirr6makefifor1r3makedevmakelink_with_filterrxr makeunknownrrr)rr3 targetpathrrrr upperdirss r;rzTarFile._extract_member sy  &&s++ ''RV44 GOOJ//  #RW^^I66 # K " " " ==?? 'gmmoo ' IIaw|||W5E5EF G G G G IIa & & & ==?? / MM': . . . . ]]__ / LL* - - - - ^^   / MM': . . . . ]]__ /  / LL* - - - - ]]__ /  /  % % / / & 1 1 1 1\ 0 0   Wj 1 1 1 1 MM': . . .  0 JJw M : : :==?? 0 7J/// 7J/////  0 0 0 0r=c |jtj|dStj|ddS#t$r$tj|sYdSwxYw)Ni)rrmkdirFileExistsErrorr&rarr3rs r;rzTarFile.makedir s  |#$$$$$U+++++   7==,,     s77*A%$A%c  |j}||j|j}t |d5}|ji|jD]2\}}||t |||t|3||j| nt |||jt|ddddS#1swxYwYdS)NrD) rrr/rRrLr0rirr(truncate)rr3rsourcerptargetr r(s r;rzTarFile.makefile s8  G'(((" z4 ( ( NF~)$+NJJLFDKK'''iIIII GL)))!!!!FFGL)WMMM N N N N N N N N N N N N N N N N N NsBCCCcp ||||dd|jzdS)Nr$z9tarfile: Unknown file type %r, extracted as regular file.)rrrxrs r;rzTarFile.makeunknown sT  gz*** !24;LA B B B B Br=cx ttdrtj|dStd)Nmkfifozfifo not supported by system)rrrr rs r;rzTarFile.makefifo s> 2x  ? Ij ! ! ! ! !=>> >r=c\ ttdrttdstd|j}|d}|r|t jz}n|t jz}tj||tj |j |j dS)Nmknodrz'special devices not supported by systemrW) rrr rr3rS_IFBLKS_IFCHRrrryrz)rr3rrs r;rzTarFile.makedev s r7## J72y+A+A JHII I| <D ==?? ! DL DD DL D TG,g.>?? A A A A Ar=c2|||ddSr)rrs r;makelinkzTarFile.makelink% s((*dDIIIr=c d} |rOtj|rtj|tj|j|dStj|jrtj |j|dSn#t$rd}YnwxYw | |}n!#t$r|rtddwxYw||}nG|td |||}n(#t$r}t||j|d}~wwxYw||||||dSdS)NFTz%unable to resolve link inside archivez[makelink_with_filter: if filter_function is not None, extraction_root must also not be Noner)rbrr&lexistsunlinksymlinkrXrKr}linksymlink_exceptionrr~r rrRrr) rr3rrrkeyerror_to_extracterrorrrcauses r;rzTarFile.makelink_with_filter( s $)  ,}} 7??:..*Ij))) 7+Z8887>>'"677GG0*===F! , , ,'+ $ $ $ , //88JJ   ' ";==BFG    "!HH&">??? M*?:GG! M M M'AAuL M    :1@1@ ! B B B B B s<A!B)(>B)) B87B8<CC0 D D<!D77D<c ttdr*tjdkr|j}|j}|s~ t r&|jrt j|jd}n#t$rYnwxYw tr&|j rtj |j d}n#t$rYnwxYw|d}|d} | r-ttdrtj |||dStj|||dS#t$r}t!d|d}~wwxYwdSdS)Ngeteuidrr%r?lchownzcould not change owner)rrrr+r*rr-getgrnamr~rr,getpwnamrbrrrr )rr3rrgurs r;rz TarFile.chownZ s 2y ! ! Dbjlla&7&7 A A ;w};L77:D;w};L77:Dyy D==??/wr8'<'</Ij!Q/////HZA..... D D D"#;< ?s( AAAc |j}|dSttdsdS tj|||fdS#t$r}t d|d}~wwxYw)Nrz"could not change modification time)r)rrrrr )rr3rr)rs r;rz TarFile.utime s   = Fr7##  F L HZ% 0 0 0 0 0 L L LCDD! K Ls> AAAc2 |d|j|j}d|_|S|j|jkrX|jdkrdS|j|jdz |jdstdd} |j |}n#t$rL}|j r:| dd|j|fz|xjtz c_Yd}~iYd}~nYd}~wt$rs}|j r:| dd|j|fz|xjtz c_Yd}~|jdkrtt|dYd}~nd}~wt $r|jdkrtddYnt"$r2}|jdkrtt|dYd}~n~d}~wt$$r"}tt|dd}~wt&$rD} ddl}t+||jrtd |d|#t.$r|wxYwd}~wwxYw ||j|nd|_|S) Nrarr$rgTr%z0x%X: %sz empty filez zlib error: )rrVr rrrrkrr3rrrOrrrPrrrr ExceptionrrrrrSrrT)rmr3rrs r;rz TarFile.next s6  D   ' A#D H ;$,++-- - -{at L  dkAo . . .<$$Q'' : 8999  ,22488!   $IIat{A.>!>???KK9,KKHHHH& 6 6 6$6IIat{A.>!>???KK9,KKHHHH[A%%#CFF++5&%%%%# < < <;!###L11t;$#' 6 6 6;!###CFF++5$####( 2 2 2A''T1   KKK!!TZ00 '(:q(:(:;;E"G     L   ( ( ( (DLs`,C I/ I/(G44 I/H I/,.I I''I**I/c |}d}|3 ||}|d|}n#t$rd}YnwxYw|rtj|}t |D]O}|r|j|jkrd}|r%tj|j}n|j}||kr|cSP|rt|dS)NFT) rindexr3rr&rcreversedr r) rrr3 normalizerSskippingrre member_names r;r}zTarFile._getmember s, //##   * g.."&5&/        *7##D))Dw''  F >V]22$H * g..v{;; $k {"" #  &W%% % & &s; A  A cH |}|nd|_dSr)rrT)rr3s r;rz TarFile._load s3  iikkG  r=c |jrtd|jjz| |j|vrtd|jzdSdS)Nz %s is closedzbad operation for mode %r)rrr4rr)rrs r;rzTarFile._check sb  ; D.4>+BBCC C    5 55 ABB B   5 5r=c8 |rOdtdtj|j|jf}d}n |j}|}|||d}|td|z|S)NrUT)r3r zlinkname %r not found) rbrrrr&rdrrXr}r~)rr3rXlimitres r;rzTarFile._find_link_target s  ==?? xxtbgoogl.K.KWM]-^ _ _``HEE'HE5DII >2X=>> > r=c#4K |jr|jEd{VdSd}|j|}|dz }|V |t |jkr|j|}n)|js |}|s d|_dSndS|dz }|VY)Nrr$T)rTrSrVrr5)rrr3s r;__iter__zTarFile.__iter__" s < | # # # # # # # F   'iikkG QJEMMM s4<((((,u-\ ))++#'DLF QJEMMM r=cX ||jkrt|tjdSdS)Nfile)rPr{rystderr)rlevelmsgs r;rz TarFile._dbgA s7 DJ   #CJ ' ' ' ' ' '  r=c.||Sr)rrs r; __enter__zTarFile.__enter__G s  r=c||dS|js|jd|_dSr)rrrr)rrxr tracebacks r;__exit__zTarFile.__exit__K sD < JJLLLLL# % ""$$$DKKKr=) NrNNNNNNrNNNN)rN)rNr)rNN)NNNTrr)rN)rT)TFr)?rrrrPrNrOrQrrYr r9r:rr3r-rrrr?r{rr[rqruryr\rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr}rrrr(rr0r3rr=r;rr~s, EKLJFH FGJAEHL>B)-bbbb^#tZ[/[/[/[[/z222[2[@[6[: I%%%*   ??? aaaaF$D$$$$$L1"1"1"1"1"1"f%%%%2GGG$C/%C/C/C/C/C/J)))GGGGGG($$$>&*++++(,,, C C C@>B&+10@D(,1010101010p   NNN BBB???AAA$JJJ0B0B0BdDDDB??? L L L<<<B&&&&&&&&PCCCC&>((( r=rc t|dr:|}t|}||nt|}|dS#t $rYdSwxYw)Nrk)rTF)rrrrrr)rrrs r;rrY s  4  ))++CT"""A IIcNNNNT A  t uusA-A22 B?Bc z ddl}d}||}|ddddd |d d td |d}|dddd|ddddd|ddddd|dd dd!|}|jr|j|d"d#|j |j }t|rt|d$5}| t| tj%dddn #1swxYwY|jr$td&|dSdS|d"d'|dS|j|j}t|rQt& |d(5}||j)ddddS#1swxYwYdS|d"d'|dS|jRt)|jd"kr|jd}t*j}nKt)|jd*kr |j\}}n(|d"|t|rt& |d(5}|||j+dddn #1swxYwY|jrC|d,krd-|} nd.||} t| dSdS|d"d'|dS|j|jd} t*j| \} } d/d/d0d0d1d1d1d1d2} | | vr d3| | znd4}|j}t& | |5}|D]}|| dddn #1swxYwY|jr&td5| dSdSdS)6Nrz3A simple command-line interface for tarfile module.) descriptionz-vz --verbose store_trueFzVerbose output)actiondefaulthelpz--filterz zFilter for extraction)metavarchoicesr;T)requiredz-lz--list zShow listing of a tarfile)r<r;z-ez --extract+)r?z zExtract tarfile into target dir)nargsr<r;z-cz--create)zzzCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr$z&--filter is only valid for extraction rr*z{!r} is a tar archive.z{!r} is not a tar archive. rY)rr%)r&rrz{!r} file is extracted.z+{!r} file is extracted into {!r} directory.rrr)rz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:rz{!r} file created.)argparseArgumentParser add_argumentradd_mutually_exclusive_group parse_argsrrexittestrrrr{ryr,rrYrrr5rcurdir format_helprcreatepopr&splitextr)rBr7parserrargsrmrtfrIr.tar_namerext compressionstar_mode tar_files file_names r;mainrWn s$OOOGK  $ $ $ = =F k,-///  N .4666  / / / > >E tX{7999 t[<=??? tZs39;;; tX{8:::     D {Bt|+ A@AAA yi c?? Gc3 93   cnn&&SZ8888 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9| <.55c::;;;;; < < KK9@@EE F F F F F  i c?? Gc5)) .R --- . . . . . . . . . . . . . . . . . . KK9@@EE F F F F F  ! t|   ! !,q/CYFF   ! # #,KC KK6--// 0 0 0 c?? Gc5)) ?R 6$+ >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| S==3::3??CC2396#v3F3Fc    KK9@@EE F F F F F  ;??1%%!!(++3   03l/B/B4,s+++K \\(H - - "& " " y!!!! " " " " " " " " " " " " " " " " < 9 &--h77 8 8 8 8 81 ! . 9 9sI6AFF FII I /MMMRR R__main__r4)nversion __author__ __credits__builtinsrrLryrrrhrrr`rrewarningsrrrAttributeErrorNotImplementedErrorr r NameError__all__r6rr{rrrrrrrr/r-rrrr5CONTTYPErrrrrrrrrrrr'rrrrrNr rr getfilesystemencodingr<rCrSr[rerir|rrr rr r r rrrrPrrrobjectrr BufferedReaderr-r9r;r@rIrLrOrRrrkrmrrrtrrcompilerrrrrWrrr=r;rhs7:6 H '&&&&& JJJJ CCCJJJJ CCC$%89 '#   D  % % %   ^                    HgGXWg#%5! #(>+ /   . 988       7d??HH(s(**H 000&&&   (N    < * * *"&$    2     y        8                x        (        (        {        ;        [                K   0ppppppppf6