+
    Bi                       ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHtHt ^ RI	H
t
 ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt  ^ RIt ^ RIt ^ RIt ^ RIt ^ R
IH t  R t!]PD                  PG                  ]PH                  4      R,           t%]%R,           t&]PN                  ! RRR7      t(]PD                  PS                  ]%R4      t*]PD                  PS                  ]%R4      t+]PD                  PS                  ]%R4      t,]PD                  PS                  ]%R4      t-]PD                  PS                  ]%R4      t.]PD                  PS                  ]%R4      t/Rt0Rt1Rt2 ! R R4      t3]Ph                  ! 4        ! R R4      4       t5]Pl                  ! 4        ! R R4      4       t7]Pp                  ! 4        ! R  R!4      4       t9]Pt                  ! 4        ! R" R#4      4       t; ! R$ R%]34      t< ! R& R']<4      t= ! R( R)]<]P|                  4      t? ! R* R+]5]?4      t@ ! R, R-]7]?4      tA ! R. R/]9]?4      tB ! R0 R1];]?4      tC ! R2 R3]<]P|                  4      tD ! R4 R5]5]D4      tE ! R6 R7]7]D4      tF ! R8 R9]9]D4      tG ! R: R;];]D4      tH ! R< R=]<4      tI ! R> R?]I4      tJ ! R@ RA]J]P|                  4      tK ! RB RC]5]J]P|                  4      tL ! RD RE]7]J]P|                  4      tM ! RF RG]9]J]P|                  4      tN ! RH RI];]J]P|                  4      tO ! RJ RK]I]P|                  4      tP ! RL RM]5]P4      tQ ! RN RO]7]P4      tR ! RP RQ]9]P4      tS ! RR RS];]P4      tT ! RT RU]=]P|                  4      tU ! RV RW]5]U4      tV ! RX RY]7]U4      tW ! RZ R[]9]U4      tX ! R\ R]];]U4      tY ! R^ R_]3]P|                  4      tZ ! R` Ra]5]Z4      t[ ! Rb Rc]7]Z4      t\ ! Rd Re]9]Z4      t] ! Rf Rg];]Z4      t^ ! Rh Ri]5]P|                  4      t_ ! Rj Rk]<]P|                  4      t` ! Rl Rm4      ta ! Rn Ro]a]<]P|                  4      tb ! Rp Rq]a]<]P|                  4      tc ! Rr Rs]34      td ! Rt Ru]d]P|                  4      te ! Rv Rw]5]e4      tf ! Rx Ry]7]e4      tg ! Rz R{]9]e4      th ! R| R}];]e4      ti ! R~ R]d]P|                  4      tj ! R R]5]j4      tk ! R R]7]j4      tl ! R R]9]j4      tm ! R R];]j4      tn ! R R]34      to ! R R]7]o]P|                  4      tp ! R R]7]o]P|                  4      tq ! R R]5]o]P|                  4      tr ! R R]5]o]P|                  4      ts ! R R]P|                  4      tt ! R R]P|                  4      tu ! R R]d]P|                  4      tv ! R R]d]P|                  4      tw ! R R]5]w4      tx ! R R]7]w4      ty ! R R]9]w4      tz ! R R];]w4      t{ ! R R]w4      t|]P                  ! ]~! ]R4      R4       ! R R]P|                  4      4       t ! R R]u4      t ! R R4      t ! R R]]P|                  4      t ! R R]]P|                  4      t ! R R]]P|                  4      t ! R R4      t ! R R]]P|                  4      t ! R R]5]]P|                  4      t ! R R]7]]P|                  4      t ! R R]9]]P|                  4      t ! R R];]]P|                  4      t ! R R]P|                  4      t ! R R]P|                  4      t ! R R]P|                  4      t ! R R]P|                  4      t]EP                  ! ]~! ]R4      R4       ! R R]<]P|                  4      4       t ! R R]7]P|                  4      tR t]P                  ! ]~! ]R4      R4      ]P                  ! ]~! ]R4      R4       ! R R]P|                  4      4       4       t ! R R]<]P|                  4      t ! R R]<4      t ! R R]]P|                  4      t ! R R]]P|                  4      t ! R R]]P|                  4      t ! R R]]P|                  4      t ! R R]P|                  4      tR t ! R R4      t]EP:                  '       d   R tMR t ! R R]P|                  4      t ! R R]EP@                  ]P|                  4      t ! R R]P|                  4      tR tR t]R8X  d   ]EPJ                  ! 4        R# R#   ] d    Rt ELi ; i  ] d    Rt ELi ; i  ] d    Rt ELi ; i  ] d    Rt ELi ; i  ] d    Rt  ELi ; i)    N)sha256)contextmanager	ExitStack)Random)archiver_tests)support)	os_helper)script_helper)warnings_helper)zstdc                 4    \        V 4      P                  4       # N)r   	hexdigest)datas   &(/usr/lib/python3.14/test/test_tarfile.py	sha256sumr   .   s    $<!!##    z-tardirz-extract-testztesttar.tararchivetestdatasubdirztesttar.tar.gzztesttar.tar.bz2testtar.tar.xzztesttar.tar.zstztmp.tartesttar    @e09e4bc8b3c9d9177e77256353b36c159f5f040531bbd4b024a8f9b9196c71ce@4f05a776071146756345ceee937b33fc5644f5a96b9780d1c7d6a32cdf164d7bc                   |   a  ] tR t^Dt o ]tRt]P                  t]	P                  P                  t]R 4       tRtV tR# )TarTest c                <    V P                   V P                  ,           # r   )prefixsuffixselfs   &r   modeTarTest.modeJ   s    {{T[[((r    N)__name__
__module____qualname____firstlineno__tarnamer!   ioFileIOopentarfileTarFiletaropenpropertyr$   __static_attributes____classdictcell____classdict__s   @r   r   r   D   s9     GF99Doo%%G) )r   r   c                   v    ] tR t^Nt]tRt]'       d   ]P                  MRt	]
P                  P                  tRtR# )GzipTestgzNr&   )r'   r(   r)   r*   gzipnamer+   r!   gzipGzipFiler.   r/   r0   gzopenr1   r3   r&   r   r   r8   r8   N   s(    GF 4==dDoo$$Gr   r8   c                   v    ] tR t^Ut]tRt]'       d   ]P                  MRt	]
P                  P                  tRtR# )Bz2Testbz2Nr&   )r'   r(   r)   r*   bz2namer+   r!   r@   BZ2Filer.   r/   r0   bz2openr1   r3   r&   r   r   r?   r?   U   s(    GF3;;4Doo%%Gr   r?   c                   v    ] tR t^\t]tRt]'       d   ]P                  MRt	]
P                  P                  tRtR# )LzmaTestxzNr&   )r'   r(   r)   r*   xznamer+   r!   lzmaLZMAFiler.   r/   r0   xzopenr1   r3   r&   r   r   rE   rE   \   s(    GF 4==dDoo$$Gr   rE   c                   v    ] tR t^ct]tRt]'       d   ]P                  MRt	]
P                  P                  tRtR# )ZstdTestzstNr&   )r'   r(   r)   r*   zstnamer+   r!   r   ZstdFiler.   r/   r0   zstopenr1   r3   r&   r   r   rL   rL   c   s(    GF 4==dDoo%%Gr   rL   c                   0   a  ] tR t^jt o RtR tR tRtV tR# )ReadTestr:c                j    \         P                  ! V P                  V P                  R R7      V n        R# )	iso8859-1r$   encodingNr/   r.   r+   r$   tarr"   s   &r   setUpReadTest.setUpn   s!    <<499)46r   c                :    V P                   P                  4        R # r   )rY   closer"   s   &r   tearDownReadTest.tearDownr   s    r   rY   N)	r'   r(   r)   r*   r    rZ   r^   r3   r4   r5   s   @r   rR   rR   j   s     F6 r   rR   c                   &   a  ] tR t^ut o R tRtV tR# )StreamModeTestc                l    \         P                  ! V P                  V P                  R RR7      V n        R# )rU   T)r$   rW   streamNrX   r"   s   &r   rZ   StreamModeTest.setUpy   s$    <<499)4'+-r   r`   N)r'   r(   r)   r*   rZ   r3   r4   r5   s   @r   rb   rb   u   s     - -r   rb   c                      a  ] tR t^~t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR t]P"                  ! ]! ]R4      ;'       d
    ]! ]R4      R4      R 4       tRtV tR# )UstarReadTestc                h   V P                   P                  R 4      pV P                   P                  V4      ;_uu_ 4       pVP                  4       pV P	                  \        V4      VP                  R4       V P	                  \        V4      \        R4       RRR4       R#   + '       g   i     R# ; i)ustar/regtyperegular file extraction failedN)	rY   	getmemberextractfilereadassertEquallensizer   sha256_regtyper#   tarinfofobjr   s   &   r   test_fileobj_regular_file'UstarReadTest.test_fileobj_regular_file   s}    (($$_5XX!!'**d99;DSY46Yt_n46	 +***s   AB  B1	c                   V P                   P                  R \        RR7       V P                   P                  R 4      p\	        \
        P                  P                  \        R 4      R4      ;_uu_ 4       pVP                  4       pRRR4       V P                   P                  V4      ;_uu_ 4       p\        P                  ! V4      pVP                  4       pV P                  XVR4       V P                  \        V4      ^rR4       V P                  V^S,          RR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)ri   r   filterrNzfileobj.readlines() failedzOI will gladly admit that Python is not the fastest running scripting language.
)rY   extractTEMPDIRrk   r.   ospathjoin	readlinesrl   r,   TextIOWrapperrn   ro   )r#   rs   fobj1lines1rt   fobj2lines2s   &      r   test_fileobj_readlines$UstarReadTest.test_fileobj_readlines   s    '&A(($$_5"'',,w8#>>%__&F ? XX!!'**d$$T*E__&FVV02S[#02VBZ402 +* ?> +**s   4D*0A0D=*D:	=E	c                (   V P                   P                  R \        RR7       V P                   P                  R 4      p\	        \
        P                  P                  \        R 4      R4      ;_uu_ 4       pVP                  4       pRRR4       V P                   P                  V4      ;_uu_ 4       p\        \        P                  ! V4      4      pV P                  XVR4       RRR4       R#   + '       g   i     Lp; i  + '       g   i     R# ; i)ri   r   rx   rz   Nzfileobj.__iter__() failed)rY   r{   r|   rk   r.   r}   r~   r   r   rl   listr,   r   rn   )r#   rs   r   r   r   r   s   &     r   test_fileobj_iterUstarReadTest.test_fileobj_iter   s    '&A(($$_5"'',,w8#>>%__&F ?XX!!'**e"**512FVV/1 +* ?>***s   4C-03D -C=	 D	c           	        V P                   P                  R \        RR7       \        \        P
                  P                  \        R 4      R4      ;_uu_ 4       pVP                  4       pRRR4       V P                   P                  R 4      pV P                   P                  V4      ;_uu_ 4       pVP                  4       pVP                  ^ 4       V P                  ^ VP                  4       R4       VP                  R^ 4       V P                  RVP                  4       R4       VP                  R^4       V P                  RVP                  4       R	4       VP                  R^4       V P                  RVP                  4       R
4       VP                  ^
4      pV P                  VXR,          R4       VP                  ^ ^4       V P                  VP                  VP                  4       R4       V P                  VP                  4       RR4       VP                  VP                  ) ^4       V P                  ^ VP                  4       R4       VP                  R4       VP                  4       pVP                  R4       VP                  4       pV P                  WgR4       VP                  ^ 4       V P                  \        VP!                  4       4      VP                  4       R4       VP                  R4       V P                  \        VP!                  4       4      R,           VP                  4       R4       VP                  ^ 4       VP!                  4       pV P                  VP                  4       V\        V4      R R4       RRR4       R#   + '       g   i     EL7; i  + '       g   i     R# ; i)ri   r   rx   rbNzseek() to file's start failedi   z"seek() to absolute position failed   z+seek() to negative relative position failedz+seek() to positive relative position failed:i   i
  Nzread() after seek failedzseek() to file's end failedr   z0read() at file's end did not return empty stringz$relative seek() to file's end failed   zreadlines() after seek failedztell() after readline() failedz)tell() after seek() and readline() failedzread() after readline() failedi )rY   r{   r|   r.   r}   r~   r   rm   rk   rl   seekrn   tellrp   r   ro   readline)	r#   rt   r   rs   textss1s2lines	   &        r   test_fileobj_seekUstarReadTest.test_fileobj_seek   s   ' & 	 	("'',,w8$??499;D @ (($$_5XX!!'**d99;DIIaLQ		8:IIdAT499;=?IIeQT499;FHIIdAT499;FH		"AQY35IIaOW\\499;68TYY[#KMIIw||mQ'Q		?AIIcN!BIIcN!BR8:IIaLS1499;9;IIcNS1C7DFIIaL==?DTYY[$s4yz*:9;O +*	 @?? +**s   N0KN,N)	,N=	c                   V P                   P                  R 4      ;_uu_ 4       p\        P                  ! V4      pVP	                  4       P                  R4      pV P                  \        V4      \        4        VP                  ^d4       RRR4       R#   \         d    T P                  R4        L(i ; i  + '       g   i     R# ; i)ri   rU   zseeking failed in text modeN)rY   rl   r,   r   rm   encodern   r   rq   r   AttributeErrorfailr#   rt   r   s   &  r   test_fileobj_textUstarReadTest.test_fileobj_text   s    XX!!/22d##D)D99;%%k2DYt_n=9		# 32 " 9 		789 322s*   AB7:BB41B73B44B77C	c           	     P   V P                   P                  V4      ;_uu_ 4       pV P                   P                  V4      ;_uu_ 4       pV P                  VP                  VP                  4       R R R 4       R R R 4       R #   + '       g   i     L; i  + '       g   i     R # ; ir   )rY   rl   rn   name)r#   lnktyperegtypeabs   &&&  r   _test_fileobj_link UstarReadTest._test_fileobj_link   sh    XX!!'**aXX!!'**aQVVQVV, + +*** +**s#   $B'B	/BBBB%	c                *    V P                  R R4       R# )ustar/lnktyperi   Nr   r"   s   &r   test_fileobj_link1 UstarReadTest.test_fileobj_link1       Ar   c                *    V P                  R R4       R# )./ustar/linktest2/lnktypeustar/linktest1/regtypeNr   r"   s   &r   test_fileobj_link2 UstarReadTest.test_fileobj_link2        ; 9	;r   c                *    V P                  R R4       R# )ustar/symtyperi   Nr   r"   s   &r   test_fileobj_symlink1#UstarReadTest.test_fileobj_symlink1   r   r   c                *    V P                  R R4       R# )./ustar/linktest2/symtyper   Nr   r"   s   &r   test_fileobj_symlink2#UstarReadTest.test_fileobj_symlink2   r   r   c                *    V P                  R R4       R# )symtype2ri   Nr   r"   s   &r   test_issue14160UstarReadTest.test_issue14160   s    
O<r   c                J    V P                  R 4       V P                  R4       R# )barNeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)add_dir_and_getmemberr"   s   &r   test_add_dir_getmember$UstarReadTest.test_add_dir_getmember   s    ""5)""7+r   getuidgetgidz'Missing getuid or getgid implementationc                   R  p\         P                  ! 4       ;_uu_ 4        \        P                  ! \        R4      ;_uu_ 4       p\        P
                  Vn         \        P                  ! V4       VP                  WR7       \        P                  ! V4        RRR4       \        P                  ! \        4      ;_uu_ 4       pV P                  VP                  V4      VP                  VR,           4      4       RRR4       RRR4       R#   \        P                  ! T4       i ; i  + '       g   i     L; i  + '       g   i     LH; i  + '       g   i     R# ; i)c                 "    ^d;V n         V n        V # )d   )uidgidrs   s   &r   ry   3UstarReadTest.add_dir_and_getmember.<locals>.filter  s    (++GK'+Nr   wrx   N/)r	   temp_cwdr/   r.   tmpnameUSTAR_FORMATformatr}   mkdiraddrmdirrn   rk   )r#   r   ry   rY   s   &&  r   r   #UstarReadTest.add_dir_and_getmember   s    	 !!gs++s$11
#HHTNGGDG0HHTN , g&&#  MM$'MM$*- ' "! HHTN ,+ '& "!!sS   $ED*	(DD*	*E8D=	=ED''D*	*D:5E=EEE!	r&   N)r'   r(   r)   r*   ru   r   r   r   r   r   r   r   r   r   r   r   unittest
skipUnlesshasattrr}   r   r3   r4   r5   s   @r   rg   rg   ~   s     62$1/;b
9-
B;B;=,
 X.HH72x3HBDDr   rg   c                       ] tR tRtRtR# )GzipUstarReadTesti  r&   Nr'   r(   r)   r*   r3   r&   r   r   r   r         r   r   c                       ] tR tRtRtR# )Bz2UstarReadTesti  r&   Nr   r&   r   r   r   r     r   r   r   c                       ] tR tRtRtR# )LzmaUstarReadTesti  r&   Nr   r&   r   r   r   r     r   r   r   c                       ] tR tRtRtR# )ZstdUstarReadTesti  r&   Nr   r&   r   r   r   r     r   r   r   c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )ListTesti!  c                h    \         P                  ! V P                  V P                  R 7      V n        R# )r$   NrX   r"   s   &r   rZ   ListTest.setUp$  s    <<499=r   c                  a  \         P                  ! \         P                  ! 4       R RR7      p\        P                  ! \
        RV4      ;_uu_ 4        S P                  P                  RR7       RRR4       VP                  4       P                  4       pS P                  RV4       S P                  RV4       S P                  R	V4       S P                  RV4       S P                  R
V4       S P                  RV4       S P                  RV4       S P                  RV4       V 3R lpS P                  V! R4      V4       S P                  V! R4      V4       S P                  V! R4      V4       S P                  V! R4      V4       S P                  V! R4      V4       S P                  VR4       S P                  RV4       S P                  RV4       R#   + '       g   i     ELu; i)ascii
newlinestdoutFverboseN   ustar/conttype   ustar/regtypes   ustar/lnktypes   ./ustar/linktest2/symtypes   ./ustar/linktest2/lnktypes   ustar/dirtype/s   ustar/dirtype-with-size/c                 t   < V P                  SP                  P                  R 4      pVP                  RR4      # )surrogateescaper   backslashreplace)decoderY   rW   r   )r   r   r#   s   & r   conv ListTest.test_list.<locals>.conv6  s0    **,=>A88G%788r   s   ustar/umlauts-s'   misc/regtype-hpux-signed-chksum-s)   misc/regtype-old-v7-signed-chksum-s   pax/bad-pax-s   pax/hdrcharset-s)   ustar/conttype ?\r?\nustar/regtype ?\r?\ns   link tos   ->s   ustar/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/1234567/longname)r,   r   BytesIOr   	swap_attrsysrY   r   detachgetvalueassertInassertRegexassertNotIn)r#   tiooutr   s   f   r   	test_listListTest.test_list'  s   rzz|WdCsHc22HHMM%M( 3jjl##%'-&,&,BCH2C82C8'-137	9 	dHI3Od ; <=@	Bd ; <=@	Bd67=d9:C@ 	 7 	8 	S)$C 322s   GG,	c                   \         P                  ! \         P                  ! 4       R RR7      p\        P                  ! \
        RV4      ;_uu_ 4        V P                  P                  RR7       RRR4       VP                  4       P                  4       pRpT P                  TRP                  V UUUu. uF  w  rEpVRWV3,          R	,           ,           NK   	  uppp4      4       V P                  R
V4       V P                  RV4       V P                  RV4       V P                  RV4       V P                  RV4       R#   + '       g   i     L; iu upppi )r   r   r   r   Tr   Nr   s   %s tarfile/tarfile\s+%s s;   \d{4}-\d\d-\d\d\s+\d\d:\d\d:\d\d ustar/\w+type[/>\sa-z-]*\ns   ustar/symtype -> regtypes1   ./ustar/linktest2/symtype -> ../linktest1/regtypes;   ./ustar/linktest2/lnktype link to ./ustar/linktest1/regtype)	)   \?	   rw-r--r--   7011)   -r
  r  )   d	   rwxr-xr-x   0)r  r  s   255)r	  r
  r  )   ls	   rwxrwxrwxr  )   bs	   rw-rw----s   3,0)   cs	   rw-rw-rw-s   1,3)   pr
  r  s	  gnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longlink link to gnu/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longnames	  pax/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longlink link to pax/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longname)r,   r   r   r   r   r   rY   r   r   r   r  r   r  )r#   r  r  type_perm_lengthstppermlns   &      r   test_list_verboseListTest.test_list_verboseL  s1   rzz|WdCsHc22HHMM$M' 3jjl##%( 	chh "# " :F2 0D:=33 4 4 "#$ 	% 	137JCP 347	9 569	; 569	;? 32(#s   E 3$E E	c                   \         P                  ! \         P                  ! 4       R RR7      pR p\        P                  ! \
        RV4      ;_uu_ 4        V P                  P                  RV! V P                  4      R7       RRR4       VP                  4       P                  4       pV P                  RV4       V P                  R	V4       R#   + '       g   i     LT; i)
r   r   r   c              3   j   "   V P                  4        F  pR VP                  9   g   K  Vx  K  	  R# 5i)regN)
getmembersr   )rY   rs   s   & r   members+ListTest.test_list_members.<locals>.membersr  s'     >>+GLL(!M ,s   "3
3r   F)r   r  Nr   r   )r,   r   r   r   r   r   rY   r   r   r   r  r  )r#   r  r  r  s   &   r   test_list_membersListTest.test_list_membersp  s    rzz|WdC	" sHc22HHMM%1BMC 3jjl##%&,*C0	 32s   .CC	r`   N)
r'   r(   r)   r*   rZ   r  r  r   r3   r4   r5   s   @r   r   r   !  s      >#%J";H
1 
1r   r   c                       ] tR tRtRtR# )GzipListTesti}  r&   Nr   r&   r   r   r#  r#  }  r   r   r#  c                       ] tR tRtRtR# )Bz2ListTesti  r&   Nr   r&   r   r   r%  r%    r   r   r%  c                       ] tR tRtRtR# )LzmaListTesti  r&   Nr   r&   r   r   r'  r'    r   r   r'  c                       ] tR tRtRtR# )ZstdListTesti  r&   Nr   r&   r   r   r)  r)    r   r   r)  c                   \   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tRtV tR# )CommonReadTesti  c                `   \        \        R 4      ;_uu_ 4         RRR4       V P                  \        P                  ! \        4      4       V P                  \        P                  ! \
        P                  ! \        4      4      4       \        \        R4      ;_uu_ 4       pV P                  \        P                  ! V4      4       RRR4       V P                  \        P                  ! \        P                  ! R4      4      4       R#   + '       g   i     L; i  + '       g   i     L^; i)wbNr   s   invalid)	r.   r   assertFalser/   
is_tarfiler	   FakePathr,   r   r#   rt   s   & r   test_is_tarfile_erroneous(CommonReadTest.test_is_tarfile_erroneous  s    '4   ! 	++G45 	++I,>,>w,GHI '4  DW//56 ! 	++BJJz,BCD !  ! s   D
!&D
D	D-	c           
        V P                  \        P                  ! V P                  4      4       V P                  \        P                  ! \        P
                  ! V P                  4      4      4       \        V P                  R 4      ;_uu_ 4       pV P                  \        P                  ! V4      4       RRR4       \        V P                  R 4      ;_uu_ 4       pV P                  \        P                  ! \        P                  ! VP                  4       4      4      4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir   N)

assertTruer/   r/  r+   r	   r0  r.   r,   r   rm   r1  s   & r   test_is_tarfile_valid$CommonReadTest.test_is_tarfile_valid  s    **4<<89 	**9+=+=dll+KLM $,,%%OOG..t45 & $,,%%OOG..rzz$))+/FGH &%	 &% &%%s   &D/AE/D?	E	c                   \        V P                  R 4      ;_uu_ 4       p\        P                  ! V4       V P	                  VP                  4       ^ 4       RRR4       \        V P                  R 4      ;_uu_ 4       p\        P                  ! VP                  4       4      p\        P                  ! V4       V P	                  VP                  4       ^ 4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir5  )	r.   r+   r/   r/  rn   r   r,   r   rm   )r#   rt   	file_likes   &  r   test_is_tarfile_keeps_position-CommonReadTest.test_is_tarfile_keeps_position  s     $,,%%t$TYY[!, & $,,%%

499;/Iy)Y^^-q1 &%	 &% &%%s   7C!<AC4!C1	4D	c                   \         P                  ! \        V P                  P	                  R R4      4      ;_uu_ 4         RRR4        \         P                  ! \        V P                  4      pVP                  4        V P                  VP                  4       . 4       XP                  4        R#   + '       g   i     Lx; i  \         P                   d    T P                  R4        LMi ; i  XP                  4        i ; i)rz   r   Nz&tarfile.open() failed on empty archive)r/   r.   r   r$   replacegetnamesassertListEqualr  	ReadErrorr   r]   r#   rY   s   & r   test_empty_tarfile!CommonReadTest.test_empty_tarfile  s    
 \\'499#4#4S##>?? @	,,w		2CLLN   !126IIK @?
    	@II>?	@
 IIKs5   B0	5C > C/ 0C 	&C,)C/ +C,,C/ /Dc                    V P                  \        R 4      ;_uu_ 4        \        P                  ! R V P                  4       RRR4       R#   + '       g   i     R# ; i)xxxN)assertRaisesRegexFileNotFoundErrorr/   r.   r$   r"   s   &r   test_non_existent_tarfile(CommonReadTest.test_non_existent_tarfile  s9     ##$5u==LL		* >===s   "AA	c                R   \        \        R 4      ;_uu_ 4         RRR4       V P                  \        P                  \        P                   \        V P
                  4       V P                  \        P                  \        P                   \        4       R#   + '       g   i     L; ir-  N)r.   r   assertRaisesr/   rA  r$   r"   s   &r   test_null_tarfile CommonReadTest.test_null_tarfile  s`     '4   !'++W\\7DIIN'++W\\7C ! s   BB&	c                t   \        ^ 4      P                  R4      pR
 F  pV P                  \        R4      ;_uu_ 4       pVP	                  VR,          4       \
        P                  ! R4      p\        V4      Vn        VP	                  VP                  4       4       VP	                  V4       RRR4       \
        P                  ! \        RRR7      p V P                  VP                  4       R.R	V,          4       VP                  4        K  	  R#   + '       g   i     Lm; i  TP                  4        i ; i)r   r   r   r   fooNrz   T)r$   ignore_zerosz3ignore_zeros=True should have skipped the %r-blocks)       a)r   	randbytesr.   r   writer/   TarInforo   rp   tobufr@  r?  r]   )r#   r   charrt   rs   rY   s   &     r   test_ignore_zeros CommonReadTest.test_ignore_zeros  s     ay""3'!D 7C((D

4$;'!//%0"4y

7==?+

4  ) ,,wStDC$$S\\^eWI 		! " )( 		s   A/D)D%D"%D7c                   R	 EF  p\         P                  ! \        R4      ;_uu_ 4       p\         P                  ! R4      pRVn        VP                  V\        P                  ! R
4      4       RRR4       \        \        R4      ;_uu_ 4       pVP                  V4       RRR4       \         P                  ! \        4      ;_uu_ 4       pV P                  \         P                  R4      ;_uu_ 4        V F  pK  	  RRR4       RRR4       \         P                  ! \        4      ;_uu_ 4       pVP                  4       pV P                  \         P                  R4      ;_uu_ 4        VP                  V\        RR7       RRR4       V P                  \         P                  R4      ;_uu_ 4        VP                  V4      P                  4        RRR4       RRR4       EK  	  R#   + '       g   i     EL; i  + '       g   i     ELe; i  + '       g   i     EL; i  + '       g   i     EL(; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     EKm  ; i)r   r   w:rQ  Nzr+bzunexpected end of datar   rx   )r   iX  r   i  s   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)r/   r.   r   rW  rp   addfiler,   r   truncaterG  rA  nextr{   r|   rl   rm   )r#   rp   rY   trt   s   &    r   test_premature_end_of_archive,CommonReadTest.test_premature_end_of_archive  s   *Dgt,,OOE*Arzz+67 -
 gu%%d# & g&&#++G,=,=?WXX  ! Y '
 g&&#HHJ++G,=,=?WXXKK76K: Y ++G,=,=?WXXOOA&++- Y '& +,,,
 &%% YXX '&& YX YX '&&sx   AG(G<
)H$3
H=H$/9I(H80I1 II(G9<HH!	H$$H58IIIII0c           	     2   V P                  \        P                  R 4      ;_uu_ 4        \        P                  ! \        P
                  ! RRR7      4      ;_uu_ 4         RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)%file could not be opened successfullyzrecursion.tarr   r   N)rG  r/   rA  r.   r   findfiler"   s   &r   test_length_zero_header&CommonReadTest.test_length_zero_header  sa     ##G$5$57^__g..GXYZZ [ `_ZZ `__s#   5BA2	 B2B=BB	c                   V P                   P                  R 4      pV P                   P                  V4      ;_uu_ 4       pV P                  VP                  R 4       V P                  \        VP                  4       V P                  VP                  R4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  '       d"   V P                  \        VP                  4       M V P                  VP                  4       R4       V P                  VP                  R4       RRR4       V P                  XP                  R4       V P                  VP                  R 4       V P                  \        VP                  4       V P                  VP                  R4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  '       d#   V P                  \        VP                  4       R# V P                  VP                  4       R4       R#   + '       g   i     EL; i)ri   r   TFN)rY   rk   rl   rn   r   rM  r   filenor$   assertIsreadablewritable	is_streamseekableclosed)r#   filert   s   &  r   test_extractfile_attrs%CommonReadTest.test_extractfile_attrs  s   xx!!/2XX!!$''4TYY8ndkk:TYY-MM$--/40MM$--/51~~~!!.$--@dmmot4MM$++u- ( 	dkk4(O4.$++6D)dmmot,dmmou->>>ndmm<MM$--/40) (''s   DII*	r&   N)r'   r(   r)   r*   r2  r7  r;  rC  rI  rN  rZ  rb  rg  rr  r3   r4   r5   s   @r   r+  r+    s?     E"I
2"+D,.01 1r   r+  c                     a  ] tR tRt o RtR tR tR tR tR t	R R	 lt
R
 tR tR tR tR tR tR tR t]P(                  ! ]! ]R4      R4      ]P0                  R 4       4       t]P4                  R 4       t]R 4       t]P4                  R 4       tR tR t R t!R t"]PF                  ! ]$RJ R4      R 4       t%R t&Rt'V t(R# )!MiscReadTestBasei(  Fc           
        \        V P                  R 4      ;_uu_ 4       pV P                  VP                  \        4       \
        P                   ! WP                  R7      ;_uu_ 4       pV P                  VP                  \        4       V P                  VP                  \        P                  P                  VP                  4      4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; ir   fileobjr$   N)r.   r+   assertIsInstancer   strr/   r$   rn   r}   r~   abspathr#   rt   rY   s   &  r   test_no_name_argument&MiscReadTestBase.test_no_name_argument+  s    $,,%%!!$))S1d;;s%%chh4  277??499+EF < &%;; &%%s%   A
C2)A$C	C2C/*C22D	c                v   \        V P                  R 4      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! X4      pV P                  \        \        VR4       \        P                   ! WP                  R7      pV P                  VP                  4       R#   + '       g   i     L; i)r   Nr   rx  )r.   r+   rm   r,   r   rM  r   getattrr/   r$   assertIsNoner   r#   rt   r   rY   s   &   r   test_no_name_attribute'MiscReadTestBase.test_no_name_attribute2  st    $,,%%99;D &zz$.'4@ll4ii8#((# &%s   B((B8	c                   \        V P                  R 4      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! X4      pRVn        \        P                   ! WP                  R7      ;_uu_ 4       pV P                  VP
                  4       RRR4       R#   + '       g   i     L|; i  + '       g   i     R# ; i)r   Nr   rx  )	r.   r+   rm   r,   r   r   r/   r$   r  r  s   &   r   test_empty_name_attribute*MiscReadTestBase.test_empty_name_attribute:  s~    $,,%%99;D &zz$	\\$YY773chh' 87	 &% 877s   B$>B7$B4	7C	c           	        \         P                  ! V P                  \         P                  4      p\        VR 4      ;_uu_ 4       pV P	                  VP
                  \        4       \        P                  ! W P                  R7      ;_uu_ 4       pV P                  VP
                  4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; irw  )
r}   r.   r+   O_RDONLYrz  r   intr/   r$   r  )r#   fdrt   rY   s   &   r   test_int_name_attribute(MiscReadTestBase.test_int_name_attributeB  s     WWT\\2;;/"d^^t!!$))S1d;;s!!#((+ < ^;; ^^s%   A
CB<	*C<CCC 	c           
     8   \         P                  ! V P                  4      p\        VR 4      ;_uu_ 4       pV P	                  VP
                  \        4       \        P                  ! W P                  R7      ;_uu_ 4       pV P	                  VP
                  \        4       V P                  VP
                  \         P                  P                  VP
                  4      4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; irw  )r}   fsencoder+   r.   rz  r   bytesr/   r$   rn   r~   r|  )r#   r+   rt   rY   s   &   r   test_bytes_name_attribute*MiscReadTestBase.test_bytes_name_attributeK  s    ++dll+'4  D!!$))U3d;;s%%chh6  277??499+EF < ! ;; !  s%   A
D?A$C5	#D5D DD	Nc                   Vf   V P                   p\        P                  P                  V4      p\        P
                  ! V4      p\        P                  ! WP                  R7      ;_uu_ 4       pV P                  VP                  V4       R R R 4       V P                  V4      ;_uu_ 4       pV P                  VP                  V4       R R R 4       \        P                  P                  WP                  R7      ;_uu_ 4       pV P                  VP                  V4       R R R 4       V P                  R8X  dH   \        P                  ! VRR7      ;_uu_ 4       pV P                  VP                  V4       R R R 4       R # R #   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R # ; i)Nr   r   rz   )r+   r}   r~   r|  r	   r0  r/   r.   r$   rn   r   r1   r0   r!   )r#   r+   expectedrY   s   &&  r   test_pathlike_name#MiscReadTestBase.test_pathlike_nameS  s$   ?llG77??7+$$W-\\'		22cSXXx0 3\\'""cSXXx0 #__!!'		!::cSXXx0 ;;;"s33s  84 43  32"":: 433s0   /F-FF)F<F	F&	)F9	<G	c                d    V P                  \        P                  ! V P                  4      4       R # r   )r  r}   r  r+   r"   s   &r   test_pathlike_bytes_name)MiscReadTestBase.test_pathlike_bytes_nameb  s    DLL 9:r   c                R   \        \        R 4      ;_uu_ 4         RRR4       V P                  \        R4      ;_uu_ 4        V P	                  \        R4      pRRR4       V P                  \        R4      ;_uu_ 4        V P	                  \        R4      pRRR4       V P                  \        R4      ;_uu_ 4        V P	                  \        R4      pRRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lu; i  + '       g   i     R# ; i)r-  Nzmode must be qrwr   )r.   r   rG  
ValueErrorr1   rB  s   & r   test_illegal_mode_arg&MiscReadTestBase.test_illegal_mode_arge  s    '4   !##J@@,,w,C A##J@@,,w-C A##J@@,,w+C A@ ! @@@@@@@s/   CC/>D;DC,	/C?	D	D&	c           	        \         P                  ! V P                  V P                  R 7      p VP	                  4        VP	                  4       pVP
                  pVP                  pVP                  V4      ;_uu_ 4       pVP                  4       pRRR4       VP                  4        V P                  V P                  4      ;_uu_ 4       pVP                  V4       VP                  V P                  RVR7      ;_uu_ 4       pVP	                  4       pV P                  VP
                  V4       VP                  4        V P                  VP                  V4      P                  4       XR4       RRR4       RRR4       R#   + '       g   i     L; i  TP                  4        i ; i  + '       g   i     LB; i  + '       g   i     R# ; i)r   NrS   )r$   ry  zseek back did not work)r/   r.   r+   r$   r`  r   offsetrl   rm   r]   r   rn   r  )r#   rY   ra  r   r  fr   rt   s   &       r   test_fileobj_with_offset)MiscReadTestBase.test_fileobj_with_offseto  s>    ll4<<dii8	HHJ
A66DXXF##qvvx $ IIK YYt||$$IIf $,,T4@@CHHJ  .    !3!8!8!:D02 A	 %$ $# IIK A@	 %$$sI   AF ?FF 8F=A-F*	0F=F	F F'*F:5F==G	c           	     `   V P                  \        P                  \        P                  \        V P
                  4       \        \        R 4      ;_uu_ 4       pV P                  \        P                  \        P                  WP
                  R7       RRR4       R#   + '       g   i     R# ; irw  )rM  r/   rA  r.   r+   r$   r1  s   & r   test_fail_compMiscReadTestBase.test_fail_comp  sj    '++W\\7DIIN'4  Dg//&*  < !   s   ;BB-	c                    V P                   P                  R 4      pV P                  VP                  \        P
                  R4       R# )zmisc/dirtype-old-v7zv7 dirtype failedN)rY   rk   rn   typer/   DIRTYPEr#   rs   s   & r   test_v7_dirtype MiscReadTestBase.test_v7_dirtype  s6     (($$%:;w#	%r   c                     V P                   P                  R 4       R#   \         d    T P                  R4        R# i ; i)zmisc/regtype-xstarz3failed to find misc/regtype-xstar (mangled prefix?)N)rY   rk   KeyErrorr   r"   s   &r   test_xstar_type MiscReadTestBase.test_xstar_type  s9    	MHH34 	MIIKL	Ms    ??c                <   V P                    F  pV P                  \        VP                  4      R RVP                  ,          4       VP                  P                  R4      '       g   K]  V P                  VP                  RRVP                  ,          4       K  	  R# )鏽>zwrong mtime for %sustar/r/   zwrong uname for %sN)rY   rn   r  mtimer   
startswithunamer  s   & r   test_check_members#MiscReadTestBase.test_check_members  sq    xxGS/(7<<79<<**844W]]I(7<<79  r   c                ~    V P                  V P                  P                  4       R,          P                  RR4       R# )   zmisc/eofzcould not find all membersN)rn   rY   r  r   r"   s   &r   test_find_members"MiscReadTestBase.test_find_members  s/    ,,.r277,	.r   linkMissing hardlink implementationc           	        \         P                  ! \        ^RR7      ;_uu_ 4       pVP                  R\        RR7       V P                  \        P                  \        P                  P                  \        R4      4       VP                  R\        RR7       V P                  \        P                  \        P                  P                  \        R4      4       \        \        P                  P                  \        R4      R4      ;_uu_ 4       pVP                  4       pRRR4       V P                  \        X4      \        4       VP                  R	\        RR7       V P                  \        P                  \        P                  P                  \        R	4      4       \        \        P                  P                  \        R	4      R4      ;_uu_ 4       pVP                  4       pRRR4       V P                  \        V4      \        4       RRR4       R#   + '       g   i     EL; i  + '       g   i     LM; i  + '       g   i     R# ; i)
r  rU   )
errorlevelrW   ri   r   rx   r   r   Nr   )r/   r.   r+   r{   r|   
addCleanupr	   unlinkr}   r~   r   rm   rn   r   rq   )r#   rY   r  r   s   &   r   test_extract_hardlink&MiscReadTestBase.test_extract_hardlink  sk   
 \\'a+FF#KKK@OOI,,bggll7O.TUKKK@OOI,,bggll7O.TUbggll7O<dCCqvvx DYt_n=KKK@OOI,,bggll7O.TUbggll7O<dCCqvvx DYt_n= GF DCC DC GFFs=   C+IH	"B7IH/	*'IH,&	I/H?:II	c                   \         P                  ! \        R R7      p\        P                  P                  \        R4      p\        P                  ! V4        V Uu. uF  q3P                  4       '       g   K  VNK  	  ppVP                  W$RR7       V F  p\        P                  P                  W%P                  4      p\        P                  R8w  dT   V P                  VP                  R,          \        P                  ! V4      P                   R,          VP                  4       R p\        P                  P#                  V4      pRP%                  V! VP&                  4      V! V4      V4      p	V P                  VP&                  W4       K  	  VP)                  4        \*        P,                  ! V4       R	# u upi   TP)                  4        \*        P,                  ! T4       i ; i)
rU   rW   
extractallfully_trustedrx   win32  c                     \        V \        4      '       d    R P                  W P                  4       4      # RP                  V 4      # )z{} ({})z
{!r} (int))
isinstancefloatr   hex)r  s   &r   format_mtime6MiscReadTestBase.test_extractall.<locals>.format_mtime  s7    !%//(//yy{CC+22599r   z,tar mtime {0} != file time {1} of path {2!a}N)r/   r.   r+   r}   r~   r   r|   r   isdirr  r   r   platformrn   r$   statst_modegetmtimer   r  r]   r	   rmtree)
r#   rY   DIRra  directoriesrs   r~   r  
file_mtimeerrmsgs
   &         r   test_extractall MiscReadTestBase.test_extractall  sW    ll7[9ggll7L1
	"&)7cWWY11cK7NN3OND&ww||C6<<7*$$W\\E%9%'WWT]%:%:U%B%,\\3:
  WW--d3
GNN / ,   
C# '& IIKS!- 8* IIKS!s%   G F<8F<>DG <G (G)c                    \         P                  ! \        4      R ,          p \        P                  ! V 4      ;_uu_ 4        \
        P                  ! \        RR7      ;_uu_ 4       p\        P                  P                  R\
        P                  R7      ;_uu_ 4       p\        P                  P                  R\
        P                  R7      ;_uu_ 4       p\        P                  P                  R\
        P                  R7      ;_uu_ 4       pV Uu. uF  qUP                  4       '       g   K  VNK  	  ppVP                  W4       VP!                  4        VP#                  4        VP#                  4        RRR4       RRR4       RRR4       RRR4       RRR4       R# u upi   + '       g   i     L7; i  + '       g   i     LB; i  + '       g   i     LM; i  + '       g   i     LX; i  + '       g   i     R# ; i)extractall_default_filterrU   r  ztarfile.data_filter)wrapsztarfile.tar_filterztarfile.fully_trusted_filterN)pathlibPathr|   r	   temp_dirr/   r.   r+   r   mockpatchdata_filter
tar_filterfully_trusted_filterr  r  assert_calledassert_not_called)r  rY   mock_data_filtermock_tar_filtermock_ft_filterra  r  s          r   test_extractall_default_filter/MiscReadTestBase.test_extractall_default_filter  sK    ll7#&AAs##LL;773MM 5W=P=PQQUeMM 4G<N<NOOSbMM >gFbFbccgu&)7cWWY11cK7NN3,**,,,.--/ d P R 8 $# 8 dc PO RQ 87 $##s    %G2%8G	8G8F9F&F!.F!4AF&7F9?GG	G2!F&&F61F99G	GGG	G/*G22H	c                   R p\         P                  P                  \        R4      p\         P                  ! V4        \
        P                  ! \        RR7      ;_uu_ 4       pVP                  V4      pVP                  WBRR7       \         P                  P                  W!4      pV P                  \         P                  P                  V4      VP                  4       \        P                  R8w  d8   V P                  \         P                  ! V4      P                   R,          R4       R	R	R	4       \"        P$                  ! V4       R	#   + '       g   i     L(; i  \"        P$                  ! T4       i ; i)
ustar/dirtype
extractdirrU   r  r  r~   ry   r  r  i  N)r}   r~   r   r|   r   r/   r.   r+   rk   r{   rn   r  r  r   r  r  r  r	   r  r#   dirtyper  rY   rs   	extracteds   &     r   test_extract_directory'MiscReadTestBase.test_extract_directory  s    !ggll7L1
		"g<<--0GoFGGLL6	  !1!1)!<gmmL<<7*$$RWWY%7%?%?%%GO = S! =< S!s$   $E "C	E+E E	E E6c           
        \         P                  P                  \        R 4      p\        P
                  ! V4      ;_uu_ 4        \        P                  ! \        RR7      ;_uu_ 4       pV Uu. uF  q3P                  4       '       g   K  VNK  	  ppVP                  \        P                  ! V4      VRR7       V Fe  p\         P                  P                  WP                  4      pV P                  \         P                  P                  V4      VP                  4       Kg  	  RRR4       RRR4       R# u upi   + '       g   i     L; i  + '       g   i     R# ; i)r  rU   r  r  rx   N)r}   r~   r   r|   r	   r  r/   r.   r+   r  r  r0  r   rn   r  r  )r#   r  rY   ra  r  rs   r~   s   &      r   test_extractall_pathlike_dir-MiscReadTestBase.test_extractall_pathlike_dir  s    ggll7L1$$\\'K88C&)7cWWY11cK7NN9--c2KNX&ww||C6  !1!1$!7G ' 9 %$7 98 %$$s=   %E(D;	-D6	D6BD;	$E6D;	;EEE	c           
     j   R p\         P                  P                  \        R4      p\        P
                  ! V4      ;_uu_ 4        \        P                  ! \        RR7      ;_uu_ 4       pVP                  V4      pVP                  V\        P                  ! V4      RR7       \         P                  P                  W!4      pV P                  \         P                  P                  V4      VP                  4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  r  rU   r  r  r  N)r}   r~   r   r|   r	   r  r/   r.   r+   rk   r{   r0  rn   r  r  r  s   &     r   test_extract_pathlike_dir*MiscReadTestBase.test_extract_pathlike_dir  s    !ggll7L1$$\\'K88CmmG,GKKi&8&8&=oKVS2IRWW--i8'--H	 9 %$88 %$$s%   %D!*BD	<D!DD!!D2	c                @   \         P                  P                  \        R 4      p\	        VR4      ;_uu_ 4       pVP                  R4       RRR4        \        P                  \        P                  4      p VP                  V4       V P                  R4       \         P"                  ! V4       R#   + '       g   i     Lo; i  \        P                   d)    T P                  TP                  P                  4        Lgi ; i  \         P"                  ! T4       i ; i)emptyr-  r   NzReadError not raised)r}   r~   r   r|   r.   rV  object__new__r/   r0   __init__r   rA  r6  ry  rp  r	   r  )r#   r  rt   rY   s   &   r   test_init_close_fobj%MiscReadTestBase.test_init_close_fobj  s     Wg.%$JJsO 		$..1C2U# 		01U#  $$ 4 2 234
 U#s;   B2#D 8C 	D 2C	:D?D DD Dc                `   \         P                  ! V P                  4      ;_uu_ 4       p\        W4       FY  w  r#V P	                  VP
                  VP
                  4       V P	                  VP                  4       VP                  4       4       K[  	  R R R 4       R #   + '       g   i     R # ; ir   )r/   r.   r+   ziprn   r  get_info)r#   rY   m1m2s   &   r   test_parallel_iteration(MiscReadTestBase.test_parallel_iteration.  sl     \\$,,''3c-  BII6  > ( ('''s   A)BB-	zrequires zlibc           	     ~   \         P                  P                  R 4      ;_uu_ 4       p\        P                  Vn        V P                  \        P                  4      ;_uu_ 4        \        P                  ! V P                  4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)ztarfile.TarInfo.fromtarfileN)r   r  r  zliberrorside_effectrM  r/   rA  r.   r+   )r#   r  s   & r   test_zlib_error_does_not_leak.MiscReadTestBase.test_zlib_error_does_not_leak6  sq     ]]  !>??4#zzD""7#4#455T\\* 6 @?55 @??s#   =B+%!B	B+B(#B++B<	c                6   \         P                  ! 4       p\        P                  ! VR R7      pVP	                  4        VP                  ^ 4       \        P                  ! VRR7      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       VP                  ^ 4       \        P                  ! VRR7      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       R#   + '       g   i     Ll; i  + '       g   i     R# ; i)r   rx  r|Nrz   )r,   r   r/   r.   r]   r   rn   r`  )r#   r  tfs   &  r   test_next_on_empty_tarfile+MiscReadTestBase.test_next_on_empty_tarfile?  s    ZZ\\\"3/



\\"400BRWWY- 1 	
\\"3//2RWWY- 0/	 10 0//s   /!C4	!D4D	D	r&   r   ))r'   r(   r)   r*   rn  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r}   r	   skip_unless_symlinkr  skip_unless_working_chmodr  staticmethodr  r  r  r  r  r  skipIfr  r  r  r3   r4   r5   s   @r   ru  ru  (  s    IG$(,G5;,28<%M9. V,:<""> #<>$ ((" )"> 0 0" ((" )"HI$&? __TT\?3+ 4+. .r   ru  c                       ] tR tRtRtRtR# )MiscReadTestiL  Nr&   )r'   r(   r)   r*   r  r3   r&   r   r   r  r  L  s    Nr   r  c                       ] tR tRtRtR# )GzipMiscReadTestiO  r&   Nr   r&   r   r   r!  r!  O  r   r   r!  c                       ] tR tRtRtR# )Bz2MiscReadTestiR  r&   Nr   r&   r   r   r#  r#  R  r   r   r#  c                       ] tR tRtRtR# )LzmaMiscReadTestiU  r&   Nr   r&   r   r   r%  r%  U  r   r   r%  c                       ] tR tRtRtR# )ZstdMiscReadTestiX  r&   Nr   r&   r   r   r'  r'  X  r   r   r'  c                   @   a  ] tR tRt o RtRtR tR tR tR t	Rt
V tR	# )
StreamReadTesti[  r  Tc                p   V P                    Fe  pVP                  4       '       g   K  V P                   P                  V4      ;_uu_ 4       p  VP                  R4      pX'       d   K   RRR4       Kg  	  R#   \        P
                   d    T P                  R4        LAi ; i  + '       g   i     K  ; i)Tr   z6simple read-through using TarFile.extractfile() failedN)rY   isregrl   rm   r/   StreamErrorr   )r#   rs   rt   bufs   &   r   test_read_through StreamReadTest.test_read_through`  s     xxG==??%%g..$B"iin 3 /.   #.. B		 #A BB	 /..s6   B$A8B$)B$8&B!	B$ B!	!B$$B5c                d   V P                   P                  4       pV P                   P                  V4      ;_uu_ 4       pVP                  4       pR R R 4       V P	                  \        X4      VP                  R4       V P	                  \        V4      \        R4       R #   + '       g   i     LX; i)Nrj   )	rY   r`  rl   rm   rn   ro   rp   r   rq   rr   s   &   r   ru   (StreamReadTest.test_fileobj_regular_filep  sw    ((--/XX!!'**d99;D +TGLL0	24.0	2	 +*s   BB/	c                   V P                   P                  4       pV P                   P                  V^ ,          4      ;_uu_ 4       pV P                  \        P
                  VP                  4       RRR4       R#   + '       g   i     R# ; i)r   N)rY   r  rl   rM  r/   r,  rm   )r#   tarinfosr  s   &  r   test_provoke_stream_error(StreamReadTest.test_provoke_stream_errory  sX    88&&(XX!!(1+..!g11166: /...s   +A::B	c                   \         P                  ! \        R R7      p V P                  p VP	                  4       pVP	                  4       pVf   MV P                  VR4       VP                  4       '       g   VP                  4       '       dD   V P                  \         P                  4      ;_uu_ 4        VP                  V4       RRR4       K  VP                  V4      pVP                  V4      pVf   K  V P                  VR4       V P                  VP                  4       VP                  4       R4       EK  VP                  4        R#   + '       g   i     L; i  TP                  4        i ; i)rU   r  Nzstream.next() failed.zstream.extractfile() failedzstream extraction failed)r/   r.   r+   rY   r`  assertIsNotNoneislnkissymrM  r,  rl   rn   rm   r]   )r#   tar1tar2t1t2v1v2s   &      r   test_compare_members#StreamReadTest.test_compare_members~  s   ||Gk:	88DYY[YY[:$$R)@A88::**7+>+>??((, @%%b)%%b):$$R)FG  BGGI24 JJL @? JJLs1   AE" 8E" 'E" 5EA6E" E	E" "E4r&   N)r'   r(   r)   r*   r    rn  r.  ru   r4  r@  r3   r4   r5   s   @r   r)  r)  [  s(     FI 2;
 r   r)  c                       ] tR tRtRtR# )GzipStreamReadTesti  r&   Nr   r&   r   r   rC  rC    r   r   rC  c                       ] tR tRtRtR# )Bz2StreamReadTesti  r&   Nr   r&   r   r   rE  rE    r   r   rE  c                       ] tR tRtRtR# )LzmaStreamReadTesti  r&   Nr   r&   r   r   rG  rG    r   r   rG  c                       ] tR tRtRtR# )ZstdStreamReadTesti  r&   Nr   r&   r   r   rI  rI    r   r   rI  c                   &   a  ] tR tRt o R tRtV tR# )TarStreamModeReadTesti  c                x    V P                    F  pK  	  V P                  V P                   P                  . 4       R # r   )rY   rn   r  )r#   _s   & r   test_stream_mode_no_cache/TarStreamModeReadTest.test_stream_mode_no_cache  s-    A ))2.r   r&   N)r'   r(   r)   r*   rN  r3   r4   r5   s   @r   rK  rK    s     / /r   rK  c                       ] tR tRtRtR# )GzipStreamModeReadTesti  r&   Nr   r&   r   r   rQ  rQ    r   r   rQ  c                       ] tR tRtRtR# )Bz2StreamModeReadTesti  r&   Nr   r&   r   r   rS  rS    r   r   rS  c                       ] tR tRtRtR# )LzmaStreamModeReadTesti  r&   Nr   r&   r   r   rU  rU    r   r   rU  c                       ] tR tRtRtR# )ZstdStreamModeReadTesti  r&   Nr   r&   r   r   rW  rW    r   r   rW  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	DetectReadTesti  c                     \         P                  ! W4      pVP                  4        R #   \         P                   d   pT P	                  4         R p?R # R p?ii ; ir   )r/   r.   r]   rA  r   )r#   r   r$   rY   es   &&&  r   _testfunc_fileDetectReadTest._testfunc_file  sC    	,,t*C IIK    	IIKK	s   * AAAc                    \        VR 4      ;_uu_ 4       p\        P                   ! WVR7      pRRR4       XP                  4        R#   + '       g   i     L"; i  \        P                   d   pT P	                  4         Rp?R# Rp?ii ; i)r   ry  N)r.   r/   r]   rA  r   )r#   r   r$   r  rY   r[  s   &&&   r   _testfunc_fileobj DetectReadTest._testfunc_fileobj  s_    	dD!!Qll4q9 "
 IIK "!   	IIKK	s-   A A	A 	A	A B1BBc                   V P                   '       Ed_   V P                  \        P                  4      ;_uu_ 4        \        P                  ! \
        R V P                   ,           R7       RRR4       V P                  \        P                  4      ;_uu_ 4        \        P                  ! \
        RV P                   ,           R7       RRR4       V P                  \        P                  4      ;_uu_ 4        \        P                  ! V P
                  R R7       RRR4       V P                  \        P                  4      ;_uu_ 4        \        P                  ! V P
                  RR7       RRR4       V! V P
                  R4       V! V P
                  R V P                   ,           4       V! V P
                  R4       V! V P
                  RV P                   ,           4       V! V P
                  R4       R#   + '       g   i     EL; i  + '       g   i     ELL; i  + '       g   i     EL; i  + '       g   i     L; i)rS   r   Nr  rz   zr:*r|*)r!   rM  r/   rA  r.   r+   )r#   testfuncs   &&r   _test_modesDetectReadTest._test_modes  sL   ;;;""7#4#455W4$+++=> 6""7#4#455W4$+++=> 6""7#4#455T\\5 6""7#4#455T\\5 6s#tdkk12u%tdkk12u% 65555555555s/   .G5.H	5#H#H15H		H	H.	1I	c                <    V P                  V P                  4       R # r   )re  r\  r"   s   &r   test_detect_fileDetectReadTest.test_detect_file  s    ,,-r   c                <    V P                  V P                  4       R # r   )re  r`  r"   s   &r   test_detect_fileobj"DetectReadTest.test_detect_fileobj  s    //0r   r&   N)r'   r(   r)   r*   r\  r`  re  rh  rk  r3   r4   r5   s   @r   rY  rY    s#     & .1 1r   rY  c                       ] tR tRtRtR# )GzipDetectReadTesti  r&   Nr   r&   r   r   rn  rn    r   r   rn  c                   &   a  ] tR tRt o R tRtV tR# )Bz2DetectReadTesti  c                ^   \        \        R 4      ;_uu_ 4       pVP                  4       pRRR4       \        P                  ! \
        R^R7      ;_uu_ 4       pVP                  X4       RRR4       V P                  \
        R4       R#   + '       g   i     Lg; i  + '       g   i     L;; i)r   Nr-  compresslevelrc  )r.   r+   rm   r@   rB   r   rV  r\  r   s   &  r   test_detect_stream_bz2(Bz2DetectReadTest.test_detect_stream_bz2  so    
 '4  D99;D ! [[$a88DJJt 9 	GU+ !  98s   B	B	B	B,	r&   N)r'   r(   r)   r*   rt  r3   r4   r5   s   @r   rp  rp    s     , ,r   rp  c                       ] tR tRtRtR# )LzmaDetectReadTesti  r&   Nr   r&   r   r   rw  rw    r   r   rw  c                       ] tR tRtRtR# )ZstdDetectReadTesti  r&   Nr   r&   r   r   ry  ry    r   r   ry  c                   *   a  ] tR tRt o RtR tRtV tR# ) GzipBrokenHeaderCorrectExceptioni  z6
See: https://github.com/python/cpython/issues/107396
c                    \         P                  ! R 4      pV P                  \        P                  4      ;_uu_ 4        \        P
                  ! VRR7       RRR4       R#   + '       g   i     R# ; i)s               zr|gzrx  N)r,   r   rM  r/   rA  r.   )r#   r  s   & r   runTest(GzipBrokenHeaderCorrectException.runTest  sK    JJ
 w0011LL0 2111s   A!!A2	r&   N)r'   r(   r)   r*   __doc__r}  r3   r4   r5   s   @r   r{  r{    s     
1 
1r   r{  c                      a  ] tR tRt o RR ltR tR tR tR tR t	R	 t
R
 tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )MemberReadTesti	  Nc           	        Veh   V P                   P                  V4      ;_uu_ 4       pV P                  \        VP	                  4       4      VRVP
                  ,          4       R R R 4       RVR&   RVR&   ^dVR&   RVP
                  9  d   RVR	&   RVR
&   VP                  4        F3  w  rVV P                  \        W4      VRV: RVP
                  : 24       K5  	  R #   + '       g   i     L; i)Nwrong sha256sum for %sr  r    r   r   zold-v7r/   r  gnamezwrong value in z
 field of )rY   rl   rn   r   rm   r   itemsr  )r#   rs   chksumkwargsr  kvs   &&&,   r   _test_memberMemberReadTest._test_member  s    %%g..!  1668!4f07<<?A / 'wuu7<<''F7O'F7OLLNDAWW0!78',,GI # /.s   <CC/	c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )ri   c  rp   r  NrY   rk   r  rq   r  s   & r   test_find_regtype MemberReadTest.test_find_regtype  s+    (($$_5'^Dr   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )zustar/conttyper  r  Nr  r  s   & r   test_find_conttype!MemberReadTest.test_find_conttype   s,    (($$%56'^Dr   c                b    V P                   P                  R 4      pV P                  V^ R7       R# )r  rp   NrY   rk   r  r  s   & r   test_find_dirtype MemberReadTest.test_find_dirtype$  s)    (($$_5'*r   c                b    V P                   P                  R 4      pV P                  V^R7       R# )zustar/dirtype-with-sizer  Nr  r  s   & r   test_find_dirtype_with_size*MemberReadTest.test_find_dirtype_with_size(  s*    (($$%>?',r   c                d    V P                   P                  R 4      pV P                  V^ RR7       R# )r   ri   rp   linknameNr  r  s   & r   test_find_lnktype MemberReadTest.test_find_lnktype,  s+    (($$_5'ODr   c                d    V P                   P                  R 4      pV P                  V^ RR7       R# )r   r   r  Nr  r  s   & r   test_find_symtype MemberReadTest.test_find_symtype0  s+    (($$_5'I>r   c                f    V P                   P                  R 4      pV P                  V^ ^^ R7       R# )ustar/blktyperp   devmajordevminorNr  r  s   & r   test_find_blktype MemberReadTest.test_find_blktype4  -    (($$_5'ABr   c                f    V P                   P                  R 4      pV P                  V^ ^^R7       R# )ustar/chrtyper  Nr  r  s   & r   test_find_chrtype MemberReadTest.test_find_chrtype8  r  r   c                b    V P                   P                  R 4      pV P                  V^ R7       R# )ustar/fifotyper  Nr  r  s   & r   test_find_fifotype!MemberReadTest.test_find_fifotype<  s*    (($$%56'*r   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )zustar/sparse P r  NrY   rk   r  sha256_sparser  s   & r   test_find_sparseMemberReadTest.test_find_sparse@  s+    (($$^4'mDr   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )
gnu/sparser  r  Nr  r  s   & r   test_find_gnusparse"MemberReadTest.test_find_gnusparseD  s+    (($$\2'mDr   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )gnu/sparse-0.0r  r  Nr  r  s   & r   test_find_gnusparse_00%MemberReadTest.test_find_gnusparse_00H  ,    (($$%56'mDr   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )gnu/sparse-0.1r  r  Nr  r  s   & r   test_find_gnusparse_01%MemberReadTest.test_find_gnusparse_01L  r  r   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )gnu/sparse-1.0r  r  Nr  r  s   & r   test_find_gnusparse_10%MemberReadTest.test_find_gnusparse_10P  r  r   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )u   ustar/umlauts-ÄÖÜäöüßr  r  Nr  r  s   & r   test_find_umlauts MemberReadTest.test_find_umlautsT  s2    (($$ &D E'^Dr   c                \    RpV P                  WP                  P                  4       4       R# )r  Na   ustar/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/12345/1234567/longname)r  rY   r?  )r#   r   s   & r   test_find_ustar_longname'MemberReadTest.test_find_ustar_longnameY  s     <dHH--/0r   c                l    V P                   P                  R 4      pV P                  VR\        R7       R# )zmisc/regtype-old-v7r  r  Nr  r  s   & r   test_find_regtype_oldv7&MemberReadTest.test_find_regtype_oldv7]  s,    (($$%:;'^Dr   c                   V P                   P                  4        \        P                  ! V P                  V P
                  R R7      V n         V P                   P                  R4      pV P                  VR\        R7       R# )rU   rV   u   pax/umlauts-ÄÖÜäöüßr  r  N)	rY   r]   r/   r.   r+   r$   rk   r  rq   r  s   & r   test_find_pax_umlauts$MemberReadTest.test_find_pax_umlautsa  s_    <<499)46(($$ &D E'^Dr   r`   r   )r'   r(   r)   r*   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r3   r4   r5   s   @r   r  r  	  sx     I"EE+-E?CC+EEEEEE
1EE Er   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	LongnameTestij  c                   V P                   R ,           R,           R,           p V P                  P                  V4      pV P                  XP                  \        P                  R4       R#   \         d    T P	                  R4        LKi ; i)r   longnamezlongname not foundzread longname as dirtypeN  123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/)	r   rY   rk   r  r   assertNotEqualr  r/   r  )r#   r  rs   s   &  r   test_read_longnameLongnameTest.test_read_longnamel  sp    ;;$|3j@	,hh((2G 	GLL'//*	,  	,II*+	,s   A+ +B
	B
c                @   V P                   R ,           R,           R,           pV P                   R ,           R,           R,           p V P                  P                  V4      pV P                  XP                  VR4       R#   \         d    T P	                  R4        L=i ; i)r   r  longlinkzlonglink not foundzlinkname wrongNr  )r   rY   rk   r  r   rn   r  )r#   r  r  rs   s   &   r   test_read_longlinkLongnameTest.test_read_longlinkv  s    ;;$|3j@;;$|3j@	,hh((2G 	))85EF  	,II*+	,s   A> >BBc                
   V P                   R ,           R,           R,           pV P                  P                  V4      pVP                  pV P                  P                  P                  V4       \        P                  ! V P                  P                  P                  R4      4      pV P                  \        P                  4      ;_uu_ 4        \        P                  ! RVR7       RRR4       R#   + '       g   i     R# ; i)r   r  zfoo.tar)r   ry  Nr  i   )r   rY   rk   r  ry  r   r,   r   rm   rM  r/   rA  r.   )r#   r  rs   r  rt   s   &    r   test_truncated_longname$LongnameTest.test_truncated_longname  s    ;;$|3j@(($$X.f%zz$((**//89w0011LLi6 2111s   C11D	c                   V P                   R ,           R,           R,           pV P                  P                  V4      P                  p\	        \
        R4      ;_uu_ 4       pVP                  V4       \        P                  P                  VP                  R4      RR4      pV P                  VP                  V P                  4       RRR4       R#   + '       g   i     R# ; i)r   r  r   r   rU   strictNr  )r   rY   rk   r  r.   r+   r   r/   rW  frombufrm   rn   r  longnametype)r#   r  r  rt   rs   s   &    r   test_header_offsetLongnameTest.test_header_offset  s     ;;$|3j@##H-44'4  DIIfoo--diin.98EGW\\4+<+<=	 !   s   A(CC"	c                (   Rp\         P                  ! 4       ;_uu_ 4        \        P                  ! \        R4      ;_uu_ 4       pV P
                  Vn         \        P                  ! V4       VP                  V4       \        P                  ! VP                  R4      4        RRR4       \        P                  ! \        4      ;_uu_ 4       pV P                  VP                  V4      4       V P                  VP                  VP                  R4      4      4       RRR4       RRR4       R#   \        P                  ! TP                  R4      4       i ; i  + '       g   i     L; i  + '       g   i     LW; i  + '       g   i     R# ; i)r   r   r   Nzfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/)r	   r   r/   r.   r   r   r}   r   r   r   rstripr7  rk   removesuffix)r#   longdirrY   s   &  r   test_longname_directory$LongnameTest.test_longname_directory  s    #!!gs++s![[
2HHW%GGG$HHW^^C01 , g&&#$$S]]7%;<$$S]]73G3G3L%MN ' "! HHW^^C01 ,+ '& "!!sT   $F E	'D0>%E	$*F AE-	F 0'EE	E*%F -E=8F  F	r&   N)r'   r(   r)   r*   r  r  r  r  r  r3   r4   r5   s   @r   r  r  j  s&     ,G7	>O Or   r  c                      a  ] tR tRt o Rt]P                  t]P                  t	R t
R tR tR tR t]R 4       tR	tV tR
# )GNUReadTesti  gnuc                   V P                   P                  V\        R R7       \        P                  P                  \        V4      p\        VR4      ;_uu_ 4       pVP                  4       pRRR4       V P                  \        X4      \        RV,          4       V P                  4       '       dF   \        P                  ! V4      pV P                  VP                  R,          VP                  4       R# R#   + '       g   i     L; i)r   rx   r   Nr  r   )rY   r{   r|   r}   r~   r   r.   rm   rn   r   r  _fs_supports_holesr  
assertLess	st_blocksst_size)r#   r   filenamert   r   r   s   &&    r   _test_sparse_fileGNUReadTest._test_sparse_file  s    wv677<<.(D!!T99;D "4-(4/	1 ""$$!AOOAKK#-qyy9 % "!s   C88D	c                (    V P                  R 4       R# )r  Nr  r"   s   &r   test_sparse_file_old GNUReadTest.test_sparse_file_old  s    |,r   c                (    V P                  R 4       R# )r  Nr   r"   s   &r   test_sparse_file_00GNUReadTest.test_sparse_file_00      /0r   c                (    V P                  R 4       R# )r  Nr   r"   s   &r   test_sparse_file_01GNUReadTest.test_sparse_file_01  r  r   c                (    V P                  R 4       R# )r  Nr   r"   s   &r   test_sparse_file_10GNUReadTest.test_sparse_file_10  r  r   c                    \         P                  P                  R4      '       d   \        P                  P                  \        R4      p \        V R4      ;_uu_ 4       pVP                  R4       VP                  R4       VP                  4        RRR4       \        P                  ! V 4      p\        P                  ! V 4       VP                  R,          VP                  8  # R#   + '       g   i     L^; i)	linuxzsparse-testr-  i   Nr   F)r  androids   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)r   r  r  r}   r~   r   r|   r.   r   rV  r_  r  r	   r  r  r  )r   rt   r   s      r   r  GNUReadTest._fs_supports_holes  s     <<""#78877<<7DdD!!T		$

;'	 "
 AT"KK#%		12 "!s   3C''C7	r&   N)r'   r(   r)   r*   r   r/   GNUTYPE_LONGNAMEr  
GNU_FORMATr   r  r  r  r  r  r  r  r3   r4   r5   s   @r   r  r    sM     F++LF
:-111  r   r  c                   f   a  ] tR tRt o Rt]P                  t]P                  t	R t
R tR tRtV tR# )PaxReadTesti  paxc                B   \         P                  ! \        R R7      p VP                  R4      pV P	                  VP
                  R4       V P	                  VP                  R4       V P	                  VP                  P                  R4      R4       VP                  R4      pV P	                  VP
                  R4       V P	                  VP                  R4       V P	                  VP                  P                  R4      R4       VP                  R	4      pV P	                  VP
                  R
4       V P	                  VP                  R
4       V P	                  VP                  P                  R4      R4       VP                  4        R#   TP                  4        i ; i)rU   r  pax/regtype1rQ  r   zVENDOR.umlautsu   ÄÖÜäöüßzpax/regtype2r   zpax/regtype3r/   N)
r/   r.   r+   rk   rn   r  r  pax_headersgetr]   r#   rY   rs   s   &  r   test_pax_global_headers#PaxReadTest.test_pax_global_headers  sA   ll7[9	mmN3GW]]E2W]]E2W00445EF;= mmN3GW]]B/W]]E2W00445EF;= mmN3GW]]I6W]]I6W00445EF;= IIKCIIKs   EF Fc                   \         P                  ! \        R R7      p VP                  R4      pV P	                  VP
                  R4       V P	                  VP                  ^{4       V P	                  VP                  ^{4       V P	                  VP                  R4       V P	                  \        VP                  4      \        4       V P	                  \        VP                  R,          4      R4       V P	                  \        VP                  R,          4      R4       VP                  4        R#   TP                  4        i ; i)rU   r  zpax/regtype4r  g  ^AatimectimeN)r/   r.   r+   rk   rn   rp   r   r   r  r  r  r  r]   r  s   &  r   test_pax_number_fields"PaxReadTest.test_pax_number_fields  s    ll7[9
	mmN3GW\\40W[[#.W[[#.W]]L9T'--0%8U7#6#6w#?@,OU7#6#6w#?@,OIIKCIIKs   DD2 2Ec           
        RpRR/pV EF  pV P                  VR7      ;_uu_ 4        \        P                  ! \        R\        P                  RR7      p \        P
                  ! 4       pRVn        ^Vn        W%n        VP                  V4       VP                  4        \        \        R4      ;_uu_ 4       pVP                  4       pV P                  R	V4       VP                  R	V4      pR
R
R
4       \        \        R4      ;_uu_ 4       pVP                  4        VP                  X4       R
R
R
4       V P!                  \        P"                  R4      ;_uu_ 4        \        P                  ! \        RR7       R
R
R
4       R
R
R
4       EK  	  R
#   TP                  4        i ; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     LZ; i  + '       g   i     EK  ; i)	    foo=bar
rQ  r   )headerr   rU   r   rW   r  r   s   11 foo=bar
Nr-  z)method tar: ReadError\('invalid header'\)r  )
r#  s   0 
s   1 
s   2 
s   3 =
s   4 =a
s   1000000 foo=bar
s
   0 foo=bar
s   -12 foo=bar
s$   000000000000000000000000036 foo=bar
)subTestr/   r.   r   
PAX_FORMATrW  r   r   r  r^  r]   rm   r  r>  r_  rV  rG  rA  )r#   pax_header_replacementsr  replacementrY   ra  r  r   s   &       r   test_pax_header_bad_formats'PaxReadTest.test_pax_header_bad_formats
  sW   #
 en2K[11ll7C8J8J,79 )A"AFAE$/MKKNIIK'4((A668DMM/48<<ED )
 '4((AJJLGGDM ) ++G,=,=?kllLL;? m+ 21 3 IIK((
 )( ml+ 211sk   -G :F(G 75F', G "F:.0G G;G F$	$G 'F72G :G
G GG  G2r&   N)r'   r(   r)   r*   r   r/   XHDTYPEr  r'  r   r  r   r*  r3   r4   r5   s   @r   r  r    s4     F??LF.(@ (@r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )WriteTestBasei5  c                   \         P                  ! 4       p\        P                  ! WP                  R 7      ;_uu_ 4       pVP                  \        P                  ! R4      4       RRR4       V P                  VP                  R4       VP                  4       p?\        P                  ! 4        V P                  VP                  4       V P                  W1P                  4       4       R#   + '       g   i     L; i)rx  rQ  Nz#external fileobjs must never closed)r,   r   r/   r.   r$   r^  rW  r.  rp  r   r   
gc_collectrn   )r#   rt   rY   r   s   &   r   test_fileobj_no_close#WriteTestBase.test_fileobj_no_close9  s    zz|\\$YY773KK./ 8&KL}}%}}/ 87s   &C++C;	c           	     x   \         P                  ! \        V P                  4      ;_uu_ 4       p\         P                  ! R 4      p\         P
                  \         P                  ,
          Vn        VP                  V\        P                  ! RVP                  ,          4      4       RRR4       V P                  \        R4      ;_uu_ 4       pV P                  \        VP                  4       4      \         P
                  ^,          4       RRR4       R#   + '       g   i     Lw; i  + '       g   i     R# ; i)rQ  rT  Nr   )r/   r.   r   r$   rW  
RECORDSIZE	BLOCKSIZErp   r^  r,   r   rn   ro   rm   )r#   rY   ra  rt   s   &   r   test_eof_markerWriteTestBase.test_eof_markerE  s    
 \\'499--&A'''*;*;;AFKK2::dQVVm45 .
 YYw%%S-w/A/AA/EF &% .-
 &%%s   A8D?D(D%	(D9	r&   N)r'   r(   r)   r*   r1  r6  r3   r4   r5   s   @r   r.  r.  5  s     
0G Gr   r.  c                     a  ] tR tRt o RtR tR tR tR tR t	R t
]P                  ! ]! ]R	4      R
4      R 4       t]P"                  R 4       tR tR tRR lt]P"                  R 4       tR tR tR tR tR tRtV tR# )	WriteTestiS  r]  c                   Rp\         P                  ! \        V P                  4      p \         P                  ! V4      pVP                  V4       VP                  4        \         P                  ! \        4      p V P                  VP                  4       ^ ,          VR4       VP                  4        R#   TP                  4        i ; i  TP                  4        i ; i)
0123456789z!failed to store 100 char filenameNd0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789)	r/   r.   r   r$   rW  r^  r]   rn   r?  )r#   r   rY   ra  s   &   r   test_100_char_nameWriteTest.test_100_char_nameW  s    
 !ll7DII.	%AKKNIIKll7#	S\\^A.79 IIK IIK IIKs   'B5 ;(C
 5C
Cc                   \         P                  ! \        V P                  4      p \        P
                  P                  \        R 4      p\        VR4      ;_uu_ 4       pVP                  R4       RRR4       VP                  V4       VP                  4        V P                  \        P
                  P                  \        4      ^ R4       R#   + '       g   i     Lg; i  TP                  4        i ; i)rq  r-     aaaNztarfile is empty)r/   r.   r   r$   r}   r~   r   r|   rV  r   r]   assertGreatergetsize)r#   rY   r~   rt   s   &   r   test_tar_sizeWriteTest.test_tar_sizek  s    ll7DII.	77<<0DdD!!T

6" "GGDMIIK277??73Q"	$ "! IIKs#   8C# C1C# C 	C# #C5c                |   \         P                  ! \        V P                  4      p \        P
                  P                  \        R 4      p\        VR4      ;_uu_ 4         RRR4       VP                  V4      pV P                  VP                  ^ 4       \        VR4      ;_uu_ 4       pVP                  R4       RRR4       VP                  V4      pV P                  VP                  ^4       VP                  4        R#   + '       g   i     L; i  + '       g   i     Lb; i  TP                  4        i ; i)rq  r-  Nr@  )r/   r.   r   r$   r}   r~   r   r|   
gettarinforn   rp   rV  r]   )r#   rY   r~   rs   rt   s   &    r   test_file_sizeWriteTest.test_file_sizey  s    ll7DII.	77<<0DdD!! "nnT*GW\\1-dD!!T

6" "nnT*GW\\1-IIK "!
 "!
 IIKs<   8D) D!A	D) *D<5D) D	D) D&	!D) )D;c                   \         P                  P                  \        R 4      p\         P                  ! V4        \
        P                  ! \        V P                  4      p VP                  V4      pV P                  VP                  ^ 4       VP                  4         \        P                  ! V4       R#   TP                  4        i ; i  \        P                  ! T4       i ; i)	directoryN)r}   r~   r   r|   r   r/   r.   r   r$   rF  rn   rp   r]   r	   r   r#   r~   rY   rs   s   &   r   test_directory_sizeWriteTest.test_directory_size  s    ww||G[1
	",,w		2C...  q1		OOD! 		OOD!s#   %C "-B8 C 8C

C C%c                   \         P                  P                  \        R 4      p\         P                  ! V4       \        \         P                  P                  VR4      R4      P                  4        \        \         P                  P                  VR4      R4      P                  4         \        P
                  ! \        V P                  4      p \        P                  P                  R4      ;_uu_ 4       pRR.Vn        VP                  V4       RRR4       . pVP                  4        FB  pVP!                  \         P                  P#                  VP$                  4      R,          4       KD  	  V P'                  V. RO4       VP                  4         \(        P*                  ! \         P                  P                  VR4      4       \(        P*                  ! \         P                  P                  VR4      4       \(        P,                  ! V4       R#   + '       g   i     EL; i  TP                  4        i ; i  \(        P*                  ! \         P                  P                  TR4      4       \(        P*                  ! \         P                  P                  TR4      4       \(        P,                  ! T4       i ; i)rJ  1r   2z
os.listdirNr  )rJ  rO  rP  )r}   r~   r   r|   r   r.   r]   r/   r   r$   r   r  r  return_valuer   r  appendsplitr   rn   r	   r  r   )r#   r~   rY   mock_listdirpathsms   &     r   test_ordered_recursion WriteTest.test_ordered_recursion  s   ww||G[1
RWW\\$$c*002RWW\\$$c*002	",,w		2C	]]((66,14c
L-GGDM 7 )ALLqvv!6r!:; *  (?@		RWW\\$45RWW\\$45OOD! 766 		RWW\\$45RWW\\$45OOD!s>   ,%I 'H- 9HA4H- I H*	$	H- -H??I B Kc           	        \         P                  ! \        V P                  4      ;_uu_ 4       p\        P
                  P                  \        R 4      p\        VR4      ;_uu_ 4       pVP                  R4       RRR4       VP                  \        P                  ! V4      4      pVP                  V4      pV P                  VP                  \        4       V P                  VP                  VP                  4       V P                  VP                   ^4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rq  r-  r@  N)r/   r.   r   r$   r}   r~   r   r|   rV  rF  r	   r0  rz  r   r{  rn   rp   )r#   rY   r~   rt   rs   tarinfo2s   &     r   test_gettarinfo_pathlike_name'WriteTest.test_gettarinfo_pathlike_name  s    \\'499--77<<0DdD!!T

6" "nnY%7%7%=>G~~d+H!!',,4W\\8==9W\\1- .-!! .--s$   9D6'D#	9B D6#D3.D66E	r  r  c                v   \         P                  P                  \        R 4      p\         P                  P                  \        R4      p\	        VR4      ;_uu_ 4       pVP                  R4       RRR4        \         P                  ! W!4        \        P                  ! \        V P                  4      p VP                  V4       VP                  V4      pV P                  VP                  ^ 4       VP                  4         \         P"                  ! V4       \         P"                  ! V4       R#   + '       g   i     L; i  \         d#   pT P                  RT,          4        Rp?LRp?ii ; i  TP                  4        i ; i  \         P"                  ! T4       \         P"                  ! T4       i ; i)r  link_targetr-  r@  Nos.link(): %s)r}   r~   r   r|   r.   rV  r  PermissionErrorskipTestr/   r   r$   rF  rn   rp   r]   r	   r  )r#   r  targetrt   r[  rY   rs   s   &      r   test_link_sizeWriteTest.test_link_size  s%    ww||GV,g}5&$4JJv  	/GGF!	#,,w		2Cv&...  q1		V$T"#    	/MM/A-..	/ 		V$T"sH   D28E %F
 5>E5 3F
 2E	E2E--E25FF
 
.F8c                   \         P                  P                  \        R 4      p\         P                  ! RV4        \
        P                  ! \        V P                  4      p VP                  V4      pV P                  VP                  ^ 4       VP                  4         \        P                  ! V4       R#   TP                  4        i ; i  \        P                  ! T4       i ; i)symlinkr^  N)r}   r~   r   r|   rf  r/   r.   r   r$   rF  rn   rp   r]   r	   r  rK  s   &   r   test_symlink_sizeWriteTest.test_symlink_size  s    ww||GY/


=$'	#,,w		2C...  q1		T" 		T"s#   %C #-B9 C 9CC C&c                `   \         P                  P                  \        4      p\        P
                  ! \        V P                  4      p V P                  VP                  VR 4       VP                  V4       V P                  VP                  4       . R4       \        P                  ! \        4      ;_uu_ 4        VP                  V4       RRR4       V P                  VP                  4       . R4       VP                  4        R#   + '       g   i     LC; i  TP                  4        i ; i)zarchive name must be absolutezadded the archive to itselfN)r}   r~   r|  r   r/   r.   r$   rn   r   r   r?  r	   
change_cwdr|   r]   )r#   dstnamerY   s   &  r   test_add_selfWriteTest.test_add_self  s    ''//'*ll7DII.	SXXw35GGGS\\^R13 %%g..  /S\\^R13 IIK /.
 IIKs%   
A1D ;D)D D	D D-c           	        \         P                  P                  \        R 4      p\         P                  ! V4        R
 F8  p\         P                  P                  W4      p\
        P                  ! V4       K:  	  R p\        P                  ! \        V P                  RR7      p VP                  VRVR7       VP                  4        V P                  \        4      ;_uu_ 4        VP                  VRRRV4       RRR4       \        P                  ! \        R	4      p V F;  pV P                  VP                   ^{4       V P                  VP"                  R4       K=  	  V P                  \%        VP'                  4       4      ^4       VP                  4         \
        P(                  ! V4       R#   TP                  4        i ; i  + '       g   i     L; i  TP                  4        i ; i  \
        P(                  ! T4       i ; i)ry   rQ  c                     \         P                  P                  V P                  4      R 8X  d   R# ^{V n        RV n        V # )r   NrQ  )r}   r~   basenamer   r   r  r   s   &r   ry   %WriteTest.test_filter.<locals>.filter  s3    77##GLL1U:! %r   rU   r  	empty_dir)arcnamery   TNrz   )rQ  r   baz)r}   r~   r   r|   r   r	   create_empty_filer/   r.   r   r$   r   r]   rM  	TypeErrorrn   r   r  ro   r  r  )r#   tempdirr   ry   rY   rs   s   &     r   test_filterWriteTest.test_filter  si   '',,w1
	&-ww||G2++D1 . ,,w		KHCVD		 ""9--dD&A . ,,w,C"G$$W[[#6$$W]]E:  #   S^^%5!6:		W% 		 .- 		W%sU   A(G0 %F3 9-G0 &G<#G0  A*G 
G0 3GG0 G	G0 G--G0 0HNc                   \         P                  P                  \        R 4      pV'       g   \        P
                  ! V4       M\         P                  ! V4       \        P                  ! \        V P                  4      p VP                  WAR7       VP                  4        \        P                  ! \        R4      p VP                  4       pVP                  4        V'       g   \        P                  ! V4       M\        P                  ! V4       T P!                  VP"                  T;'       g!    VP%                  \         P&                  R4      4       R#   TP                  4        i ; i  TP                  4        i ; i)rQ  rs  rz   r   N)r}   r~   r   r|   r	   ru  r   r/   r.   r   r$   r   r]   r`  r  r   rn   r   r>  sep)r#   r~   cmp_pathdirrQ  rY   ra  s   &&&&   r   _test_pathnameWriteTest._test_pathname  s     ggll7E*'',HHSMll7DII.	GGCG&IIKll7C(	
AIIKS!OOC !F!FT\\"&&#-FG IIK IIKs    E >E. E+.F c                R   \         P                  P                  \        R 4      p\         P                  P                  \        R4      p\         P                  ! V4        \         P                  P                  VR4      p\         P                  P                  VR4      p\        VR4      ;_uu_ 4       pVP                  R4       RRR4       \         P                  ! W44       \        P
                  ! VR4      ;_uu_ 4       pVP                  VRR7       VP                  VRR7       RRR4       \        P
                  ! V^R7      ;_uu_ 4       p VP                  VR	R
7       RRR4       \        P                  ! V4       \        P                  ! V4       R#   + '       g   i     L; i  + '       g   i     L; i  \         d    T P                  R4        Lzi ; i  + '       g   i     L; i  \        P                  ! T4       \        P                  ! T4       i ; i)testsymlinksztestsymlinks.tarsourcerf  r   z
something
Nr{  r  r  r  z&extractall failed with symlinked files)r}   r~   r   r|   r   r.   rV  rf  r/   r   r  OSErrorr   r	   r  r  )r#   rw  temparchivesource_filetarget_filer  rY   s   &      r   test_extractall_symlinks"WriteTest.test_extractall_symlinks6  sw    '',,w7ggll7,>?
	&'',,wx8K'',,wy9Kk#&&!& 'JJ{0k3//3X6Y7 0 ka88CHNN*9 # ; 9 [)W%! '& 0/  HIIFGH 98 [)W%ss    AG8 4F=G8 'F0*(G8 G%G'G8 F-	(G8 0G 	;G8 G"G%!G""G%%G5	0G8 8.H&c                N   V P                  R 4       V P                  \        P                  P                  R RR4      4       V P                  \        P                  P                  R RR4      4       V P                  \        P                  P                  RR 4      4       V P                  \        P                  P                  RR R4      4       V P                  \        P                  P                  RR RR4      4       V P                  \        P                  P                  RR RR4      4       V P                  \        P                  P                  RR RR4      4       V P                  \        P                  P                  RR 4      4       V P                  \        P                  P                  RR R4      4       V P                  \        P                  P                  RR RR4      4       V P                  \        P                  P                  RR RR4      4       V P                  R \        P                  ,           \        P                  ,           R,           4       V P                  R \        P                  ,           \        P                  ,           R RR7       R# )rQ  .r   ..T)r~  N)r  r}   r~   r   r|  r"   s   &r   test_pathnamesWriteTest.test_pathnamesQ  s   E"BGGLLU;<BGGLLe<=BGGLLe45BGGLLeS9:BGGLLeS%@ABGGLLeT5ABBGGLLeT5ABBGGLLu56BGGLLud;<BGGLLuc5ABBGGLLudEBCEBFFNRVV3e;<EBFFNRVV3UEr   c                    \         P                  R 8X  d   V P                  RR4       R# V P                  RR4       V P                  RR4       R# )r  zC:\foorQ  z/fooz///fooN)r   r  r  r"   s   &r   test_abs_pathnamesWriteTest.test_abs_pathnamesb  s>    <<7"	51.%0r   c                0   \         P                  ! \        4      ;_uu_ 4        \        P                  ! \
        V P                  4      p VP                  R 4       VP                  4        \        P                  ! \
        R4      p V F2  pVP                  R 8w  g   K  V P                  VP                  R4       K4  	  VP                  4         RRR4       R#   TP                  4        i ; i  TP                  4        i ; i  + '       g   i     R# ; i)r  rz   ./N)r	   rj  r|   r/   r.   r   r$   r   r]   r   assertStartsWithr#   rY   ra  s   &  r   test_cwdWriteTest.test_cwdi  s    !!'**,,w		2C		,,w,CAvv}--affd;  		 +*
 		 		 +**sA   &D
C+DC/ C/?DC,,D/DDD	c                  a \         \        \        3 F  o ! V3R  lR\        P                  4      pV! 4       p\
        P                  ! V 4      ;_uu_ 4        V P                  S4      ;_uu_ 4        \        P                  ! \        V P                  V\        P                  RR/R7       RRR4       RRR4       V P                  VP                  4       K  	  R#   + '       g   i     L9; i  + '       g   i     LD; i)c                   2   <a  ] tR tRt o RtV3R ltRtV tR# )8WriteTest.test_open_nonwritable_fileobj.<locals>.BadFilei|  Tc                >   < V P                   '       d
   R V n         ShR# )FNfirst)r#   r   exctypes   &&r   rV  >WriteTest.test_open_nonwritable_fileobj.<locals>.BadFile.write~  s    zzz%*
% "r   r  N)r'   r(   r)   r*   r  rV  r3   r4   )r6   r  s   @r   BadFiler  |  s     & &r   r  nonr  )ry  r   r  N)r  EOFErrorRuntimeErrorr,   r   r   check_no_resource_warningrM  r/   r.   r   r$   r'  r.  rp  )r#   r  r  r  s   &  @r   test_open_nonwritable_fileobj'WriteTest.test_open_nonwritable_fileobjz  s    ,6G&"** & 	A99$??!!'**Wdii$+$6$6*/)9; + @ QXX&! 7 +* @?s$   C/1:C+C/C,'C//C?c           	     X   \         P                  ! \        V P                  4      ;_uu_ 4       pVP	                  \
        4      pV P                  \        4      ;_uu_ 4        VP                  V4       R R R 4       R R R 4       R #   + '       g   i     L; i  + '       g   i     R # ; ir   )	r/   r.   r   r$   rF  r+   rM  r  r^  r  s   &  r   test_missing_fileobjWriteTest.test_missing_fileobj  sd    \\'499--nnW-G"":..G$ / .-.. .--s#   3B!B	3BBBB)	r&   NF)r'   r(   r)   r*   r    r=  rC  rG  rL  rW  r[  r   r   r   r}   rc  r	   r  rg  rl  rx  r  r  r  r  r  r  r  r3   r4   r5   s   @r   r9  r9  S  s     F($ "",	. V,:<#<#, ""# ##$"&PH: ""& #&4F"1"'&% %r   r9  c                       ] tR tRtRtR# )GzipWriteTesti  r&   Nr   r&   r   r   r  r    r   r   r  c                       ] tR tRtRtR# )Bz2WriteTesti  r&   Nr   r&   r   r   r  r    r   r   r  c                       ] tR tRtRtR# )LzmaWriteTesti  r&   Nr   r&   r   r   r  r    r   r   r  c                       ] tR tRtRtR# )ZstdWriteTesti  r&   Nr   r&   r   r   r  r    r   r   r  c                     a  ] tR tRt o RtRtR t]P                  ! ]	P                  R8g  ;'       d
    ]! ]R4      R4      ]P                  ! ]P                  ;'       g    ]P                   R4      R	 4       4       tR
tV tR# )StreamWriteTesti  w|Nc                   \         P                  ! \        V P                  4      pVP	                  4        V P
                  '       dp   V P                  4       p\        \        R 4      ;_uu_ 4       pVP                  4       pRRR4       VP                  X4      pV P                  VP                  R4       M6V P                  \        4      ;_uu_ 4       pVP                  4       pRRR4       V P                  XP                  R4      \         P                  R4       R#   + '       g   i     L; i  + '       g   i     LU; i)r   Nzfound trailing datarS  zincorrect zero padding)r/   r.   r   r$   r]   decompressorrm   
decompressr.  unused_datarn   countr4  )r#   rY   decrt   r   s   &    r   test_stream_padding#StreamWriteTest.test_stream_padding  s    ll7DII.		##%Cgt$$yy{ %>>$'DS__.CD7##tyy{ $E*G,>,>0	2 %$
 $#s   0DD2D/	2E	r  umaskzMissing umask implementationz$Emscripten's/WASI's umask is a stub.c                   \         P                  P                  \        4      '       d   \        P
                  ! \        4       \         P                  ! ^4      p \        P                  ! \        V P                  4      pVP                  4        \         P                  ! \        4      P                  R,          pV P                  VRR4       \         P                  ! V4       R#   \         P                  ! T4       i ; i)   r  i  zwrong file permissionsN)r}   r~   existsr   r	   r  r  r/   r.   r$   r]   r  r  rn   )r#   original_umaskrY   r$   s   &   r   test_file_modeStreamWriteTest.test_file_mode  s     77>>'""W%%	%,,w		2CIIK777#++e3DT5*BCHH^$BHH^$s   A3C& &C>r&   )r'   r(   r)   r*   r    r  r  r   r   r   r  r   r}   r  r   is_emscriptenis_wasir  r3   r4   r5   s   @r   r  r    sy     FL2  0IIWR5I79__00.%	9%r   r  c                   &   a  ] tR tRt o R tRtV tR# )GzipStreamWriteTesti  c                   \         P                  ! \        V P                  4      P	                  4        \
        P                  ! \        4      P                  RR7      p\        P                  P                  \        4      V9  g   Q hR# )zN
Ensure the source directory is not included in the tar header
per bpo-41316.
zlatin-1r  N)r/   r.   r   r$   r]   r  r  	read_textr}   r~   dirname)r#   payloads   & r    test_source_directory_not_leaked4GzipStreamWriteTest.test_source_directory_not_leaked  sV    
 	Wdii(..0,,w'1191Ewww'w666r   r&   N)r'   r(   r)   r*   r  r3   r4   r5   s   @r   r  r    s     7 7r   r  c                   B    ] tR tRt]'       d   ]P
                  MRtRtR# )Bz2StreamWriteTesti  Nr&   )r'   r(   r)   r*   r@   BZ2Decompressorr  r3   r&   r   r   r  r    s    *-3&&4Lr   r  c                   B    ] tR tRt]'       d   ]P
                  MRtRtR# )LzmaStreamWriteTesti  Nr&   )r'   r(   r)   r*   rH   LZMADecompressorr  r3   r&   r   r   r  r        ,04((dLr   r  c                   B    ] tR tRt]'       d   ]P
                  MRtRtR# )ZstdStreamWriteTesti  Nr&   )r'   r(   r)   r*   r   ZstdDecompressorr  r3   r&   r   r   r  r    r  r   r  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )_CompressedWriteTesti  c                R   \         P                  ! 4       p\        P                  ! \        V P
                  VVR 7      ;_uu_ 4       pVP                  \        P                  ! R4      \         P                  ! V P                  4      4       RRR4       V#   + '       g   i     T# ; i)rr  rQ  N)	r,   r   r/   r.   r   r$   r^  rW  r  )r#   rs  rt   tarfls   &&  r   _compressed_tar$_CompressedWriteTest._compressed_tar  sp    zz|\\'499d(57 7:?MM'//%0"**T[[2IJ7 7 7 s   ABB&	c                    V P                  V4      pV P                  VP                  4       R ,          RV,          4       R# ):r   
   Ns   BZh%d1AY&SYNr  rn   r   r#   rs  rt   s   && r   _test_bz2_header%_CompressedWriteTest._test_bz2_header  s5    ##M2.'-7	9r   c                v    V P                  V4      pV P                  VP                  4       R ,          R4       R# ):N   Ns   Nr  r  s   && r   _test_gz_header$_CompressedWriteTest._test_gz_header  s-    ##M2,o>r   r&   NsF   And we move to Bristol where they have a special, Very Silly candidate)
r'   r(   r)   r*   r  r  r  r  r3   r4   r5   s   @r   r  r    s      &F9
? ?r   r  c                   *   a  ] tR tRt o RtR tRtV tR# )Bz2CompressWriteTesti  r]  c                l    V P                  ^4       V P                  ^4       V P                  ^	4       R# r  Nr  r"   s   &r   test_compression_levels,Bz2CompressWriteTest.test_compression_levels  ,    a a a r   r&   Nr'   r(   r)   r*   r    r  r3   r4   r5   s   @r   r  r    s     F! !r   r  c                   *   a  ] tR tRt o RtR tRtV tR# )Bz2CompressStreamWriteTesti  r  c                l    V P                  ^4       V P                  ^4       V P                  ^	4       R# r  r  r"   s   &r   r  2Bz2CompressStreamWriteTest.test_compression_levels  r  r   r&   Nr  r5   s   @r   r  r    s     F! !r   r  c                   *   a  ] tR tRt o RtR tRtV tR# )GzCompressWriteTesti  r]  c                l    V P                  ^4       V P                  ^4       V P                  ^	4       R# r  r  r"   s   &r   r  +GzCompressWriteTest.test_compression_levels  ,    QQQr   r&   Nr  r5   s   @r   r  r    s     F   r   r  c                   *   a  ] tR tRt o RtR tRtV tR# )GzCompressStreamWriteTesti  r  c                l    V P                  ^4       V P                  ^4       V P                  ^	4       R# r  r  r"   s   &r   r  1GzCompressStreamWriteTest.test_compression_levels  r  r   r&   Nr  r5   s   @r   r  r    s     F   r   r  c                   T   a  ] tR tRt o R t]P                  ! 4       R 4       tRtV t	R# )CompressLevelRaisesi  c           	         ^p\         P                  ! 4       pV P                  \        4      ;_uu_ 4        \        P
                  ! \        RW!R7       RRR4       R#   + '       g   i     R# ; i)   r]  rr  N)r,   r   rM  rv  r/   r.   r   r  s   &  r   test_compresslevel_wrong_modes2CompressLevelRaises.test_compresslevel_wrong_modes  sB    zz|y))LL$J *)))s   AA.	c           	     <   \         P                  ! 4       pV P                  \        4      ;_uu_ 4        \        P
                  ! \        R V^ R7       RRR4       V P                  \        4      ;_uu_ 4        \        P
                  ! \        R V^
R7       RRR4       V P                  \        4      ;_uu_ 4        \        P
                  ! \        RV^
R7       RRR4       R#   + '       g   i     L; i  + '       g   i     Li; i  + '       g   i     R# ; i)zw:bz2rr  Nzw|bz2)r,   r   rM  r  r/   r.   r   r1  s   & r   test_wrong_compresslevels-CompressLevelRaises.test_wrong_compresslevels  s     zz|z**LL'4qA +z**LL'4rB +z**LL'4rB +*	 +******s#   C$7C7;D
$C4	7D	
D	r&   N)
r'   r(   r)   r*   r  r   requires_bz2r  r3   r4   r5   s   @r   r  r    s*     K C Cr   r  c                   p   a  ] tR tRt o R tRR ltRR ltR tR tR t	R	 t
R
 tR tR tR tR tRtV tR# )GNUWriteTesti'  c                F    \        V4      R ,          ^,           pVR ,          # r   )ro   )r#   r   blockss   && r   _lengthGNUWriteTest._length+  s    Q3"|r   Nc                
   R p\        V4      \        P                  8  d!   VR ,          pW0P                  V4      ,          pVe?   \        V4      \        P                  8  d!   VR ,          pW0P                  V4      ,          pV# r  )ro   r/   LENGTH_NAMEr  LENGTH_LINK)r#   r   r  r  s   &&& r   
_calc_sizeGNUWriteTest._calc_size/  si    t9w***SLE\\$''ED	G,?,? ?SLE\\$''Er   c                   \         P                  ! V4      pV'       d   W#n        \         P                  Vn        \         P
                  ! \        R 4      p \         P                  Vn        VP                  V4       V P                  W4      pVP                  pV P                  WVR4       VP                  4        \         P
                  ! \        4      p VP                  4       pV P                  VR4       V P                  VP                   VP                   R4       V P                  VP                  VP                  R4       VP                  4        R#   TP                  4        i ; i  TP                  4        i ; i)r   z%GNU longname/longlink creation failedzunable to read longname memberN)r/   rW  r  LNKTYPEr  r.   r   r  r   r^  r  r  rn   r]   r`  r7  r   )r#   r   r  rs   rY   r>  r?  members   &&&     r   _testGNUWriteTest._test=  s   //$'#"??GLll7C(	 ++CJKK ,BBR%LMIIKll7#		XXZF  46W\\6;;46W--v46 IIK IIK IIKs   AE A0E- E*-E?c                (    V P                  R4       R# )longnam/N  longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnamr  r"   s   &r   test_longname_1023GNUWriteTest.test_longname_1023Z  s    

12r   c                (    V P                  R4       R# )r  N   longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnamer  r"   s   &r   test_longname_1024GNUWriteTest.test_longname_1024]  s    

23r   c                (    V P                  R4       R# )r  N  longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longnam/longname_r  r"   s   &r   test_longname_1025GNUWriteTest.test_longname_1025`  s    

34r   c                *    V P                  R R4       R# )r   N  longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnkr  r"   s   &r   test_longlink_1023GNUWriteTest.test_longlink_1023c  s    

69:r   c                *    V P                  R R4       R# )r   N   longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlinkr  r"   s   &r   test_longlink_1024GNUWriteTest.test_longlink_1024f  s    

6:;r   c                *    V P                  R R4       R# )r   N  longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlink_r  r"   s   &r   test_longlink_1025GNUWriteTest.test_longlink_1025i  s    

6;<r   c                *    V P                  RR4       R# )r  Nr  r+  r  r"   s   &r   test_longnamelink_1023#GNUWriteTest.test_longnamelink_1023l  s    

11	3r   c                *    V P                  RR4       R# )r  Nr#  r/  r  r"   s   &r   test_longnamelink_1024#GNUWriteTest.test_longnamelink_1024p  s    

22	4r   c                *    V P                  RR4       R# )r  Nr'  r3  r  r"   s   &r   test_longnamelink_1025#GNUWriteTest.test_longnamelink_1025t  s    

33	5r   r&   r   )r'   r(   r)   r*   r  r  r  r   r$  r(  r,  r0  r4  r7  r:  r=  r3   r4   r5   s   @r   r  r  '  sF     :345;<=345 5r   r  c                   *   a  ] tR tRt o RtR tRtV tR# )DeviceHeaderTestiy  r]  c                p   \         P                  P                  \        R 4      p\         P                  ! V4        \
        P                  ! \        V P                  4      p \
        P                  ! RR7      p\
        P                  ! RR7      p\
        P                  Vn        \
        P                  Vn        VP                  V4       VP                  V4       VP                  4        \
        P                  ! \        R4      p VP                  R4      pVP                  R4      pVP                  4        V P!                  VP"                  ^ 4       V P!                  VP$                  ^ 4       V P!                  VP"                  ^ 4       V P!                  VP$                  ^ 4       \        \        R4      ;_uu_ 4       pVP'                  4       pRRR4       XVP(                  VP*                   p	WP(                  VP*                   p
\-        RR4      pV P!                  W,          R	4       V P!                  W,          R
4       \.        P0                  ! V4       R#   TP                  4        i ; i  TP                  4        i ; i  + '       g   i     L; i  \.        P0                  ! T4       i ; i)device_header_testmy_block_devicer   my_regular_filerz   r   NiI  iY  s   0000000 0000000 s                   )r}   r~   r   r|   r   r/   r.   r   r$   rW  BLKTYPEr  REGTYPEr^  r]   rk   rn   r  r  rm   r  offset_dataslicer	   r  )r#   rw  rY   	input_blk	input_reg
output_blk
output_reginfiler-  buf_blkbuf_regdevice_headerss   &           r   *test_headers_written_only_for_device_files;DeviceHeaderTest.test_headers_written_only_for_device_files}  s   '',,w(<=
#	&,,w		2C#OO1BC	#OO1BC	!(	!(	I&I&		 ,,w,C ]]+<=
 ]]+<=
		Z00!4Z00!4Z00!4Z00!4 gt$$kkm %*++J,B,BCG++J,B,BCG #31NW46FGW4jAW%3 		 		 %$ W%sV   %J "A:I  +J "I5 *BJ J
A5J  I22J 5JJ 
J	J J5r&   N)r'   r(   r)   r*   r    rR  r3   r4   r5   s   @r   r@  r@  y  s     F'& '&r   r@  c                      a  ] tR tRt o Rt]P                  P                  ]R4      t	R t
]R 4       t]R 4       tR tR tR	 tR
 tR tR tRtV tR# )
CreateTesti  zx:
spameggs42c                :    \         P                  ! \        4       R # r   )r	   r  r   r"   s   &r   rZ   CreateTest.setUp  s    !r   c                    \        V P                  R 4      ;_uu_ 4       pVP                  R4       RRR4       R#   + '       g   i     R# ; i)r-  r@  N)r.   	file_pathrV  )clsrt   s   & r   
setUpClassCreateTest.setUpClass  s0    #--&&$JJv '&&&	   ;A	c                F    \         P                  ! V P                  4       R # r   )r	   r  rZ  r[  s   &r   tearDownClassCreateTest.tearDownClass  s    'r   c                   \         P                  ! \        V P                  4      ;_uu_ 4       pVP	                  V P
                  4       R R R 4       V P                  \        4      ;_uu_ 4       pVP                  4       pR R R 4       V P                  \        X4      ^4       V P                  RV^ ,          4       R #   + '       g   i     L|; i  + '       g   i     LY; iNrV  )r/   r.   r   r$   r   rZ  r1   r?  rn   ro   r  r#   tobjnamess   &  r   test_createCreateTest.test_create  s    \\'499--HHT^^$ . \\'""dMMOE #UQ'lE!H- .- #"s   B>/C>C	C!	c                   \         P                  ! \        V P                  4      ;_uu_ 4       pVP	                  V P
                  4       R R R 4       V P                  \        4      ;_uu_ 4        \         P                  ! \        V P                  4      pR R R 4       V P                  \        4      ;_uu_ 4       pVP                  4       pR R R 4       V P                  \        X4      ^4       V P                  RV^ ,          4       R #   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Ll; ird  )r/   r.   r   r$   r   rZ  rM  FileExistsErrorr1   r?  rn   ro   r  re  s   &  r   test_create_existingCreateTest.test_create_existing  s    \\'499--HHT^^$ . //<<3D 0 \\'""dMMOE #UQ'lE!H- .- 0/ #"s#   D	/&D:D/	D	D,	/D?	c                   V P                  \        R 4      ;_uu_ 4       pVP                  V P                  4       RRR4       V P                  \        4      ;_uu_ 4       pVP	                  4       pRRR4       V P                  \        X4      ^4       V P                  RV^ ,          4       R#   + '       g   i     L|; i  + '       g   i     LY; ixNrV  )r1   r   r   rZ  r?  rn   ro   r  re  s   &  r   test_create_taropenCreateTest.test_create_taropen  s    \\'3''4HHT^^$ ( \\'""dMMOE #UQ'lE!H- (' #"s   B/ C/B?	C	c           	        V P                  \        R 4      ;_uu_ 4       pVP                  V P                  4       RRR4       V P	                  \
        4      ;_uu_ 4        V P                  \        R 4      ;_uu_ 4         RRR4       RRR4       V P                  \        4      ;_uu_ 4       pVP                  4       pRRR4       V P                  \        X4      ^4       V P                  RV^ ,          4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; iro  )
r1   r   r   rZ  rM  rk  r?  rn   ro   r  re  s   &  r   test_create_existing_taropen'CreateTest.test_create_existing_taropen  s    \\'3''4HHT^^$ ( //gs++ , 0 \\'""dMMOE #UQ'lE!H- (' ,+ 0/ #"s;   C= D#?D	D#.D6=D	D D##D3	6E	c                Z   \         P                  ! \        P                  ! \        4      V P
                  4      ;_uu_ 4       pV P                  VP                  \        4       V P                  VP                  \        P                  P                  \        4      4       VP                  \        P                  ! V P                  4      4       VP                  4       pR R R 4       V P                  \!        X4      ^4       V P#                  RV^ ,          4       V P%                  \        4      ;_uu_ 4       pVP                  4       pR R R 4       V P                  \!        V4      ^4       V P#                  RV^ ,          4       R #   + '       g   i     L; i  + '       g   i     LY; ird  )r/   r.   r	   r0  r   r$   rz  r   r{  rn   r}   r~   r|  r   rZ  r?  ro   r  r1   re  s   &  r   test_create_pathlike_name$CreateTest.test_create_pathlike_name  s   \\),,W5tyyAAT!!$))S1TYY(@AHHY''78MMOE	 B
 	UQ'lE!H-\\'""dMMOE #UQ'lE!H- BA #"s   BF8FF	F*	c                <   V P                  \        P                  ! \        4      R 4      ;_uu_ 4       pV P	                  VP
                  \        4       V P                  VP
                  \        P                  P                  \        4      4       VP                  \        P                  ! V P                  4      4       VP                  4       pRRR4       V P                  \        X4      ^4       V P                  RV^ ,          4       V P                  \        4      ;_uu_ 4       pVP                  4       pRRR4       V P                  \        V4      ^4       V P                  RV^ ,          4       R#   + '       g   i     L; i  + '       g   i     LY; iro  )r1   r	   r0  r   rz  r   r{  rn   r}   r~   r|  r   rZ  r?  ro   r  re  s   &  r   !test_create_taropen_pathlike_name,CreateTest.test_create_taropen_pathlike_name  s   \\),,W5s;;t!!$))S1TYY(@AHHY''78MMOE	 <
 	UQ'lE!H-\\'""dMMOE #UQ'lE!H- <; #"s   BE8)F8F	F	r&   N)r'   r(   r)   r*   r    r}   r~   r   r|   rZ  rZ   classmethodr\  ra  rh  rl  rq  rt  rw  rz  r3   r4   r5   s   @r   rU  rU    sn     FWl3I"   ( (.
..... .r   rU  c                   &   a  ] tR tRt o R tRtV tR# )GzipCreateTesti  c                X   \         P                  ! \        V P                  ^R7      ;_uu_ 4       pVP	                  V P
                  4       RRR4       \         P                  ! \        R^R7      ;_uu_ 4       p RRR4       R#   + '       g   i     LA; i  + '       g   i     R# ; i)r  rr  Nzr:gzr/   r.   r   r$   r   rZ  r#   rf  s   & r   test_create_with_compresslevel-GzipCreateTest.test_create_with_compresslevel  sc    \\'499A>>$HHT^^$ ?\\'6;;t <; ?>;;;   B9BB	B)	r&   Nr'   r(   r)   r*   r  r3   r4   r5   s   @r   r~  r~          r   r~  c                   &   a  ] tR tRt o R tRtV tR# )Bz2CreateTesti
  c                X   \         P                  ! \        V P                  ^R7      ;_uu_ 4       pVP	                  V P
                  4       RRR4       \         P                  ! \        R^R7      ;_uu_ 4       p RRR4       R#   + '       g   i     LA; i  + '       g   i     R# ; i)r  rr  Nr:bz2r  r  s   & r   r  ,Bz2CreateTest.test_create_with_compresslevel  sc    \\'499A>>$HHT^^$ ?\\'7!<< =< ?><<<r  r&   Nr  r5   s   @r   r  r  
  r  r   r  c                   &   a  ] tR tRt o R tRtV tR# )LzmaCreateTesti  c                    \         P                  ! \        V P                  ^R7      ;_uu_ 4       pVP	                  V P
                  4       RRR4       R#   + '       g   i     R# ; i)r  )presetNr  r  s   & r   test_create_with_preset&LzmaCreateTest.test_create_with_preset  s:    \\'499Q774HHT^^$ 8777   AA'	r&   N)r'   r(   r)   r*   r  r3   r4   r5   s   @r   r  r         % %r   r  c                   &   a  ] tR tRt o R tRtV tR# )ZstdCreateTesti  c                    \         P                  ! \        V P                  ^R7      ;_uu_ 4       pVP	                  V P
                  4       RRR4       R#   + '       g   i     R# ; i)r  )levelNr  r  s   & r   test_create_with_level%ZstdCreateTest.test_create_with_level   s:    \\'499A66$HHT^^$ 7666r  r&   N)r'   r(   r)   r*   r  r3   r4   r5   s   @r   r  r    r  r   r  c                   "    ] tR tRtRtRtRtRtR# )CreateWithXModeTesti$  rp  Nr&   )r'   r(   r)   r*   r    rq  rt  r3   r&   r   r   r  r  $  s    F#' r   r  r  r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	HardlinkTesti,  c                   \         P                  P                  \        R 4      V n        \         P                  P                  \        R4      V n        \        V P                  R4      ;_uu_ 4       pVP                  R4       RRR4        \         P                  ! V P                  V P
                  4       \        P                  ! \        R4      V n        V P                  P                  V P                  4       R#   + '       g   i     L; i  \         d#   pT P                  RT,          4        Rp?LRp?ii ; i)rQ  r   r-     fooNr_  r   )r}   r~   r   r|   rQ  r   r.   rV  r  r`  ra  r/   r   rY   r   )r#   rt   r[  s   &  r   rZ   HardlinkTest.setUp0  s    77<</77<</$((D!!TJJv "	/GGDHHdhh' <<-TXX "!
  	/MM/A-..	/s$   1C>+D >D	D>D99D>c                    V P                   P                  4        \        P                  ! V P                  4       \        P                  ! V P
                  4       R # r   )rY   r]   r	   r  rQ  r   r"   s   &r   r^   HardlinkTest.tearDown?  s4    ""r   c                    V P                   P                  V P                  4      pV P                  VP                  \
        P                  R 4       R# )zadd file as regular failedN)rY   rF  rQ  rn   r  r/   rG  r  s   & r   test_add_twiceHardlinkTest.test_add_twiceD  s9     ((%%dhh/w,	.r   c                    V P                   P                  V P                  4      pV P                  VP                  \
        P                  R 4       R# )zadd file as hardlink failedN)rY   rF  r   rn   r  r/   r  r  s   & r   test_add_hardlinkHardlinkTest.test_add_hardlinkK  s7    ((%%dhh/w-	/r   c                    R V P                   n        V P                   P                  V P                  4      pV P	                  VP
                  \        P                  R4       R# )Tzdereferencing hardlink failedN)rY   dereferencerF  r   rn   r  r/   rG  r  s   & r   test_dereference_hardlink&HardlinkTest.test_dereference_hardlinkP  sC    #((%%dhh/w/	1r   )r   rQ  rY   N)r'   r(   r)   r*   rZ   r^   r  r  r  r3   r4   r5   s   @r   r  r  ,  s#     #
./
1 1r   r  c                   <   a  ] tR tRt o RR ltR tR tR tRtV t	R# )	PaxWriteTestiW  Nc                   \         P                  ! V4      pV'       d   W#n        \         P                  Vn        \         P
                  ! \        R \         P                  R7      p VP                  V4       VP                  4        \         P
                  ! \        4      p V'       d5   VP                  4       ^ ,          P                  pV P                  W%R4       M3VP                  4       ^ ,          P                  pV P                  WR4       VP                  4        R#   TP                  4        i ; i  TP                  4        i ; i)r   r   zPAX longlink creation failedzPAX longname creation failedN)r/   rW  r  r  r  r.   r   r'  r^  r]   r  rn   r   )r#   r   r  rs   rY   lns   &&&    r   r  PaxWriteTest._testY  s    //$'#"??GLll7C0B0BC	KK IIKll7#	NN$Q'00  *HINN$Q',,  *HIIIK IIK IIKs   &D# "D8 *A'D8 #D58E
c           
        R RRRRRRRRR/p\         P                  ! \        R\         P                  VR	7      p VP	                  \         P
                  ! R4      4       VP                  4        \         P                  ! \        R
R7      p V P                  VP                  V4       V P                  VP                  4       ^ ,          P                  V4       VP                  P                  4        Fx  w  r4V P                  \        V4      \        4       V P                  \        V4      \        4       V\         P                  9   g   KZ   \         P                  V,          ! V4       Kz  	  VP                  4        R#   TP                  4        i ; i  \        \         3 d    T P#                  R4        K  i ; i  TP                  4        i ; i)rQ  r   r   0r  z1.23test   äöür   )r   r  rU   r  z"unable to convert pax header fieldN)r/   r.   r   r'  r^  rW  r]   rn   r  r  r  assertIsNotr  r  PAX_NUMBER_FIELDSrv  r  r   )r#   r  rY   keyvals   &    r   test_pax_global_header#PaxWriteTest.test_pax_global_headerq  sa   us( ll7C0B0B')	KK/0IIK ll7[9	S__k:S^^-a0<<kJOO113  cE2  cE2'333H11#6s; 4 IIK# IIK &z2 H		"FGH IIKs<   %F B<F? F+F? F"F<8F? ;F<<F? ?Gc                   R RRR/p\         P                  ! \        R\         P                  RR7      p \         P                  ! 4       pRVn        R
Vn        Wn        VP                  V4       VP                  4        \         P                  ! \        RR7      p VP                  4       ^ ,          pV P                  VP                  V4       V P                  VP
                  R4       V P                  VP                  ^{4       VP                  4        R	#   TP                  4        i ; i  TP                  4        i ; i)r~   rQ  r   123r   rU   r%  r  r  N   )r/   r.   r   r'  rW  r   r   r  r^  r]   r  rn   )r#   r  rY   ra  s   &   r   test_pax_extended_header%PaxWriteTest.test_pax_extended_header  s     ueU3ll7C0B0B$/1	!A#AFAE'MKKNIIKll7[9	 #AQ]]K8QVVU+QUUC(IIK IIK IIKs   :D A+D- D*-D?c                l   \         P                  ! 4       pR Vn        RVn        ^dVn        ^{Vn        ^|Vn        VP                  4       pVP                  VRR7      pV P                  VR,          R 4       V P                  VR,          \        4       V P                  VR,          R4       V P                  VR,          ^d4       V P                  VR,          ^{4       V P                  VR	,          ^|4       V P                  VR
\        ^V4      ,           R,           \        ^d4      ,           R,           \        ^4      ,           R,           \        R4      ,           R,           \        ^a4      ,           R,           \        ^d4      ,           R,           \        ^4      ,           4       \         P                  ! 4       pRVn        RVn        RVn        RVn        RVn        VP                  4       pVP                  VRR7      pV P                  VR,          R4       V P                  VR,          ^ 4       V P                  VR,          ^ 4       V P                  VR,          ^ 4       V P                  VR	,          ^ 4       V P                  VR
\        ^V4      ,           R,           \        ^d4      ,           R,           \        ^4      ,           R,           R,           R,           \        R4      ,           R,           \        ^`4      ,           R,           \        ^d4      ,           R,           \        ^4      ,           4       R# )rQ  g@@rU   r  r   r  r  rp   r   r   s   ././@PaxHeaders9   0000000 0000000 0000000 00000000020 00000000000 010205  xs   ustar 00s   16 mtime=1000.1
i  r  s9   0000644 0000173 0000174 00000000144 00000001750 006516  0u   foo㍴s9   0000000 0000000 0000000 00000000130 00000000000 010207  xs   15 path=foo㍴
16 uid=16777216
s$   16 gid=16777217
20 size=10000000000
s   21 mtime=10000000000
i  s   foo?s9   0000644 0000000 0000000 00000000000 00000000000 006540  0Nl    d(	 r  i  )r/   rW  r   r  rp   r   r   r
  create_pax_headerrn   rz  r  r  )r#   ra  infor$  s   &   r   test_create_pax_header#PaxWriteTest.test_create_pax_header  s    OOzz|$$TK$@fu-d7mS1g-fs+ec*ec*b	)\]Cj)*+0:6 ## &+3Z0 399 <A9E ]	]
 Cj
 **
 -2#J7	8 OOzz|$$TK$@f{3g*fq)ea(ea(b	)\]Cj)*,1#J7 << 8	8
 ((
 */s4
 7>>
 AFb	J ]] Cj ** -2#J7	8r   r&   r   )
r'   r(   r)   r*   r  r  r  r  r3   r4   r5   s   @r   r  r  W  s     0@258 58r   r  c                   J   a  ] tR tRt o R tR tR tR tR tR t	R t
R	tV tR
# )UnicodeTesti  c                (    V P                  R 4       R# )rU   N_test_unicode_filenamer"   s   &r   test_iso8859_1_filename#UnicodeTest.test_iso8859_1_filename  s    ##K0r   c                (    V P                  R 4       R# )utf7Nr  r"   s   &r   test_utf7_filenameUnicodeTest.test_utf7_filename  s    ##F+r   c                (    V P                  R 4       R# )utf-8Nr  r"   s   &r   test_utf8_filenameUnicodeTest.test_utf8_filename  s    ##G,r   c                   \         P                  ! \        R V P                  VRR7      p RpVP	                  \         P
                  ! V4      4       VP                  4        \         P                  ! \        VR7      p V P                  VP                  4       ^ ,          P                  V4       VP                  4        R#   TP                  4        i ; i  TP                  4        i ; i)r   r  r   rW   errorsr  r  N)
r/   r.   r   r   r^  rW  r]   rn   r  r   )r#   rW   rY   r   s   &&  r   r  "UnicodeTest._test_unicode_filename  s    ll7C$,X?	!DKK-.IIKll7X6	S^^-a055t<IIK IIK IIKs   'C ?1C CC)c                |   \         P                  ! \        R V P                  RRR7      p \         P                  ! 4       pRVn        V P                  \        VP                  V4       RVn        RVn	        V P                  \        VP                  V4       VP                  4        R#   TP                  4        i ; i)r   r   r  r  r  rQ  N)r/   r.   r   r   rW  r   rM  UnicodeErrorr^  r  r]   r  s   &  r   test_unicode_filename_error'UnicodeTest.test_unicode_filename_error  s    ll7C$+H>
	oo'G)GLlCKKA GL*GMlCKKAIIKCIIKs   A,B) )B;c                   \         P                  ! \        R RRR7      p V F  pV P                  \	        VP
                  4      \        4       V P                  \	        VP                  4      \        4       V P                  \	        VP                  4      \        4       V P                  \	        VP                  4      \        4       K  	  VP                  4        R#   TP                  4        i ; i)rz   rU   r  rW   r  N)r/   r.   r+   rk  r  r   r{  r  r  r  r]   r  s   &  r   test_unicode_argument!UnicodeTest.test_unicode_argument	  s    ll7C$/B	d166lC0d1::.4d177mS1d177mS1	  IIKCIIKs   B-C C1c                J   \         P                  ! R 4      pRVn        RVn        \         P                  ! \
        RV P                  RR7      p VP                  V4       VP                  4        \         P                  ! \
        RR7      p VP                  R 4      pV P                  VP                  R4       V P                  VP                  R4       V P                  \         P                  8w  dv   VP                  4        \         P                  ! \
        RR7      pVP                  R 4      pV P                  VP                  R4       V P                  VP                  R4       VP                  4        R#   TP                  4        i ; i  TP                  4        i ; i)	rQ  r  r   rU   )r$   r   rW   r  r   u	   N)r/   rW  r  r  r.   r   r   r^  r]   rk   rn   r'  )r#   ra  rY   s   &  r   test_uname_unicodeUnicodeTest.test_uname_unicode	  s"   OOE"  ll7T[[$/1	KKNIIKll7[9	e$AQWWn5QWWn5{{g000		ll7W=MM%(  *>?  *>?IIK IIK IIKs   E; CF ;FF"r&   N)r'   r(   r)   r*   r  r  r  r  r  r  r  r3   r4   r5   s   @r   r  r    s-     1,-
 r   r  c                   |   a  ] tR tRt o ]P
                  tR tR tR t	R t
R tR tRR	 ltR
 tR tRR ltRtV tR# )UstarUnicodeTesti3	  c                    V P                  R4       V P                  R\        4       V P                  R4       V P                  R\        4       R# r;  Nr<  e01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890ud   01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567ÿue   012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678ÿ_test_ustar_namer  r"   s   &r   test_unicode_name1#UstarUnicodeTest.test_unicode_name1:	  B    /05zB?@@*Mr   c                T    V P                  R4       V P                  R\        4       R# r;  Nud   012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345ÿÿue   0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456ÿÿr  r"   s   &r   test_unicode_name2#UstarUnicodeTest.test_unicode_name2@	  "    ABBJOr   c                    V P                  R4       V P                  R\        4       V P                  R4       V P                  R\        4       R# )r;  Na   01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a   0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123/40123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u   012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012ÿ/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u  0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123ÿ/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789r  r"   s   &r   test_unicode_longname1'UstarUnicodeTest.test_unicode_longname1F	  sD    NONPZ[PQQS]^r   c                ^    V P                  R\        4       V P                  R\        4       R# )r;  Nu   01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901ÿ/20123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901ÿÿ/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789r  r"   s   &r   test_unicode_longname2'UstarUnicodeTest.test_unicode_longname2L	  s&    PR\]SU_`r   c                    V P                  R\        4       V P                  R4       V P                  R\        4       R# )r;  Nu  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901ÿÿ/20123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u   01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567ÿu  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678ÿr  r"   s   &r   test_unicode_longname3'UstarUnicodeTest.test_unicode_longname3P	  s5    TV`a^__aklr   c                T    V P                  R4       V P                  R\        4       R# )r;  Nu   01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345ÿÿu  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456ÿÿr  r"   s   &r   test_unicode_longname4'UstarUnicodeTest.test_unicode_longname4U	  s#    `aacmnr   Nc                   \         P                  ! \        R V P                  RR7      ;_uu_ 4       p\         P                  ! V4      pVf   VP                  V4       MV P                  W#P
                  V4       RRR4       VfU   \         P                  ! \        RRR7      ;_uu_ 4       pV F  pV P                  WP                  4        M	  RRR4       R# R#   + '       g   i     Lj; i  + '       g   i     R# ; i)r   r  r%  Nrz   r  )	r/   r.   r   r   rW  r^  rM  rn   r   r#   r   excrY   ra  s   &&&  r   r  !UstarUnicodeTest._test_ustar_nameY	  s    \\'3t{{WMMQT%A{A!!#{{A6 N ;gsW==A$$T662  >=  NM >==s   A	C+%C/C,	/D 	c                    V P                  R4       V P                  R\        4       V P                  R4       V P                  R\        4       R# r  _test_ustar_linkr  r"   s   &r   test_unicode_link1#UstarUnicodeTest.test_unicode_link1h	  r  r   c                T    V P                  R4       V P                  R\        4       R# r  r  r"   s   &r   test_unicode_link2#UstarUnicodeTest.test_unicode_link2n	  r  r   c                   \         P                  ! \        R V P                  RR7      ;_uu_ 4       p\         P                  ! R4      pWn        Vf   VP                  V4       MV P                  W#P                  V4       RRR4       VfU   \         P                  ! \        RRR7      ;_uu_ 4       pV F  pV P                  WP
                  4        M	  RRR4       R# R#   + '       g   i     Lj; i  + '       g   i     R# ; i)r   r  r%  rQ  Nrz   r  )	r/   r.   r   r   rW  r  r^  rM  rn   r  s   &&&  r   r  !UstarUnicodeTest._test_ustar_linkr	  s    \\'3t{{WMMQT&AJ{A!!#{{A6 N ;gsW==A$$T::6  >=  NM >==s   AC"1%C5"C2	5D	r&   r   )r'   r(   r)   r*   r/   r   r   r  r  r  r  r  r  r  r  r  r  r3   r4   r5   s   @r   r  r  3	  sO     !!F
NP_am
oNP r   r  c                   >   a  ] tR tRt o ]P
                  tR tRtV t	R# )GNUUnicodeTesti	  c                   R FE  w  r\         P                  ! \        VRR7      ;_uu_ 4       p VP                  V4      pRRR4       KG  	  R#   \         d    T P                  R4        L,i ; i  + '       g   i     K~  ; i)r  r   r  z%unable to read bad GNU tar pax headerN))r  u   pax/bad-pax-)rU   u   pax/bad-pax-äöür/   r.   r+   rk   r  r   r#   rW   r   rY   ra  s   &    r   test_bad_pax_header"GNUUnicodeTest.test_bad_pax_header	  s{    <NH g%68 8;>Gd+A8 8<   GIIEFG	8 8 8(   A0AA-	*A0,A-	-A00Br&   N)
r'   r(   r)   r*   r/   r  r   r  r3   r4   r5   s   @r   r  r  	  s     FG Gr   r  c                   B   a  ] tR tRt o ]P
                  tRtR tRt	V t
R# )PAXUnicodeTesti	  Nc                   R FE  w  r\         P                  ! \        VRR7      ;_uu_ 4       p VP                  V4      pRRR4       KG  	  R#   \         d    T P                  R4        L,i ; i  + '       g   i     K~  ; i)r  r   r  z)unable to read POSIX.1-2008 binary headerN))r  u   pax/hdrcharset-)rU   u   pax/hdrcharset-äöür  r  s   &    r   test_binary_header!PAXUnicodeTest.test_binary_header	  s{    ?NH g%68 8;>Kd+A8 8?   KIIIJK	8 8 8r  r&   )r'   r(   r)   r*   r/   r'  r   r  r  r3   r4   r5   s   @r   r  r  	  s$     F #'
K 
Kr   r  c                   6   a  ] tR tRt o R tRR ltR tRtV tR# )AppendTestBasei	  c                    \         V n        \        P                  P	                  V P                  4      '       d#   \
        P                  ! V P                  4       R # R # r   )r   r+   r}   r~   r  r	   r  r"   s   &r   rZ   AppendTestBase.setUp	  s7    77>>$,,''T\\* (r   c                   \         P                  ! \        R R7      ;_uu_ 4       pVP                  R4      pRVn        VP                  V4      ;_uu_ 4       p\         P                  ! V P                  V4      ;_uu_ 4       pVP                  W44       RRR4       RRR4       RRR4       R#   + '       g   i     L"; i  + '       g   i     L-; i  + '       g   i     R# ; i)rU   r  ri   rQ  N)r/   r.   r+   rk   r   rl   r^  )r#   r$   srcra  r  rY   s   &&    r   _create_testtarAppendTestBase._create_testtar	  s    \\'K88Co.AAF##q\\$,,55KK% 6 $ 98 65 $# 988s;   2C*C 	B-C 	C-B=8C 	 CCC$	c                    V P                  R V P                  ,           4       V P                  \        P                  \        P
                  \        R4       R# )r]  r   N)r"  r!   rM  r/   rA  r.   r   r"   s   &r   test_append_compressed%AppendTestBase.test_append_compressed	  s7    TDKK/0'++W\\7CHr   )r+   N)r]  )	r'   r(   r)   r*   rZ   r"  r%  r3   r4   r5   s   @r   r  r  	  s     +
&I Ir   r  c                      a  ] tR tRt o RtRR ltR.R3R ltR tR tR t	R	 t
R
 tR tR tR tR tR tR tRtV tR# )
AppendTesti	  Nc                    \         P                  ! V P                  R VR7      ;_uu_ 4       pVP                  \         P                  ! R4      4       RRR4       R#   + '       g   i     R# ; i)r   r_  r   N)r/   r.   r+   r^  rW  )r#   ry  rY   s   && r   _add_testfileAppendTest._add_testfile	  s?    \\$,,W==KK./ >===s   &AA-	r   c                    \         P                  ! V P                  VR 7      ;_uu_ 4       pV P                  VP	                  4       V4       RRR4       R#   + '       g   i     R# ; i)r_  N)r/   r.   r+   rn   r?  )r#   rg  ry  rY   s   &&& r   r  AppendTest._test	  s>    \\$,,88CS\\^U3 9888s   !AA'	c                F    V P                  4        V P                  4        R # r   )r*  r  r"   s   &r   test_non_existingAppendTest.test_non_existing	  s    

r   c                    \         P                  ! V P                  R 4      P                  4        V P	                  4        V P                  4        R# )r]  N)r/   r.   r+   r]   r*  r  r"   s   &r   
test_emptyAppendTest.test_empty	  s2    T\\4(..0

r   c                    \         P                  ! R4      pV P                  V4       VP                  ^ 4       V P	                  VR7       R# )rS  r_  Ns                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   )r,   r   r*  r   r  r1  s   & r   test_empty_fileobjAppendTest.test_empty_fileobj	  s7    zz,'4 		!

4
 r   c                T   V P                  4        \        V P                  R 4      ;_uu_ 4       pVP                  4       pRRR4       \        P
                  ! X4      pV P                  V4       VP                  ^ 4       V P                  RR.VR7       R#   + '       g   i     L_; i)r   NrQ  r   )rg  ry  )	r"  r.   r+   rm   r,   r   r*  r   r  r   s   &  r   test_fileobjAppendTest.test_fileobj	  su    $,,%%99;D &zz$4 		!

%
6 &%s   BB'	c                n    V P                  4        V P                  4        V P                  R R.R7       R# )rQ  r   )rg  N)r"  r*  r  r"   s   &r   test_existingAppendTest.test_existing	  s,    

%
(r   c                    \        V P                  R 4      ;_uu_ 4       pVP                  V4       RRR4       V P                  \        P
                  V P                  4       R#   + '       g   i     L<; irL  )r.   r+   rV  rM  r/   rA  r*  )r#   r   rt   s   && r   _test_errorAppendTest._test_error	  sK    $,,%%JJt &'++T-?-?@ &%s   A%%A5	c                (    V P                  R 4       R# )r   Nr>  r"   s   &r   	test_nullAppendTest.test_null	  s    r   c                (    V P                  R4       R# )rS  N                rA  r"   s   &r   test_incompleteAppendTest.test_incomplete	      $r   c                p    \         P                  ! R 4      P                  4       pV P                  V4       R# )rQ  Nr/   rW  rX  r>  r#   r   s   & r   test_premature_eofAppendTest.test_premature_eof	  s'    u%++-r   c                ~    \         P                  ! R 4      P                  4       pV P                  VR,           4       R# )rQ  NrE  rJ  rK  s   & r   test_trailing_garbage AppendTest.test_trailing_garbage	  s,    u%++-
*+r   c                (    V P                  R4       R# )rT  Ns   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarA  r"   s   &r   test_invalidAppendTest.test_invalid	  rH  r   r&   r   )r'   r(   r)   r*   r%  r*  r  r/  r2  r5  r8  r;  r>  rB  rF  rL  rO  rR  r3   r4   r5   s   @r   r(  r(  	  s[     !0 !'4 4
!7)A
%,% %r   r(  c                       ] tR tRtRtR# )GzipAppendTesti	  r&   Nr   r&   r   r   rU  rU  	  r   r   rU  c                       ] tR tRtRtR# )Bz2AppendTesti	  r&   Nr   r&   r   r   rW  rW  	  r   r   rW  c                       ] tR tRtRtR# )LzmaAppendTesti
  r&   Nr   r&   r   r   rY  rY  
  r   r   rY  c                       ] tR tRtRtR# )ZstdAppendTesti
  r&   Nr   r&   r   r   r[  r[  
  r   r   r[  c                   2   a  ] tR tRt o R tR tR tRtV tR# )
LimitsTesti
  c                   \         P                  ! R4      pVP                  \         P                  4       \         P                  ! R4      pV P	                  \
        VP                  \         P                  4       \         P                  ! R4      pVP                  \         P                  4       \         P                  ! R4      pV P	                  \
        VP                  \         P                  4       \         P                  ! R	4      pV P	                  \
        VP                  \         P                  4       \         P                  ! R4      pR	Vn        V P	                  \
        VP                  \         P                  4       \         P                  ! R4      pRVn        V P	                  \
        VP                  \         P                  4       R# )
r;  r  r       Nr<  r  a   123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longnamea   1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/1234567/longname   123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longname)r/   rW  rX  r   rM  r  r  r   r  s   & r   test_ustar_limitsLimitsTest.test_ustar_limits

  s4   //"34g**+ //"9:*gmmW5I5IJ //":;g**+ //">?*gmmW5I5IJ //";<*gmmW5I5IJ //*-4*gmmW5I5IJ //&) *gmmW5I5IJr   c                   \         P                  ! R4      pVP                  \         P                  4       \         P                  ! R4      pRVn        VP                  \         P                  4       \         P                  ! R4      pRVn        V P                  \        VP                  \         P                  4       R# z123/r  r   l          Nr`  )r/   rW  rX  r  r  r   rM  r  r  s   & r   test_gnu_limitsLimitsTest.test_gnu_limits)
  s~    //";<g(()//*-4g(() //&)+*gmmW5G5GHr   c                `   \         P                  ! R4      pVP                  \         P                  4       \         P                  ! R4      pRVn        VP                  \         P                  4       \         P                  ! R4      pRVn        VP                  \         P                  4       R# rd  )r/   rW  rX  r'  r  r   r  s   & r   test_pax_limitsLimitsTest.test_pax_limits6
  sr    //";<g(()//*-4g(()//&)+g(()r   r&   N)	r'   r(   r)   r*   ra  re  rh  r3   r4   r5   s   @r   r]  r]  
  s     K>I
* 
*r   r]  c                   
  a  ] tR tRt o R tR tR tR tR tR t	]
P                  ! ]P                  ! 4       R4      ]
P                  ! ]! ]R	4      R
4      ]
P                   P#                  R4      R 4       4       4       tRtV tR# )MiscTestiC
  c                J   V P                  \        P                  ! R ^RR4      R4       V P                  \        P                  ! R^RR4      R4       V P                  \        P                  ! RRR4      R 4       V P                  \        P                  ! RRR4      R 4       R# )rQ  r   r  s   foo     foobarr  s   foo bar N)rn   r/   stnntsr"   s   &r   test_char_fieldsMiscTest.test_char_fieldsE
  s    UAwA)	+Xq'8D	!%5wI	 ]GXF	 r   c                   V P                  \        P                  ! R 4      ^4       V P                  \        P                  ! R4      R4       V P                  \        P                  ! R4      R4       V P                  \        P                  ! R4      R4       V P                  \        P                  ! R4      R4       V P                  \        P                  ! R4      R4       V P                  \        P                  ! R	4      R4       V P                  \        P                  ! R
4      ^ 4       V P                  \        P                  ! R4      ^ 4       R# )   0000001    7777777            r_                            rS  s           Nr         )rn   r/   ntir"   s   &r   test_read_number_fields MiscTest.test_read_number_fieldsO
  s     	^4a8^4i@%HI#	%%HI#	%%HI	%HI	%HI+	- 	U+Q/\2A6r   c           	     &   V P                  \        P                  ! ^4      R4       V P                  \        P                  ! R4      R4       V P                  \        P                  ! R\        P                  R7      R4       V P                  \        P                  ! R\        P                  R7      R4       V P                  \        P                  ! R\        P                  R7      R	4       V P                  \        P                  ! R\        P                  R7      R
4       V P                  \        P                  ! R\        P                  R7      R4       V P                  \        P                  ! R\        P                  R7      R
4       V P                  \        P                  ! R\        P                  R7      R4       V P                  \        P                  ! \        P                  ! R\        P                  R7      4      ^ 4       R# )r  rs  ru  rt  r_  r  rv  rx  rw  ry  rz  r{  s         Nr  r|  r}  g      Yg      0Bg)rn   r/   itnr  r~  r"   s   &r   test_write_number_fields!MiscTest.test_write_number_fieldsc
  sa   Q8Y/@Z8J8JK<	>Z8J8JK<	>R0B0BC<	>T'2D2DE<	>%7,3,>,>@<	> 	VG4F4FG<	>]7;M;MN<	>W[[g>P>P%QRTUVr   c                    V P                  \        4      ;_uu_ 4        \        P                  ! R^\        P                  4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ! R^\        P                  4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ! R^\        P
                  4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  ! R^\        P
                  4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r  Nr_  l        r  l    )rM  r  r/   r  r   r  r"   s   &r   test_number_field_limits!MiscTest.test_number_field_limitsz
  s    z**KKAw334 +z**KK
Aw';';< +z**KK7+=+=> +z**KKq'*<*<= +* +********s/   'D3*'E6'E'E,3E	E	E)	,E=	c                    0 R kRkRkRkRkRkRkRkRkR	kR
kRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkR kR!kR"kR#kR$kR%kR&kR'kR(kR)kR*kR+kR,kR-kR.kp\         P                  ! V \        VR/7       R0# )1versiongrppwdsymlink_exceptionNULr5  r4  	GNU_MAGICPOSIX_MAGICr  r  LENGTH_PREFIXrG  AREGTYPEr  SYMTYPECHRTYPErF  r  FIFOTYPECONTTYPEr  GNUTYPE_LONGLINKGNUTYPE_SPARSEr,  XGLTYPESOLARIS_XHDTYPESUPPORTED_TYPESREGULAR_TYPES	GNU_TYPES
PAX_FIELDSPAX_NAME_FIELDSr  rn  ro  r~  r  calc_chksumscopyfileobjfilemodeEmptyHeaderErrorTruncatedHeaderErrorEOFHeaderErrorInvalidHeaderErrorSubsequentHeaderErrorExFileObjectmain)not_exportedN)r   check__all__r/   )r#   r  s   & r   test__all__MiscTest.test__all__
  s   ===#=%8=:?=AL==%='4=6C= = += -6= 8B= DM= 	= !	= #,	= .7	= 9C	= EO	=
 =
 !3=
 5E= = != #4= 6G= = )= +7= 9J=  = "'= ).= 05= 7<= >L= = &= (:= #= %5= 7K= $= &4= 6<= 	T7Fr   c           	     p   \         P                  P                  \         P                  P                  \        4      R R4      pV P                  \        P                  4      ;_uu_ 4       p\        P                  ! R4      3p\        P                  P                  P                  \        P                  RVR7      ;_uu_ 4        \        P                  ! V4       RRR4       RRR4       V P                  R\!        XP"                  4      4       R#   + '       g   i     L?; i  + '       g   i     LJ; i)r   r   zlzma module is not availablerJ   )r  Nz?
- method xz: CompressionError('lzma module is not available')
)r}   r~   r   r  __file__rM  r/   rA  CompressionErrorr   r  r  r  r0   r.   r  r{  	exception)r#   fnameexcinfor  s   &   r   .test_useful_error_message_when_modules_missing7MiscTest.test_useful_error_message_when_modules_missing
  s    RWW__X68IK[\w0011W,,-KLME$$++GOOXSX+YYU# Z 2
 	O!!"	
 ZY 21s%   *AD%D	D%D"D%%D5	zrequires symlink supportchmodzmissing os.chmodos.chmodc                  a \         P                  P                  \        R 4      oV3R lpW!n        \         P                  P                  \        R4      p\        4       ;_uu_ 4       pVP                  RRR7       VP                  R\        P                  RR7       VP                  RVR7       RRR4       \         P                  ! V4        XP                  4       P                  SR	R
7       \        P                  ! V4       \        P                  ! S4       R#   + '       g   i     Lv; i  \        P                  ! T4       \        P                  ! S4       i ; i)
test127987c                    < \         P                  P                  V 4      p\         P                  P                  VS.4      S8w  d   \	        R V4      hR# )z8should not try to chmod anything outside the destinationN)r}   r~   realpath
commonpath	Exception)r~   r$   r  target_pathrw  s   &&, r   mock_chmod_side_effectRMiscTest.test_deferred_directory_attributes_update.<locals>.mock_chmod_side_effect
  sH    ''**40Kww!!;"89WD Z\ghh Er   outside_tree_dirrp  r  
symlink_to
?rwsrwsrwtr  r$   NrY   r  )r}   r~   r   r|   r  ArchiveMakerr   r/   r  makedirsr.   r  r	   r  )r#   
mock_chmodr  r  arcrw  s   &&   @r   )test_deferred_directory_attributes_update2MiscTest.test_deferred_directory_attributes_update
  s    
 '',,w5	i "877<<1CD^^sGGCCG(GGCgooLGAGGC$4G5 
 	$%	&HHJ!!wu!=-.W% ^ -.W%s   (A	D!D2 D/	2.E r&   N)r'   r(   r)   r*   rp  r  r  r  r  r  r   r   r	   can_symlinkr   r}   r  r  r  r3   r4   r5   s   @r   rk  rk  C
  s      7(W.>G

 ..02LMW-/AB]]$& % C N&r   rk  c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )CommandLineTesti
  c                    \         P                  ! R R.VO5/ VB w  r4pVP                  \        P                  P                  4       R4      # )-mr/      
)r
   assert_python_okr>  r}   linesepr   )r#   argsr  rcr  errs   &*,   r   
tarfilecmdCommandLineTest.tarfilecmd
  sJ    $55dI @ @8>@{{2::,,.66r   c                4    \         P                  ! R R.VO5!  # )r  r/   )r
   assert_python_failure)r#   r  s   &*r   tarfilecmd_failure"CommandLineTest.tarfilecmd_failure
  s    224JTJJr   c           	        \         P                  ! R RR7      \         P                  ! RRR7      .pV P                  \        P                  V4       \
        P                  ! VR4      ;_uu_ 4       pV F3  pVP                  V\        P                  P                  V4      R7       K5  	  RRR4       R#   + '       g   i     R# ; i)tokenize_tests.txttokenizedatar   9tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txtr   r{  N)r   rf  r  r	   r  r/   r.   r   r}   r~   rp  )r#   tar_namefilesr  tardatas   &&   r   make_simple_tarfile#CommandLineTest.make_simple_tarfile
  s    !!"6)79!! #>)79:
 		(((3\\(C((B w(8(8(AB ! )(((s   0:B44C	c                   V P                  \        P                  V4       \        P                  ! VR 4      ;_uu_ 4       p\        P
                  ! R4      pVP                  V\        P                  ! R4      R7       \        P
                  ! R4      pVP                  V\        P                  ! R4      R7       RRR4       R#   + '       g   i     R# ; i)r   benignr   r_  ../evilN)	r  r	   r  r/   r.   rW  r^  r,   r   )r#   r  r  r  evils   &&   r   make_evil_tarfile!CommandLineTest.make_evil_tarfile
  s    	(((3\\(C((B__X.FJJvrzz#J7??9-DJJtRZZ_J5	 )(((s    A;CC	c                   V P                  4       w  rpV P                  VR 4       V P                  RVP                  4       4       V P                  RVP                  4       4       V P                  RVP                  4       4       V P                  RR4      w  rpV P                  VR 4       V P	                  VP                  4       R 4       R# )r   s   usages   errors   required-lr   N)r  rn   r  lowerr  strip)r#   r  r  r  s   &   r   test_bad_useCommandLineTest.test_bad_use
  s    ..0c"h		,h		,k399;/..tR8c"CIIK-r   c                x    \          F/  pR F&  pV P                  W!4      pV P                  VR4       K(  	  K1  	  R# )-tr   N)r  z--test)testtarnamesr  rn   r#   r  optr  s   &   r   test_test_command!CommandLineTest.test_test_command
  s4    $H%ooc4  c* & %r   c           	         \          F3  pR F*  pV P                  VRVRR7      pV P                  RV4       K,  	  K5  	  R# )-vr  r  PYTHONIOENCODINGs   is a tar archive.
Nr  z	--verbose)r  r  r  r  s   &   r   test_test_command_verbose)CommandLineTest.test_test_command_verbose
  sB    $H(ooc47> & @4c: ) %r   c           
     ^   \         P                  ! R RR7      pV P                  RV4      w  r#pV P                  RV4       V P	                  VR4       V P	                  V^4       \
         F  pV P                  VR7      ;_uu_ 4        \        VR4      ;_uu_ 4       pVP                  4       pRRR4        \        \        R	4      ;_uu_ 4       pVP                  XR
,          4       RRR4       V P                  R\        4      w  r#pV P	                  VR4       V P	                  V^4       \        P                  ! \        4        RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     L; i  \        P                  ! \        4       i ; i  + '       g   i     EKB  ; i)
zipdir.zipr   r   r      is not a tar archive.r   )r  r   Nr-  :Ni  N)r   rf  r  r  rn   r  r&  r.   rm   r   rV  r	   r  )r#   zipnamer  r  r  r  r  r   s   &       r   test_test_command_invalid_file.CommandLineTest.test_test_command_invalid_file
  s6   ""<8IJ..tW=/5c"Q$Hx00(D))Q668D *.gt,,T
+ -#'#:#:4#ILBS$$S#.$$R+$$W- 10 %)) -, $$W- 100sU   FE-F6E;E('AE;,FE% F(E83E;;F	FF,c           
        \          F  p\        P                  ! 4       ;_uu_ 4       p\        P                  ! VR 4      ;_uu_ 4       pVP                  RR7       RRR4       RRR4       XP                  4       P                  RR4      pR F'  pV P                  WQRR7      pV P                  Wd4       K)  	  K  	  R#   + '       g   i     Lk; i  + '       g   i     Lv; i)rz   Fr   Nr   r   r  )r  z--list
r  r   captured_stdoutr/   r.   r   r   r   r  rn   r#   r  ra  r  r  r  r  s   &      r   test_list_command!CommandLineTest.test_list_command  s    $H((**a\\(C00BGGEG* 1 + zz|**74FGH%ooc7> & @  / & %00 +*s#    CB=C=CCC c           
        \          F  p\        P                  ! 4       ;_uu_ 4       p\        P                  ! VR 4      ;_uu_ 4       pVP                  RR7       RRR4       RRR4       XP                  4       P                  RR4      pR F)  pV P                  VRVRR7      pV P                  Wd4       K+  	  K  	  R#   + '       g   i     Lm; i  + '       g   i     Lx; i)	rz   Tr   Nr   r   r  r  r  r  r  s   &      r   test_list_command_verbose)CommandLineTest.test_list_command_verbose  s    $H((**a\\(C00BGGDG) 1 + zz|**74FGH(ooc47> & @  / ) %00 +*s#    CB?C?C
CC"c                    \         P                  ! R RR7      pV P                  RV4      w  r#pV P                  RV4       V P	                  VR4       V P	                  V^4       R# )r   r   r   r  r  r   N)r   rf  r  r  rn   r#   r  r  r  r  s   &    r   test_list_command_invalid_file.CommandLineTest.test_list_command_invalid_file  sZ    ""<8IJ..tW=/5c"Qr   c                   \         P                  ! R RR7      \         P                  ! RRR7      .pR F  p V P                  ! V\        .VO5!  pV P	                  VR4       \
        P                  ! \        4      ;_uu_ 4       pVP                  4        RRR4       \        P                  ! \        4       K  	  R#   + '       g   i     L0; i  \        P                  ! \        4       i ; i)r  r  r   r  r   N)-cz--create)
r   rf  r  r   rn   r/   r.   r  r	   r  r#   r  r  r  rY   s   &    r   test_create_command#CommandLineTest.test_create_command  s    !!"6)79!! #>)79:
 $C*ooc7;U;  c*\\'**cNN$ +   ) $ +*   )s$   ACB=C=CCC,c                   \         P                  ! R RR7      \         P                  ! RRR7      .pR	 F  p V P                  ! VR\        .VO5RR/ pV P	                  RV4       \
        P                  ! \        4      ;_uu_ 4       pVP                  4        RRR4       \        P                  ! \        4       K  	  R#   + '       g   i     L0; i  \        P                  ! \        4       i ; i)
r  r  r   r  r  r  r  s    file created.Nr  )
r   rf  r  r   r  r/   r.   r  r	   r  r  s   &    r   test_create_command_verbose+CommandLineTest.test_create_command_verbose-  s    !!"6)79!! #>)79:
 %C*ooc4 @5 @7>@/5\\'**cNN$ +   ) %
 +*   )s$   ACC C CCC/c                   \         P                  ! R RR7      .p V P                  ! R\        .VO5!  pV P	                  VR4       \
        P                  ! \        4      ;_uu_ 4       pVP                  4        RRR4       \        P                  ! \        4       R#   + '       g   i     L,; i  \        P                  ! \        4       i ; i)r  r  r   r  r   N)
r   rf  r  dotlessnamern   r/   r.   r  r	   r  )r#   r  r  rY   s   &   r   $test_create_command_dotless_filename4CommandLineTest.test_create_command_dotless_filename=  s    !!"6~NO	*//$<e<CS#&k**c  + [) +* [)s$   AB0 (B9B0 B-	(B0 0Cc                   \         P                  P                  \        R 4      p\        P
                  ! RRR7      .p V P                  ! RV.VO5!  pV P                  VR4       \        P                  ! V4      ;_uu_ 4       pVP                  4        RRR4       \        P                  ! V4       R#   + '       g   i     L(; i  \        P                  ! T4       i ; i)z.testtarr  r  r   r  r   N)r}   r~   r   r|   r   rf  r  rn   r/   r.   r  r	   r  )r#   r  r  r  rY   s   &    r   (test_create_command_dot_started_filename8CommandLineTest.test_create_command_dot_started_filenameG  s    77<<4!!"6~NO	'//$959CS#&h''3  ( X& (' X&s$   AC B5C 5C	 C C c                   \         P                  ! R RR7      \         P                  ! RRR7      .p\        \        \        \
        3 F  pVP                  '       g   K   \        R,           VP                  ,           pV P                  ! RV.VO5!  pVP                  V4      ;_uu_ 4       pVP                  4        RRR4       \        P                  ! V4       K  	  R#   + '       g   i     L,; i  \        P                  ! X4       i ; i)r  r  r   r  r  r  N)r   rf  r8   r?   rE   rL   r.   r   r!   r  r1   r  r	   r  )r#   r  filetyper  r  rY   s   &     r   test_create_command_compressed.CommandLineTest.test_create_command_compressedR  s    !!"6)79!! #>)79:
 "7Hh?H===+"S=8??:oodH=u=%%h//3NN$ 0   * @ 0/   *s%   AC3+C <C3 C0+C33Dc                   V P                  \        4       R Fq  p \        P                  ! \        4      ;_uu_ 4        V P                  V\        4      pRRR4       V P                  XR4       \        P                  ! \        4       Ks  	  R#   + '       g   i     LB; i  \        P                  ! \        4       i ; i)-eNr   )r&  z	--extractr  r   r	   r   	tarextdirr  rn   r  r#   r  r  s   &  r   test_extract_command$CommandLineTest.test_extract_commandc  s{      )$C,''	22//#w7C 3  c*  + %22   +s"   "B"BB"BB""B>c           
        V P                  \        4       R Ft  p \        P                  ! \        4      ;_uu_ 4        V P                  VR\        RR7      pRRR4       V P                  RX4       \        P                  ! \        4       Kv  	  R#   + '       g   i     LB; i  \        P                  ! \        4       i ; i)r  r&  r  r  N    file is extracted.r  )r  r   r	   r   r(  r  r  r  r)  s   &  r   test_extract_command_verbose,CommandLineTest.test_extract_command_verbosem  s      )$C,''	22//#tW;B * DC 3 4c:  + %22
   +s"   "B%BB%B"B%%Cc                    V P                  \        4       \        P                  P	                  \
        R 4      p\        P                  ! \
        4        \        P                  ! V4      ;_uu_ 4        V P                  R\        RRR4       V P                  R\        RRRRR7      pV P                  RV4       R	R	R	4       \        P                  ! \
        4       R	#   + '       g   i     L,; i  \        P                  ! \
        4       i ; i)
destr&  r  z--filterr   r  r  r  r-  N)r  r   r}   r~   r   r(  r   r	   r   r  r  r  r  )r#   destdirr  s   &  r   test_extract_command_filter+CommandLineTest.test_extract_command_filterx  s    w' '',,y&1
	(##G,,''g(,(2F< oodG&*&0/7> & @ 4c: - Y' -, Y's%   C1 3AC:C1 C.	)C1 1Dc                r   V P                  \        4        \        P                  ! \        4      ;_uu_ 4        V P                  R \        R4      pRRR4       V P                  XR4       \        P                  ! \        4       R#   + '       g   i     L>; i  \        P                  ! \        4       i ; i)r&  spamdirNr   r'  )r#   r  s   & r   (test_extract_command_different_directory8CommandLineTest.test_extract_command_different_directory  su      )	(##I..oodGY? /S#&Y'	 /. Y's"   "B BB B	B B6c                H   \         P                  ! R RR7      p\        P                  ! \        4      ;_uu_ 4        V P                  RV4      w  r#pRRR4       V P                  RX4       V P                  XR4       V P                  X^4       R#   + '       g   i     LH; i)r   r   r   r&  Nr  r   )r   rf  r	   r   r(  r  r  rn   r  s   &    r   !test_extract_command_invalid_file1CommandLineTest.test_extract_command_invalid_file  sy    ""<8IJ	**224ALBS +/5c"Q	 +*s   BB!	r&   N)r'   r(   r)   r*   r  r  r  r  r  r  r  r  r	  r  r  r  r  r  r  r#  r*  r.  r3  r7  r:  r3   r4   r5   s   @r   r  r  
  su     7
K	C6.+;.(	0	0 ** *	'+",	,(&(   r   r  c                   D   a  ] tR tRt o R tR tR tR tR tR t	Rt
V tR	# )
ContextManagerTesti  c                    \         P                  ! \        4      ;_uu_ 4       pV P                  VP                  R 4       RRR4       V P                  XP                  R4       R#   + '       g   i     L.; i)zclosed inside runtime contextNcontext manager failed)r/   r.   r+   r.  rp  r6  rB  s   & r   
test_basicContextManagerTest.test_basic  sI    \\'""cSZZ)HI #

$<= #"s   A&&A6	c           	        \         P                  ! \        4      pVP                  4        V P	                  \
        4      ;_uu_ 4        V;_uu_ 4         R R R 4       R R R 4       R #   + '       g   i     L; i  + '       g   i     R # ; ir   )r/   r.   r+   r]   rM  r  rB  s   & r   test_closedContextManagerTest.test_closed  sS     ll7#		w''  (' (''s$   A:A'	A:'A72A::B	c           	     n   V P                  \        4      ;_uu_ 4       p\        P                  ! \        4      ;_uu_ 4       p\
        h  + '       g   i     M; i R R R 4       M  + '       g   i     M; iT P                  XP                  \
        R4       T P                  XP                  R4       R # )Nz)wrong exception raised in context managerr?  )
rM  r  r/   r.   r+   r  rz  r  r6  rp  )r#   r  rY   s   &  r   test_exception!ContextManagerTest.test_exception  su    y))Sg&&# '&& *))) 	cmmWI	K

$<=s   #A%A	AA%%A5	c                0    \         P                  ! \        R 4      ;_uu_ 4       p\        h  + '       g   i     M
; i    M; iT P	                  \
        P                  P                  \        4      ^ R4       T P                  XP                  R4       R# )r   Nz-context manager wrote an end-of-archive blockr?  )
r/   r.   r   r  rn   r}   r~   rB  r6  rp  rB  s   & r   test_no_eofContextManagerTest.test_no_eof  sg    	gs++s ,+	11?	A

$<=s   #? ,<	? ? Ac                    \         P                  ! \        R 4      ;_uu_ 4         RRR4       V P                  \        P
                  P                  \        4      ^ R4       R#   + '       g   i     LF; i)r   Nz-context manager wrote no end-of-archive block)r/   r.   r   r  r}   r~   rB  r"   s   &r   test_eofContextManagerTest.test_eof  sI     \\'3'' (BGGOOG4a?	A ('s   A$$A4	c           	     d   \        \        R 4      ;_uu_ 4       p \        P                   ! VRR7      ;_uu_ 4       p\        h  + '       g   i     M
; i    M; iT P	                  TP
                  R4       T P                  XP
                  R4       RRR4       R#   + '       g   i     R# ; i)r-  r   rx  Nzexternal file object was closedr?  )r.   r   r/   r  r.  rp  r6  r}  s   &  r   r8  ContextManagerTest.test_fileobj  sy     '4  D\\$S99S#O :9T[[*KLOOCJJ(@A !   s9   B AA	AABAA=BB/	r&   N)r'   r(   r)   r*   r@  rC  rF  rI  rL  r8  r3   r4   r5   s   @r   r=  r=    s+     >
>
>A
B 
Br   r=  zrequires os.link to be missingc                   N  a  ] tR tRt o R t]P                  ! ]! ]P                  R4      R4      R 4       t
]P                  ! ]! ]P                  R4      R4      R 4       t]P                  ! ]! ]R4      R4      R	 4       t]P                  ! ]! ]R4      R4      R
 4       tRtV tR# )LinkEmulationTesti  c                L   V P                   P                  V\        R R7       \        \        P
                  P                  \        V4      R4      ;_uu_ 4       pVP                  4       pRRR4       V P                  \        X4      \        4       R#   + '       g   i     L1; i)r  rx   r   N)rY   r{   r|   r.   r}   r~   r   rm   rn   r   rq   )r#   r   r  r   s   &&  r   _test_link_extraction'LinkEmulationTest._test_link_extraction  sf    w?"'',,w-t44668D 54.9 54s   BB#	islinkz3Skip emulation - has os.path.islink but not os.linkc                (    V P                  R 4       R# )r   NrS  r"   s   &r   test_hardlink_extraction1+LinkEmulationTest.test_hardlink_extraction1       	""?3r   c                (    V P                  R 4       R# )r   NrW  r"   s   &r   test_hardlink_extraction2+LinkEmulationTest.test_hardlink_extraction2       	""#>?r   rf  z Skip emulation if symlink existsc                (    V P                  R 4       R# )r   NrW  r"   s   &r   test_symlink_extraction1*LinkEmulationTest.test_symlink_extraction1  rZ  r   c                (    V P                  R 4       R# )r   NrW  r"   s   &r   test_symlink_extraction2*LinkEmulationTest.test_symlink_extraction2  r^  r   r&   N)r'   r(   r)   r*   rS  r   r  r   r}   r~   rX  r\  r`  rc  r3   r4   r5   s   @r   rQ  rQ    s     : __WRWWh/JL4L4 __WRWWh/JL@L@ __WR+79494 __WR+79@9@r   rQ  c                   2   a  ] tR tRt o R tR tR tRtV tR# )Bz2PartialReadTesti  c                p  a  ! V3R  lR\         P                  4      o\        P                  ! \        P
                  ! R4      P                  4       4      p\        \        V4      ^,           4       F%  p \        P                  ! S! VRV 4      VR7       K'  	  R#   \        P                   d     KC  i ; i)c                   H   <a a ] tR tRt oRtVV 3R ltVV 3R ltRtVtV ;t	# )9Bz2PartialReadTest._test_partial_input.<locals>.MyBytesIOi  Fc                   < V P                   '       d   \        R 4      hV P                  4       \        V P	                  4       4      8H  V n         \
        SV `  V4      # )z(infinite loop detected in tarfile.open())hit_eofAssertionErrorr   ro   r   superrm   )r#   r  	MyBytesIO	__class__s   &&r   rm   >Bz2PartialReadTest._test_partial_input.<locals>.MyBytesIO.read   sM    <<<( *: ; ;#yy{c$--/.BBY2155r   c                .   < R V n         \        SV `
  ! V!  # )F)rk  rm  r   )r#   r  rn  ro  s   &*r   r   >Bz2PartialReadTest._test_partial_input.<locals>.MyBytesIO.seek  s    $Y2D99r   )rk  )
r'   r(   r)   r*   rk  rm   r   r3   r4   __classcell__)ro  r6   rn  s   @@r   rn  ri    s     G6: :r   rn  rQ  Nrx  )r,   r   r@   compressr/   rW  rX  rangero   r.   rA  )r#   r$   r   rp  rn  s   &&  @r   _test_partial_input&Bz2PartialReadTest._test_partial_input  s    
	:

 
	: ||GOOE288:;s4y1}%AYtBQx%8tD & $$ s   5!BB54B5c                (    V P                  R 4       R# )rz   Nrv  r"   s   &r   test_partial_input%Bz2PartialReadTest.test_partial_input  s      %r   c                (    V P                  R 4       R# )r  Nry  r"   s   &r   test_partial_input_bz2)Bz2PartialReadTest.test_partial_input_bz2  s      )r   r&   N)	r'   r(   r)   r*   rv  rz  r}  r3   r4   r5   s   @r   rf  rf    s     (&* *r   rf  c                       ^ RI p ^ RIpT P                  ^ 4      ^ ,          R8w  d   R# TP	                  ^ 4      ^ ,          R8w  d   R# R#   \         d     R# i ; i)r   NFrootT)r  r  ImportErrorgetpwuidgetgrgid)r  r  s     r   root_is_uid_gid_0r    sS     ||AqV#
||AqV#  s   A
 
AAchownzmissing os.chowngeteuidzmissing os.geteuidc                     a  ] tR tRt o ]R 4       t]]R 4       4       t]P                  P                  R4      ]P                  P                  R4      ]P                  P                  R4      R 4       4       4       t]P                  P                  R4      ]P                  P                  R4      ]P                  P                  R4      R 4       4       4       t]P                  ! ]! 4       R	4      ]P                  P                  R4      ]P                  P                  R4      ]P                  P                  R4      R
 4       4       4       4       t]P                  P                  R4      R 4       tRtV tR# )NumericOwnerTesti$  c                   \         P                  ! R 4      pV ^c^b\        P                  V3V^M^L\        P                  R3V^X^W\        P                  V3.p\        P
                  ! \        R4      ;_uu_ 4       pV FN  w  rgrp
\        P                  ! V4      pW{n        Wn	        RVn
        RVn        Wn        VP                  W4       KP  	  RRR4       \        #   + '       g   i     \        # ; i)s   contentNr   r  )r,   r   r/   rG  r  r.   r   rW  r   r   r  r  r  r^  )
filename_1	dirname_1
filename_2rt   r  r  r   r   r   typcontentsra  s   &&&         r   _make_test_archive#NumericOwnerTest._make_test_archive-  s     zz*% b"goot<b"goot<b"goot< \\'3''516-3XOOD)  a* 27 (  (' s   8ACC0	c              #    "   ^ V n         RpRpTpTp\        P                  P                  W!4      p\        P                  VVV4      p\        P                  ! V4      ;_uu_ 4       pWsWE3x  RRR4       R#   + '       g   i     R# ; i5i)r   znumeric-owner-testfiler~  N)rQ  r}   r~   r   r  r  r/   r.   )mock_geteuidr  r  r  r  r  tar_filenamer  s   &       r   _setup_testNumericOwnerTest._setup_testE  s~      %&!( 
	WW\\'1
 (:::;D;EG \\,''5Y:: ('''s   A$B&A7-
B7B		Bzos.chownr  z
os.geteuidc           	        V P                  V4      ;_uu_ 4       w  rEppVP                  V\        R RR7       VP                  V\        R RR7       RRR4       \        P                  P                  \        X4      p\        P                  P                  \        X4      p	VP                  \        P                  P                  V^c^b4      \        P                  P                  V	^X^W4      .R R7       R#   + '       g   i     L; iTr  numeric_ownerry   N)	any_order)
r  r{   r|   r}   r~   r   assert_has_callsr   r  call)
r#   r  r  
mock_chownr  r  rM  r  f_filename_1f_filename_2s
   &&&&      r   test_extract_with_numeric_owner0NumericOwnerTest.test_extract_with_numeric_owner[  s    
 l++ 0<10:MM*gT!0  2MM*wd!0  2	 , ww||GZ8ww||GZ8##X]]%7%7b"%M%-]]%7%7b"%M%' /3 	$ 	4 ,+s   7C66D	c           	     f   V P                  V4      ;_uu_ 4       w  rEppVP                  \        R RR7       RRR4       \        P                  P                  \        X4      p\        P                  P                  \        X4      p	\        P                  P                  \        X4      p
VP                  \        P                  P                  V^c^b4      \        P                  P                  V	^M^L4      \        P                  P                  V
^X^W4      .R R7       R#   + '       g   i     L; ir  )
r  r  r|   r}   r~   r   r  r   r  r  )r#   r  r  r  r  r  r  r  r  f_dirname_1r  s   &&&&       r   "test_extractall_with_numeric_owner3NumericOwnerTest.test_extractall_with_numeric_ownerp  s    
 l++ 0<90:WD$3  5 , ww||GZ8ww||GY7ww||GZ8##X]]%7%7b"%M%-]]%7%7R%L%-]]%7%7b"%M%' /3	 	$ 	4 ,+s   D  D0	z uid=0,gid=0 must be named "root"c           	        V P                  V4      ;_uu_ 4       w  rE pVP                  V\        R RR7       RRR4       \        P                  P                  \        X4      pVP                  V^ ^ 4       R#   + '       g   i     LI; i)Fr  r  N)r  r{   r|   r}   r~   r   assert_called_with)r#   r  r  r  r  r  rM  r  s   &&&&    r   "test_extract_without_numeric_owner3NumericOwnerTest.test_extract_without_numeric_owner  sn     l++/H1aMM*gU!0  2 ,
 ww||GZ8%%lAq9 ,+s   A99B		c           
         V P                  V4      ;_uu_ 4       w  r# pV P                  \        VP                  V\        R R4       RRR4       R#   + '       g   i     R# ; i)FTN)r  rM  rv  r{   r|   )r#   r  r  r  rM  s   &&   r   test_keyword_only"NumericOwnerTest.test_keyword_only  sK    l++/H1ai#mmZ%O ,+++s   -AA"	r&   N)r'   r(   r)   r*   r  r  r   r  r   r  r  r  r  r   r  r  r  r3   r4   r5   s   @r   r  r  $  si      . ;  ;( ]]$]]$]]&4 ' % %4$ ]]$]]$]]&4 ' % %4, *,;=]]$]]$]]&	: ' % %=
	: ]]&O 'Or   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	ReplaceTestsi  c                :   V P                   P                  R 4      pVP                  RR7      pV P                  VP                  R4       V P                  VP                  R 4       V P                  V P                   P                  R 4      P                  R 4       R# )ri   z
misc/otherrD  N)rY   rk   r>  rn   r   r#   r  replaceds   &  r   test_replace_nameReplaceTests.test_replace_name  sv    ##O4>>|>45o6++O<AA(	*r   c                8   V P                   P                  R 4      pVP                  4       pRVP                  R&   V P	                  VP                  R,          R4       V P	                  V P                   P                  R 4      P                  R,          R4       R# )r  not-barr  r   NrY   rk   r>  r  rn   r  s   &  r   test_replace_deepReplaceTests.test_replace_deep  s{    ##N3>>#(1W%++G4e<HH~.::7CU	Lr   c                <   V P                   P                  R 4      pVP                  RR7      pRVP                  R&   V P	                  VP                  R,          R4       V P	                  V P                   P                  R 4      P                  R,          R4       R# )r  F)deepr  r  Nr  r  s   &  r   test_replace_shallow!ReplaceTests.test_replace_shallow  s    ##N3>>u>-(1W%++G4i@HH~.::7CY	Pr   c           	     P   V P                   P                  R 4      pR Fp  pV P                  VR7      ;_uu_ 4        VP                  ! R/ VR/B pV P	                  \        W24      R4       V P                  \        W4      R4       RRR4       Kr  	  R#   + '       g   i     K  ; i)ri   	attr_nameN)r   r  r$   r  r   r   r  r  r&   )rY   rk   r&  r>  rn   r  r  )r#   r  r  r  s   &   r   test_replace_allReplaceTests.test_replace_all  s    ##O4:I	22!>>>Y,=>  !=tD##GF$>E 32:222s   ABB%c                    V P                   P                  R 4      pV P                  \        4      ;_uu_ 4        VP	                  RR7       RRR4       R#   + '       g   i     R# ; i)ri   i[)r  N)rY   rk   rM  rv  r>  )r#   r  s   & r   test_replace_internal"ReplaceTests.test_replace_internal  sD    ##O4y))NN)N, *)))s   AA'	r&   N)r'   r(   r)   r*   r  r  r  r  r  r3   r4   r5   s   @r   r  r    s&     *LPF- -r   r  c                      a  ] tR tRt o Rt]R 4       t]R 4       tR t]	R 4       t
R tR tR	 tR
 tR tR tR tRtV tR# )NoneInfoExtractTestsi  Nc           	     f  a  \         P                  ! \        R RR7      p\        P                  ! \
        4      R,          S n        ^ Vn        \        4       ;_uu_ 4       pS P                  f,   VP                  \        P                  ! R\        R7      4       VP                  S P                  S P                  R7       RRR4       VP                  4        \!        V 3R l\        P                  ! S P                  4      P#                  R	4       4       4      S n        R#   + '       g   i     Li; i)
rz   rU   rV   extractall_ctrlNignore)actioncategoryrx   c              3   Z   <"   T F   pVP                  SP                  4      x  K"  	  R # 5ir   )relative_tocontrol_dir).0pr[  s   & r   	<genexpr>2NoneInfoExtractTests.setUpClass.<locals>.<genexpr>  s)       A? MM#//**?s   (+**/*)r/   r.   r+   r  r  r|   r  r  r   extraction_filterenter_contextwarningscatch_warningsDeprecationWarningr  r]   setglobcontrol_paths)r[  rY   cms   f  r   r\  NoneInfoExtractTests.setUpClass  s    ll7{C!,,w/2CC[[B$$,  !8!8#.@"B CNN3??33H3HNI	 
 			  A\\#//277? A A [s   A!D  D0	c                F    \         P                  ! V P                  4       R # r   )shutilr  r  r`  s   &r   ra  "NoneInfoExtractTests.tearDownClass  s    coo&r   c                .  a \        V3R  l\        P                  ! S4      P                  R4       4       4      pV P                  R9   d/   R F(  pVP                  \        P                  ! V4      4       K*  	  V P                  V P                  V4       R# )c              3   F   <"   T F  pVP                  S4      x  K  	  R # 5ir   )r  )r  r  rJ  s   & r   r  ;NoneInfoExtractTests.check_files_present.<locals>.<genexpr>  s$      ;9 MM)$$9s   !r  N)Nr   )r  r  r  )r  r  r  r  r  discardrn   r  )r#   rJ  	got_pathsr~   s   &f  r   check_files_present(NoneInfoExtractTests.check_files_present  sv     ;\\),11&9; ;	 !!^3J!!',,t"45 K++Y7r   c              '    "   \         P                  ! \        4      R ,          p^ V P                  n        V P                  P                  4        F  pV F  p\        W4R4       K  	  K  	  \        P                  ! V4      ;_uu_ 4        V P                  P                  VRR7       V P                  V4       Vx  RRR4       R#   + '       g   i     R# ; i5i)extractall_noneNr  rx   )r  r  r|   rY   r  r  setattrr	   r  r  r  )r#   
attr_namesr  r  r  s   &*   r   extract_with_none&NoneInfoExtractTests.extract_with_none  s     ll7#&77hh))+F'	40 ( , $$HHO<$$S)I %$$$s   BC	3C<
CC		Cc           
     v   \         P                  ! \        4      P                  4       P                  pV P                  R 4      ;_uu_ 4       p\         P                  ! V4      P                  R4       Fk  pV P                  VR7      ;_uu_ 4         VP                  4       P                  pV P                  VP                  4       P                  V4       RRR4       Km  	  RRR4       R#   \         d    TP                  4       '       g   h  L:i ; i  + '       g   i     K  ; i  + '       g   i     R# ; i)r  r  r~   N)r  r  r|   r  st_mtimer  r  r&  assertGreaterEqualr  
is_symlink)r#   nowr  r~   r  s   &    r   test_extractall_none_mtime/NoneInfoExtractTests.test_extractall_none_mtime  s     ll7#((*33##G,,S)..v6\\t\,,K $		 4 4 //		0D0DcJ -, 7 -,
 # "#00!  1" -,, -,,sO   AD'DC+
+*DD'+ DDDDDD$	D''D8	c           
     6   \         P                  ! \        4      P                  4       P                  p\         P                  ! \        4      R ,          pVP                  R4       VP                  4       P                  pV P                  R4      ;_uu_ 4       p\         P                  ! V4      P                  R4       F  pV P                  VR7      ;_uu_ 4        VP                  4       '       d,   V P                  VP                  4       P                  V4       M@VP                  4       '       d+   V P                  VP                  4       P                  V4       RRR4       K  	  RRR4       R#   + '       g   i     K  ; i  + '       g   i     R# ; i)regular_filer   r$   r  r  N)r  r  r|   r  r  
write_textr  r  r&  is_dirrn   is_file)r#   dir_moder  regular_file_moder  r~   s   &     r   test_extractall_none_mode.NoneInfoExtractTests.test_extractall_none_mode
  s    <<(--/77||G,~=#(--/77##F++sS)..v6\\t\,,{{}}(()<)<hG(()<)<):<	 -, 7 ,+,,, ,++s,   AFAE33*E3F3F>	FF	c                t    V P                  R 4      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)r   Nr  r"   s   &r   test_extractall_none_uid-NoneInfoExtractTests.test_extractall_none_uid  %    ##E** +***   &7	c                t    V P                  R 4      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)r   Nr   r"   s   &r   test_extractall_none_gid-NoneInfoExtractTests.test_extractall_none_gid  r  r  c                t    V P                  R 4      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)r  Nr   r"   s   &r   test_extractall_none_uname/NoneInfoExtractTests.test_extractall_none_uname"  %    ##G,, -,,,r  c                t    V P                  R 4      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)r  Nr   r"   s   &r   test_extractall_none_gname/NoneInfoExtractTests.test_extractall_none_gname&  r  r  c                z    V P                  R RRR4      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)r   r   r  r  Nr   r"   s   &r   test_extractall_none_ownership3NoneInfoExtractTests.test_extractall_none_ownership*  s,    ##E5'7CC DCCCs   ):	r&   )r'   r(   r)   r*   r  r|  r\  ra  r  r   r  r  r  r  r  r	  r  r  r3   r4   r5   s   @r   r  r    sw      A A ' '8 	 	K <  r   r  c                       ] tR tRtRtRtR# )NoneInfoExtractTests_Datai.  r   r&   Nr'   r(   r)   r*   r  r3   r&   r   r   r  r  .  s    r   r  c                       ] tR tRtRtRtR# )!NoneInfoExtractTests_FullyTrustedi1  r  r&   Nr  r&   r   r   r  r  1  s    'r   r  c                       ] tR tRtRtRtR# )NoneInfoExtractTests_Tari5  rY   r&   Nr  r&   r   r   r  r  5  s    r   r  c                       ] tR tRtRtRtR# )NoneInfoExtractTests_Defaulti8  Nr&   r  r&   r   r   r  r  8  s    r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )NoneInfoTests_Misci<  c                   \         P                  ! 4       p\        P                  \        P                  \        P
                  3 EF"  pV P                  VR 7      ;_uu_ 4        \        P                  ! VRVR7      pVP                  \        4      p \        \        R4      ;_uu_ 4       pVP                  WE4       RRR4       R F  pV P                  VR7      ;_uu_ 4        VP                  ! R/ VR/B pV P                  \        V 4      ;_uu_ 4        \        \        R4      ;_uu_ 4       pVP                  Wu4       RRR4       RRR4       RRR4       K  	  RRR4       EK%  	  R#   + '       g   i     L; i  + '       g   i     LF; i  + '       g   i     LQ; i  + '       g   i     K  ; i  \         d    T\        P                  8X  d    L~h i ; i  + '       g   i     EK  ; i))	tarformatr   )ry  r$   r   r   Nr  )r  r$   r   r   r  r  r&   )r,   r   r/   r   r  r'  r&  r.   rF  r+   r^  r>  rG  r  r  )r#   bior  rY   rs   r  r  r  s   &       r   test_addNoneInfoTests_Misc.test_add=  sk   jjl!..0B0B!,,.I	22ll3SK..1=gt,,G/ -&6	!\\I\>>'.'K)T9J'KH!%!7!7
;D+"H "H%)'4%8%8A$'KK$< &9"H ?>&6 32. -,  &9%8"H "H ?>> !  G$8$88  322s   #/G"F;+E.=F;G"$4F'F1FFF'G".E>9F;FFF$F''F82	G"; G	G"G	G""G4c                
   R 0R0R0R0R0R0RR0RR03 EF  pV P                  VR7      ;_uu_ 4        \        P                  ! \        RR7      ;_uu_ 4       p\        P
                  ! \        P                  ! 4       R	R
R7      p\        P                  ! \        RV4      ;_uu_ 4        VP                  4        RRR4       VP                  4        F  pV F  p\        WER4       K  	  K  	  \        P
                  ! \        P                  ! 4       R	R
R7      p\        P                  ! \        RV4      ;_uu_ 4        VP                  4        RRR4       \        VP                  4       P                  4       P!                  4       VP                  4       P                  4       P!                  4       4       EFF  w  rxVR 08X  d2   \"        P$                  ! RV4      '       d   V P'                  VR4       K?  VR 08X  d2   \"        P$                  ! RV4      '       d   V P'                  VR4       Kx  VR08X  d2   \"        P$                  ! RV4      '       d   V P'                  VR4       K  VR08X  dd   VP)                  R4      '       dM   VP!                  R4      w  rVP!                  R4      w  rV P'                  W4       V P+                  VR4       EK  VR08X  dd   VP-                  R4      '       dM   VP!                  R4      w  rVP!                  R4      w  rV P'                  W4       V P+                  VR4       EK  VR08X  dd   VP)                  R4      '       dM   VP!                  R4      w  rVP!                  R4      w  rV P'                  W4       V P'                  VR4       EK  VR08X  dd   VP-                  R4      '       dM   VP!                  R4      w  rVP!                  R4      w  rV P'                  W4       V P'                  VR4       EK]  VRR08X  dd   VP)                  R4      '       dM   VP!                  R4      w  rVP!                  R4      w  rV P'                  W4       V P'                  VR4       EK  VRR08X  dd   VP-                  R4      '       dM   VP!                  R4      w  rVP!                  R4      w  rV P'                  W4       V P'                  VR4       EK5  V P'                  Wx4       EKI  	  RRR4       RRR4       EK   	  R#   + '       g   i     ELh; i  + '       g   i     EL; i  + '       g   i     LG; i  + '       g   i     EKQ  ; i)r  r$   r   r   r  r  )r  rU   r  r   r   r   r   Ns   2003-01-\d\ds
   ????-??-??s   \d\d:\d\d:\d\ds   ??:??:??s   .([r-][w-][x-]){3}s
   ??????????   /s   [0-9]+   1000/s   None   /100)   tarfile/   lars/   foo/)   /tarfile   /users   /bar)r&  r'  r(  r$  )r)  r*  r+  r%  )r&  r/   r.   r+   r,   r   r   r   r   r   r   r  r  r	  r   r   rS  rematchrn   r  r  endswith)r#   r  rY   tio_prevr  r  tio_newr  gotexp_user	exp_groupgot_user	got_groups   &            r   r  NoneInfoTests_Misc.test_listY  sV   
 $9vh%#9wi!7+eW-=?J ,,*,55,,w==++BJJL'4P&&sHh??HHJ @!nn.F%/	48 &0 / **2::<$O&&sHg>>HHJ ?%():)C)C)E)K)K)M)0)9)B)B)D)J)J)L&NMH!gY.288<Lh3W3W((m<#y0RXX>PRZ5[5[((k:#x/BHH2H5> 5>((m<#y0X5H5H<6> 6>.6nnT.B+.1iio+((>((9=#y0X5F5F=6? 6?.6nnT.B+.1iio+((<((I>#w.83F3F%4( 4(.6nnT.B+.1iio+((>((7;#w.83D3Dg3O3O.6nnT.B+.1iio+((<((G<#w'77H<O<OF=H =H.6nnT.B+.1iio+((>((7;#'77H<M<MF=H =H.6nnT.B+.1iio+((<((G< ((7]&N > 65? @?? ?>> >= 655sw   %UAU)T:BU>T-BU"8U8UDUA*UD:UUT*$	U-T>8	UUUU&r&   N)r'   r(   r)   r*   r   r  r3   r4   r5   s   @r   r  r  <  s     =8A8 A8r   r  c           	     `   V R,          pR\         P                  R^ /V^ ,          ,          R\         P                  R^ /V^,          ,          ,          R\         P                  R^ R\         P                  \         P                  ,          R\         P                  /V^,          ,          ,          R\         P
                  R^ /V^,          ,          ,          R\         P                  R^ /V^,          ,          ,          R\         P                  R^ R\         P                  \         P                  ,          R\         P                  /V^,          ,          ,          R\         P                  R^ /V^,          ,          ,          R\         P                  R^ /V^,          ,          ,          R\         P                  R^ R\         P                  \         P                  ,          R	\         P                  /V^,          ,          ,          p\         P                  ! V4      R,          V R,          8X  g   Q hV# )
z~Inverse of `stat.filemode` (for permission bits)

Using mode strings rather than numbers makes the later tests more readable.
:r  NNrz   -r   rp  r   Sra  T)r  S_IRUSRS_IWUSRS_IXUSRS_ISUIDS_IRGRPS_IWGRPS_IXGRPS_ISGIDS_IROTHS_IWOTHS_IXOTHS_ISVTXr  )r$   str_moderesults   &  r   _filemode_to_intrI    s   
 BxHc1
%hqk
2c1
%hqk
23c1t||+&qk++
 c1
%hqk
23 c1
%hqk
23 c1t||+&qk+	+ c1
%hqk
2
3 c1
%hqk
23 c1t||+&qk++ $ == $R000Mr   c                   ^   a  ] tR tRt o RtR tR tR tRRRRR	RR
RRRRR/R ltR t	Rt
V tR# )r  i  zHelper to create a tar file with specific contents

Usage:

    with ArchiveMaker() as t:
        t.add('filename', ...)

    with t.open() as tar:
        ... # `tar` is now a TarFile with 'filename' in it!
c                Z    \         P                  ! 4       V n        \        V4      V n        R # r   )r,   r   r  dict
tar_kwargs)r#   r  s   &,r   r  ArchiveMaker.__init__  s    ::<v,r   c                l    \         P                  ! RR RRV P                  /V P                  B V n        V # )r$   r   ry  r&   )r/   r0   r  rM  tar_wr"   s   &r   	__enter__ArchiveMaker.__enter__  s,    __S#StxxS4??S
r   c                    V P                   P                  4        V P                  P                  4       V n        R V n        R # r   )rP  r]   r  r   r  )r#   r  s   &*r   __exit__ArchiveMaker.__exit__  s-    

))+r   r  Nr  hardlink_tor$   rp   contentc                  \        V4      p\        P                  ! V4      P                  ! R/ VB p	Ve2   \	        V\         4      '       d   VP                  4       p\        V4      pVe    Win        Vf   \        V	P                  4      pV'       d   \        V4      V	n
        Ve!   \        P                  p\        V4      V	n        Ve!   \        P                  p\        V4      V	n        VP                  R4      '       d   Vf   \        P                  pVe   W)n        V	P#                  4       '       d   \$        P&                  ! V4      p
MRp
V P(                  P+                  W4       R# )ab  Add a member to the test archive. Call within `with`.

Provides many shortcuts:
- default `type` is based on symlink_to, hardlink_to, and trailing `/`
  in name (which is stripped)
- size & content defaults are based on each other
- content can be str or bytes
- mode should be textual ('-rwxrwxrwx')

(add more! this is unstable internal test-only API)
Nr   r&   )r{  r/   rW  r>  r  r   ro   rp   r  rI  r$   r  r  r  r.  r  r  r+  r,   r   rP  r^  )r#   r   r  r  rV  r$   rp   rW  r  rs   ry  s   &&$$$$$$,  r   r   ArchiveMaker.add  s    4y//$'//9&9'3''!..*w<DL-+D1GL!??D":G"??D";/G==$,??DL==??jj)GG

7,r   c                r    \         P                  ! V P                  4      p\        P                  ! RRV/VB # )z9Open the resulting archive as TarFile. Call after `with`.ry  r&   )r,   r   r  r/   r.   )r#   r  r  s   &, r   r.   ArchiveMaker.open  s+    jj'||2C2622r   )r  r  rM  rP  )r'   r(   r)   r*   r  r  rQ  rT  r   r.   r3   r4   r5   s   @r   r  r    sV     	'
'- '- '-4 '-'- '-*.'-R3 3r   r  c                 :    \         P                  ! R 4      ! V 4      # )zWASI: Skip symlink test for now)r   skipr  s   &r   symlink_testr_    s    }}>?BBr   c                     V # r   r&   r^  s   &r   r_  r_    s    r   c                   h  a  ] tR tRt o ]P
                  ! ]4      R,          t]R,          t]	RR/R l4       t
R-R ltR	 tR.R
 ltR tR t]R 4       t]]P&                  R 4       4       t]R 4       t]R 4       tR t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       tR tR t R t!R t"R t#R t$R t%]&PN                  ! ](PR                  R 8H  R!4      R" 4       t*]&PN                  ! ](PR                  R 8H  R!4      R# 4       t+R$ t,R% t-R& t.R' t/R( t0R) t1R* t2R+ t3R,t4V t5R# )/TestExtractionFiltersi  outerdirr1  
check_flagTc             #    "   \         P                  ! V P                  4      ;_uu_ 4        V P                  R,          pVP                  R4        VP	                  V P
                  VR7       RV n        RV n        \        V P                  P                  R4      4      V n
        V P                  P                  V P
                  4       V P                  P                  V4        V x  VP                  4        V P                  '       d   V P                  hV P                  V P                  \        4       4       V'       d"   V P                  VP                  4       R4       M	VR8X  g   Q hRRR4       R#   \         d'   pYPn        RT n        \        4       T n
         Rp?LRp?ii ; i  TP                  4        i ; i  + '       g   i     R# ; i5i)	a  Extracts `tar` to `self.destdir` and allows checking the result

If an error occurs, it must be checked using `expect_exception`

Otherwise, all resulting files must be checked using `expect_file`,
except the destination directory itself and parent directories of
other files.
When checking directories, do so before their contents.

A file called 'flag' is made in outerdir (i.e. outside destdir)
before extraction; it should not be altered nor should its contents
be read/copied.
flagz
capture merx   NFr  Tr  )r	   r  rc  r  r  r2  raised_exceptionreraise_exceptionr  r  expected_pathsr  r  r]   rn   r  )r#   rY   ry   rd  	flag_pathr  s   &&&$  r   check_context#TestExtractionFilters.check_context  sd     ...I  .7t||F; )-%).&&)$--*<*<V*D&E###++DLL9##++I6
		%%%+++T00#%8  !4!4!6E0003 /.
  ,(+%)-&&)e##, 		% /..sf   )G%GE8.A7G&F,*!GA"G.
G8F)F$G$F))G,F>>GG		GNc                   V P                   '       d   V P                   h\        P                  ! \        P                  P                  V P                  V,          4      4      pV P                  WpP                  4       V P                  P                  V4       Ve   \        P                  ! 4       '       di   \        P                  R8w  dT   \        P                  ! \        P                  ! VP                  4       P                   4      4      pV P#                  W4       Vf>   \%        V\&        4      '       d(   VP)                  R4      '       d   \*        P,                  pVe`   V P                  V,          P/                  4       p\        P                  ! V4      p	 W8w  d!   V P1                  VP3                  V	4      4       MV\*        P8                  8X  g   Vf!   V P1                  VP;                  4       4       MV\*        P,                  8X  d!   V P1                  VP=                  4       4       MuV\*        P>                  8X  d!   V P1                  VPA                  4       4       M@V\*        PB                  8X  d!   V P1                  VPE                  4       4       M\G        V4      hVe+   V P#                  VP                  4       PH                  V4       Ve!   V P#                  VPK                  4       V4       VPL                   F  pV P                  PO                  V4       K   	  R#   \4         d    p
T
P7                  RT	: RT: 24       h Rp
?
ii ; i)z'Check a single file. See check_context.Nntr   z	expected=z, got=)(rg  r  r  r}   r~   normpathr2  r  ri  remover	   	can_chmodr   r  r  S_IMODEr  rn   r  r{  r.  r/   r  readlinkr6  samefiler  add_noterG  r  r  r  is_fifor  r  NotImplementedErrorr  r  parentsr  )r#   r   r  r  r$   rp   rW  r~   r1  r  r[  parents   &&&&&&&     r   expect_file!TestExtractionFilters.expect_file?  sE       '''||BGG,,T\\D-@ABd//0""4(	 3 3 5 5"''T/--TYY[-@-@ ABCS'<JtS11dmmC6H6H??D!<<$&002C||J/H?OOCLL$:;
 W__$OODLLN+W__$OODKKM*W%%%OODLLN+W__$OODOO-.%d++TYY[00$7T^^-w7llF''/ #%  

ih[3&12s   &L) )M4MMc                    V P                   V,          P                  4       pV P                  V\        P                  R7       V P
                   Uu0 uF  pW#P                  9  g   K  VkK  	  upV n        R# u upi )z-Check a directory; forget about its contents.r  N)r2  resolverz  r/   r  ri  rx  )r#   r   	tree_pathr  s   &&  r   expect_any_tree%TestExtractionFilters.expect_any_treek  sg    \\D(113	9**
*!		) A*
 
s   A8(A8c                    V P                  W4      ;_uu_ 4        V P                  e   V P                  h R R R 4       RV n        V P                  #   + '       g   i     L#; ir  )rG  rg  rh  )r#   exc_type
message_res   &&&r   expect_exception&TestExtractionFilters.expect_exceptiont  sT    ##H99$$0+++ 1 : "'$$$	 :9s   AA!	c                B   \        4       ;_uu_ 4       pVP                  R 4       RRR4       R FE  pV P                  XP                  4       V4      ;_uu_ 4        V P	                  R 4       RRR4       KG  	  R#   + '       g   i     L]; i  + '       g   i     Ko  ; i)z
benign.txtN)r  rY   r   r  r   rk  r.   rz  r#   r  ry   s   &  r   test_benign_file&TestExtractionFilters.test_benign_file{  si    ^^sGGL! 4F##CHHJ77  . 87 5 ^ 877s   A:B:B
	Bc                   \        4       ;_uu_ 4       pVP                  V P                  R ,          4       RRR4       V P                  XP	                  4       R4      ;_uu_ 4        V P                  R4       RRR4       R F  pV P                  VP	                  4       V4      ;_uu_ 4        \        V P                  4      P                  R4      '       d:   \        V P                  4      P                  R4      pV P                  V R24       M V P                  \        P                  R4       RRR4       K  	  R#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     K  ; i)zescaped.evilNr  z../escaped.evilr   z/escaped.evilz+['"].*escaped.evil['"] has an absolute pathrY   r   )r  r   rc  rk  r.   rz  r{  r  lstripr  r/   AbsolutePathError)r#   r  ry   outerdir_strippeds   &   r   test_absolute#TestExtractionFilters.test_absolute  s    ^^sGGDMMN23  
O<<./ = $F##CHHJ77t}}%0055 ),DMM(:(A(A#(F%$$(9':-%HI ))11IK 87 $ ^^ =< 877s$   #D?&E-BE&?E	E#	&E7c                   \        4       ;_uu_ 4       pVP                  R RR7       VP                  RRR7       VP                  R4       RRR4       \        P                  ! 4       '       Ed<   V P	                  XP                  4       R4      ;_uu_ 4        V P                  e!   V P                  \        4        RRR4       R# V P                  R RR7       V P                  RRR7       V P                  R4        RRR4       V P	                  VP                  4       R	4      ;_uu_ 4        V P                  \        P                  R4       RRR4       V P	                  VP                  4       R
4      ;_uu_ 4        V P                  \        P                  R4       RRR4       R# V P	                  XP                  4       R4      ;_uu_ 4        V P                  R4       RRR4       V P	                  VP                  4       R	4      ;_uu_ 4        V P                  R4       RRR4       V P	                  VP                  4       R
4      ;_uu_ 4        V P                  R4       RRR4       R#   + '       g   i     EL0; i  + '       g   i     EL; i  + '       g   i     ELT; i  + '       g   i     R# ; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)currentr  r  ry  z
current/..parent/evilNr  r  rY   r   T'parent/evil' would be extracted to ['"].*evil['"], which is outside the destinationzK'parent' would link to ['"].*outerdir['"], which is outside the destination)r  r   r	   r  rk  r.   rg  r  rk  rz  r/   OutsideDestinationErrorLinkOutsideDestinationErrorr#   r  s   & r   test_parent_symlink)TestExtractionFilters.test_parent_symlink  s"    ^^s
 GGI#G. GGHG6GGM"    ""##CHHJ@@((4 ))/:  A@ $$Y3$?$$X,$G$$Y/ A ##CHHJ66%%339: 7 ##CHHJ77%%779: 87 ##CHHJ@@  / A##CHHJ66  / 7##CHHJ77  / 87Y ^^ A@@ 766 877 A@66777sY   8I2%J7J.!J?!J.KKK(2J	J	J+	.J?	K	K%	(K9	c           
     	   \        4       ;_uu_ 4       pR p\        P                  R8X  d   RpMR\        P                  9   d|   \        P
                  ! V P                  P                  R4      p^p\        \        V P                  4      4      V,           pWF,
          \        V4      V,           ,          pRV,          pM\        R4      hRpRp	V F  p
VP                  \        P                  P                  W4      \        P                   RR7       VP                  \        P                  P                  W4      VR7       \        P                  P                  W4      p\        P                  P                  W4      p	K  	  \        P                  P                  ! . VORN5!  pR	.\        V4      ,          pVP                  V\        P                  P                  ! V!  R7       VP                  R
\        P                  P                  VR	4      R7       VP                  R\        P                  P                  R
R4      R7       VP                  RRR7       VP                  RRR7       RRR4       V P#                  R4      ;_uu_ 4        V P%                  XP'                  4       RRR7      ;_uu_ 4        \        P                  R8X  d   V P)                  \*        \,        34       MV P.                  '       d   V P)                  \0        4       MkV P3                  X4       V P5                  RRR7       V P5                  RRR7       V P5                  R
\        P6                  R7       V P5                  RVR7       RRR4       RRR4       R F  pV P#                  V4      ;_uu_ 4        V P%                  XP'                  4       VR7      ;_uu_ 4        V P)                  \8        \0        34      p\;        V\8        4      '       d]   \        P                  R8X  d   V P=                  VP>                  R4       M*V PA                  VPB                  \B        PD                  4       RRR4       RRR4       K  	  R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL%; i  + '       g   i     LZ; i  + '       g   i     EKK  ; i)abcdefghijklmnopr  dPC_PATH_MAXz1Need to guess component length for {sys.platform}r   
drwxrwxrwxr  r  r  escapeflaglinkrf  rV  	overwrite)rW  zescape/newfilenewNr  F)ry   rd  z
../newfiler}  r   rx   dddddddddddddddddddddddddllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllr  )r  r     )#r  r   r  r}   pathconf_namespathconfrc  ry  ro   r{  r2  rw  r   r~   r   r/   r  r&  rk  r.   r  rH  rk  rg  r  r  rz  r  r  r  r  winerrorrn   errnoENAMETOOLONG)r#   r  steps	componentmax_path_lenpath_sep_lendest_lencomponent_lenr~   	step_pathilinkpathparent_segmentsry   r  s   &              r   test_realpath_limit_attack0TestExtractionFilters.test_realpath_limit_attack  sy   
 ^^s
 'E||w&$	""3"33!{{4==+?+?O s4<<01L@!-!8c%j<>W X-/	)*]^^DIT5GOO)  +T-)Dww||D4GGLL6	  ww||4U4G4H#fs5z1OGGH)GGHGGHh)EGF GGJBGGLL6,JGKGGJG4GG$eG4O R ll?++  O,1 ! 3 3||w&%%'8/&JK&&&%%h/ $$Y/  [ A  u =   @   ;3 ,  $Ff%%t'9'9#((*V'9'T'T++Wh,?@c7++||w. cllK@((E4F4FG (U%% $s ^^T3 3 3 ,++" (U'T%%%s]   IQ=+R%<AR	 BR	R%/*SBR9'S=R	R"	R%%R6	9S	SSc                   \         P                  ! 4       '       EdF   \        P                  P	                  \
        R 4      p\        P                  ! V4       \        P                  ! R\        P                  P	                  VR4      4       \        \        P                  P	                  VRRR4      R4      ;_uu_ 4         RRR4       \        P                  P                  \        P                  P	                  VR4      4      '       d   RpMR\        P                  P                  \        P                  P	                  VRR4      4      '       d   RpM\        R	4      h\        4       ;_uu_ 4       pVP                  RRR
7       VP                  RRR
7       VP                  R4       RRR4       V P                  XP                  4       R4      ;_uu_ 4        \         P                  ! 4       '       d9   V P                  RRR
7       V P                  RRR
7       V P                  R4       M"V P                  R4       V P                  R4       RRR4       V P                  VP                  4       R4      ;_uu_ 4        \         P                  ! 4       '       d"   V P                  \         P"                  R4       M"V P                  R4       V P                  R4       RRR4       V P                  VP                  4       R4      ;_uu_ 4        \         P                  ! 4       '       dK   X'       d"   V P                  \         P"                  R4       MCV P                  \         P$                  R4       M"V P                  R4       V P                  R4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     R# ; i)resolution_testr  r  r  rq  r   NTFz#Could not determine link resolutionr  zcurrent/parentr  r  ry  r  zcurrent/rY   r   r  zS'current/parent' would link to ['"].*outerdir['"], which is outside the destination)r	   r  r}   r~   r   r|   r   rf  r.   r  rl  r  r   rk  rz  r  r/   r  r  )r#   testpathdotdot_resolves_earlyr  s   &   r   test_parent_symlink2*TestExtractionFilters.test_parent_symlink2  s      ""ww||G->?HHHX JJsBGGLL9=> bggll8YfEsKK L ww~~bggll8V<== )-%XtV DEE ).%$%JKK^^s GGI#G. GG$G6GGM"  
O<<$$&&  s ;  d ;  +  ,  / = 
E22$$&&%%77,-   ,  / 3 
F33$$&&())#;;01 ))#??01   ,  /% 43_ LKK ^^ =<< 322 433sE    N#48N7A6OAO#O35A$O3#N4	7O	O	O0	3P	c                   \        4       ;_uu_ 4       pVP                  R V P                  R7       VP                  R4       RRR4       V P                  XP	                  4       R4      ;_uu_ 4        \
        P                  ! 4       '       d0   V P                  R V P                  R7       V P                  R4       MV P                  R4       RRR4       V P                  VP	                  4       R4      ;_uu_ 4        \
        P                  ! 4       '       d"   V P                  \        P                  R	4       MV P                  R4       RRR4       V P                  VP	                  4       R4      ;_uu_ 4        V P                  \        P                  R4       RRR4       R#   + '       g   i     ELn; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)
ry  r  r  Nr  r  rY   r   &'parent' is a link to an absolute pathr  )r  r   rc  rk  r.   r	   r  rz  r  r/   r  AbsoluteLinkErrorr  s   & r   test_absolute_symlink+TestExtractionFilters.test_absolute_symlinko  sT    ^^sGGHG7GGM"  
O<<$$&&  dmm D  +  / = 
E22$$&&%%77,-   / 3 
F33!!))8: 43+ ^^ =< 32 433s1   /F'2AF;>AG<!G!'F8	;G	G	!G2	c                   \        4       ;_uu_ 4       pVP                  R V P                  R,          R7       RRR4       V P                  XP	                  4       R4      ;_uu_ 4        V P                  \        R4       RRR4       V P                  VP	                  4       R4      ;_uu_ 4        V P                  \        R4       RRR4       V P                  VP	                  4       R4      ;_uu_ 4        V P                  \        P                  R4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)	ry  rQ  r  Nr  z.*foo. not foundrY   r   r  )	r  r   rc  rk  r.   r  r  r/   r  r  s   & r   test_absolute_hardlink,TestExtractionFilters.test_absolute_hardlink  s     ^^sGGH$--%*?G@  
O<<!!(,>? = 
E22!!(,>? 3 
F33!!))8: 43 ^ =< 32 433s/   %D!(D4/E6!E!D1	4E	E	E+	c                   \        4       ;_uu_ 4       pVP                  R RR7       RRR4        V P                  XP                  4       RR7      ;_uu_ 4        \        P
                  ! 4       '       dK   \        V P                  \        4      '       d   V P                  \        4       MV P                  R RR7       M RRR4       R FT  pT P                  XP                  4       T4      ;_uu_ 4        T P                  \        P                  R4       RRR4       KV  	  R#   + '       g   i     EL; i  + '       g   i     L; i  \         d     Li ; i  + '       g   i     K  ; i)../mooz..//tmp/moor  Nr  rx   r  zH'../moo' would be extracted to '.*moo', which is outside the destination)r  r   rk  r.   r	   r  r  rg  rk  r  rz  r/   r  r  s   &  r   test_sly_relative0(TestExtractionFilters.test_sly_relative0  s    ^^sGGHG7 	##CHHJ#GG((**!$"7"7II --o>((m(L  H& $F##CHHJ77%%77,- 87 $1 ^^
 HG   		 877sG   D$)E A'D8 E 5!E$D5	8E	E E EEE-c                   \        4       ;_uu_ 4       pVP                  R 4       VP                  RRR7       RRR4       V P                  XP                  4       R4      ;_uu_ 4        V P	                  R\
        P                  R7       \        P                  ! 4       '       d   V P	                  RR	R7       RRR4       R
 FT  pV P                  VP                  4       V4      ;_uu_ 4        V P                  \
        P                  R4       RRR4       KV  	  R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     K  ; i)ztmp/ztmp/../../mooztmp/../..//tmp/moor  Nr  tmpr}  r  ztmp/../../tmp/moor  zU'tmp/../../moo' would be extracted to ['"].*moo['"], which is outside the destination)r  r   rk  r.   rz  r/   r  r	   r  r  r  r  s   &  r   test_sly_relative2(TestExtractionFilters.test_sly_relative2  s     ^^sGGFOGGO0DGE  
O<<U9$$&&  6I J =
 $F##CHHJ77%%33$% 87 $ ^ =< 877s$   %D(AD/-!ED,	/D?	Ec           
        \        4       ;_uu_ 4       pVP                  R ^R7       VP                  R\        P                  P	                  RR4      R7       VP                  R\        P                  P	                  RRR4      R7       R	R	R	4       R F  pV P                  XP                  4       V4      ;_uu_ 4        V P                  R ^R7       V P                  R^R7       \        P                  ! 4       '       d   V P                  R^R
R7       MV P                  R^R7       R	R	R	4       K  	  R	#   + '       g   i     L; i  + '       g   i     K  ; i)targetdir/targetr  linkdir/hardlink	targetdirrb  r  linkdir/symlinkr  r  Nz../targetdir/targetrp   r  rY   r   r  
r  r   r}   r~   r   rk  r.   rz  r	   r  r  s   &  r   test_deep_symlink'TestExtractionFilters.test_deep_symlink  s   
 ^^sGG&QG/GG&BGGLLX5'G ( GG%"'',,k83-G .  5F##CHHJ77  !3! <  !3! <((**$$%6Q0E % G $$%6Q$? 87 5 ^ 877s   A7D7?A*E
7E	
Ec           	        \        4       ;_uu_ 4       pVP                  R RR7       VP                  R\        P                  P	                  RR4      R7       VP                  R^R7       VP                  R\        P                  P	                  R	R
4      R7       VP                  R\        P                  P	                  RR4      R7       RRR4       R F  pV P                  XP                  4       V4      ;_uu_ 4        V P                  R^R7       V P                  R^R7       V P                  R^R7       \        P                  ! 4       '       d*   V P                  R ^RR7       V P                  R^RR7       M&V P                  R ^R7       V P                  R^R7       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     EK  ; i)r  hardlinkr  symlink2linkdir	hardlink2r  r  r  r  rb  r  zlinkdir/hardlink2rf  Nr  r  r  r  s   &  r   test_chains!TestExtractionFilters.test_chains  s    ^^sGG%*G=GGJ277<<;,(G )GG&QG/GG&BGGLLh4WGXGG'RWW\\)Y5WGX  5F##CHHJ77  !3! <  !3! <  !41 =((**$$%6Q0: % <$$Za0C % E $$%6Q$?$$Za$8 87 5 ^ 877s   B:F4B$G4G	Gc           
     T   \        4       ;_uu_ 4       pVP                  R 4       VP                  R4       VP                  R\        P                  P	                  RR4      R7       VP                  R\        P                  P	                  RRR4      R7       VP                  RR	R7       VP                  R
\        P                  P	                  RR4      R7       RRR4       V P                  XP                  4       R4      ;_uu_ 4        \        P                  ! 4       '       g!   V P                  \        P                  4       M\        P                  R8X  d!   V P                  \        P                  4       MJV P                  \        P                  R4      pV P                  VP                   \        P                  4       RRR4       R EF  pV P#                  V4      ;_uu_ 4        V P                  VP                  4       V4      ;_uu_ 4        \        P                  ! 4       '       g5   V P%                  R 4       V P%                  R4       V P%                  R4       M[V P%                  R 4       V P%                  R4       V P%                  RRR7       V P%                  R
RR7       V P%                  RR	R7       RRR4       RRR4       EK  	  R#   + '       g   i     EL; i  + '       g   i     EL/; i  + '       g   i     LG; i  + '       g   i     EKU  ; i)z	a/t/dummyzb/cr   ra  r  zc/escaper  	link_herer   boomr  r  Nr   r  zc/z
a/t/escapez../../link_herezJlink 'boom' would be extracted as a copy of 'c/escape', which was rejected)rY   r  )r  r   r}   r~   r   rk  r.   r	   r  r  r/   r  r   r  LinkFallbackErrorrz  	__cause__r&  rz  )r#   r  r[  ry   s   &   r   test_sneaky_hardlink_fallback3TestExtractionFilters.test_sneaky_hardlink_fallback  sE   
 ^^s GGK GGDMGGCBGGLLc$:G;GGJ277<<d8C,EG F GGCCG( GGFS((CGD " 
F33((** %%779(%%g&I&IJ))--78 %%akk&-&I&IK 4" -Ff%%t'9'9#((*f'M'M ,,..$$[1$$T*$$T*$$[1$$T*$$\>O$P$$V8I$J$$SS$9 (N%% -E ^^" 433$ (N'M%%%s>   C
KB;K./)LB+LLK+	.K?	LLL'c                H   \        4       ;_uu_ 4       pVP                  R \        P                  P	                  RRRRR4      R7       VP                  RRR7       RRR4       R	 F  pV P                  XP                  4       V4      ;_uu_ 4        \        P                  ! 4       '       dC   V P                  RRR7       VR8X  d   V P                  R RR7       MV P                  R RR7       M RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)
r  r  r  z	link-herer  r  Nr   zlink/link/../../link-herer  )
r  r   r}   r~   r   rk  r.   r	   r  rz  r  s   &  r   test_exfiltration_via_symlink3TestExtractionFilters.test_exfiltration_via_symlink;  s     ^^sGGHffdDR])^G_GGFtG,  5F##CHHJ77((**$$V$='((k(J((4O ) Q  87 5	 ^
 877s   AC=AD=D	D!c                D   \        4       ;_uu_ 4       pVP                  R RR7       VP                  RRR7       VP                  R RR7       VP                  RRR7       R	R	R	4       R EF  pV P                  XP                  4       V4      ;_uu_ 4       p\        P
                  ! 4       '       g   V P                  R4       MTVR
8X  d(   V P                  RRR7       V P                  R RR7       M&V P                  RRR7       V P                  R RR7       \        P                  R8w  d>   VP                  P                  4       P                  pV P                  VR,          R4       R	R	R	4       EK  	  R	#   + '       g   i     EL"; i  + '       g   i     EK5  ; i)za/pwnr  r  za/pwn/r  r   zx/../za/xz../Nr   r  r  r  )r  r   rk  r.   r	   r  rz  r   r  rc  r  r  r  )r#   r  ry   ccr  s   &    r   test_chmod_outside_dir,TestExtractionFilters.test_chmod_outside_dirR  sD   
 ^^sGGGG, GGH<G0GGGG0 GGEuG.  5F##CHHJ772 ,,..$$X.v%$$Uu$=$$W$=$$Uu$=$$W$A<<7* kk..088G''%? 87 5 ^^ 877s   AE9CF9F
	Fc                   \        4       ;_uu_ 4       pVP                  R 4       VP                  R4       VP                  RRR7       VP                  RRR7       RRR4       R Fx  pV P                  XP                  4       V4      ;_uu_ 4       pV P	                  R 4       V P	                  R4       V P	                  R4       V P	                  R4       RRR4       Kz  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)	dir/zdir/../afilelink1r  link2zdir/../dir/../afileNafiler  r  )r#   r  ry   r  s   &   r   test_link_fallback_normalizes3TestExtractionFilters.test_link_fallback_normalizesr  s     ^^sGGFOGGN#GGGG8GGG)>G?	  5F##CHHJ772  (  )  )  )	 87 5 ^ 877s   A	C$AC7$C4	7Dc                   \        4       ;_uu_ 4       pVP                  R RR7       VP                  RRR7       VP                  RRR7       VP                  RRR7       VP                  R	R
R7       VP                  RRR7       VP                  RRR7       RRR4       \        P                  P	                  \
        R4      p\        VR4      ;_uu_ 4         RRR4        \        P                  ! V4      P                  \        P                  ,          \        P                  ,          \        P                  ,          p \        P                  ! W#4       \        P                  ! T4      P                  pT\        P                  ,          '       d   RMRpT\        P                  ,          '       d   RMRpT\        P                  ,          '       d   RMRp\        P"                  ! T4       \        P$                  ! T4       \        P                  ! T4      P                  \        P                  ,          \        P                  ,          \        P                  ,          p\        P                  ! Y#4       \        P                  ! T4      P                  pT\        P                  ,          '       d   RMRp	T\        P                  ,          '       d   RMRp
T\        P                  ,          '       d   RMRp\        P&                  ! T4       T P)                  XP                  4       R4      ;_uu_ 4        T P+                  R RT RT RT 2R7       T P+                  RRR7       T P+                  RRR7       T P+                  RRR7       T P+                  R	R
R7       T P+                  RRT RT	 2R7       T P+                  RRT
 RT RT	 2R7       RRR4       T P)                  TP                  4       R4      ;_uu_ 4        T P+                  R RR7       T P+                  RRR7       T P+                  RRR7       T P+                  RRR7       T P+                  R	R
R7       T P+                  RRR7       T P+                  RRR7       RRR4       T P)                  TP                  4       R4      ;_uu_ 4        \        P,                  ! \        P.                  ! T P0                  P                  4       P                  4      4      pT P+                  R RR7       T P+                  RRR7       T P+                  RRR7       T P+                  RR R7       T P+                  R	R!R7       T P+                  RTR7       T P+                  RTR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  \         d>   pTP                  \        \        R^ 4      8X  d   T P!                  R4        Rp?ELh Rp?ii ; i  \        P"                  ! T4       i ; i  + '       g   i     ELY; i  + '       g   i     EL; i  + '       g   i     R# ; i)"all_bitsr  r   	perm_bitsz
?rwxrwxrwxexec_group_otherz
?rw-rwxrwxread_group_onlyz
?---r-----no_bitsz
?---------r  z
?---rwsrwtzdir_all_bits/Nztmp.filer   EFTYPEz?chmod() failed with EFTYPE: regular users cannot set sticky bitra  rp  r   r  z?rwr  z?---rwrY   z
?rwxr-xr-xz
?rw-r-xr-xz
?---r-xr-xr   z
?rw-r--r--z
?rw-r-----z
?rw-------)r  r   r}   r~   r   r|   r.   r  r  rF  rB  r>  r  r  r  r  ra  r  r   r   rk  rz  r  rr  rc  )r#   r  tmp_filenamenew_moder  got_mode_t_file
_suid_file
_sgid_file_t_dir	_suid_dir	_sgid_dirnormal_dir_modes   &            r   
test_modes TestExtractionFilters.test_modes  s    ^^sGGJ\G2GGKlG3GG&\G:GG%LG9GGILG1GGFG.GGO,G7  ww||GZ8,$$ %	$-55,,')-68<EH	0 ww|,44H&55cCG!)DLL!8!8sJ!)DLL!8!8sJIIl#
GGL)11ll#%)\\248LLA
(77<(00!DLL00s$t||33C#	$t||33C#	

O<<Z$'
|2j\G9"M  O[|</lC.\BY\:VF9+Rx*HI_$'	{"YKr&"J  L = 
E22Zl;[|</lC.\BY\:V,7_<@ 3 
F33"mmDLL""$,,-. /OZl;[|</lC.\BY\:V/:_?C 43E ^^ %$$  99x ;; MM #H I I  IIl# =<< 322 433s   BVV3$AX W <X  X 8 X X ?BX-BYCYV0	3W	X1X
X 	X

XX X*-X>	Y	Y&	c                |   \        4       ;_uu_ 4       pVP                  R \        P                  R7       RRR4       R Fm  pV P	                  XP                  4       V4      ;_uu_ 4        \        \        R4      '       d#   V P                  R \        P                  R7       M RRR4       Ko  	  V P	                  XP                  4       R4      ;_uu_ 4        V P                  \        P                  R4       RRR4       R#   + '       g   i     L; i  + '       g   i     K  ; i  + '       g   i     R# ; i)rQ  r}  Nmkfifor   z'foo' is a special file)r  rY   )r  r   r/   r  rk  r.   r   r}   rz  r  SpecialFileErrorr  s   &  r   	test_pipeTestExtractionFilters.test_pipe  s    ^^sGGE 0 0G1  -F##CHHJ772x(($$U1A1A$B  87 - 
F33!!(()+ 43 ^ 877 433s#   "D*:D!D*D	D'*D;	c                   \         P                  \         P                  \         P                  3 EF&  p\         P                  ! R 4      pWn        \         P                  ! VR4      pV P                  W24       \         P                  ! VR4      pV P                  VP
                  V4       V P                  \         P                  4      ;_uu_ 4       p\         P                  ! VR4       RRR4       V P                  XP                  P                  \         P                  4       V P                  VP                  P                  P                   R 4       EK)  	  R#   + '       g   i     L{; i)rQ  r   N)r/   r  r  rF  rW  r  r  rk  r  rn   rM  r  r  rz  r  rs   r   )r#   special_typers   trustedrY   r  s   &     r   test_special_files(TestExtractionFilters.test_special_files  s     $,,goowNLooe,G'L227B?GMM'+$$Wb1CSXX|4""7#;#;<<##GR0 =!!",,"6"6HR\\1166> O =<s   EE-c                   \         P                  P                  \        4      ;_uu_ 4       pVP	                  4        F+  p\         P
                  ! VR 4      pV P                  W24       K-  	  RRR4       R#   + '       g   i     R# ; i)r   N)r/   r0   r.   r+   r  r  rk  r#   rY   rs   filtereds   &   r   test_fully_trusted_filter/TestExtractionFilters.test_fully_trusted_filter  sW    __!!'**c>>+"77Dh0 , +***s   A A66B	c                   \         P                  P                  \        R R7      ;_uu_ 4       pVP	                  4        Fg  p \         P
                  ! VR4      pT P                  TP                  TP                  4       T P                  TP                  TP                  4       Ki  	  RRR4       R#   \         d     K  i ; i  + '       g   i     R# ; irU   r  r   N)
r/   r0   r.   r+   r  r  UnicodeEncodeErrorrk  r   r  r  s   &   r   test_tar_filter%TestExtractionFilters.test_tar_filter  s     __!!'K!@@C>>+&11'2>H hmmW\\:hmmW\\: , A@ * 	 A@@s0   CB4AC4C	?CC	CC	c                   \         P                  P                  \        R R7      ;_uu_ 4       pVP	                  4        Fg  p \         P
                  ! VR4      pT P                  TP                  TP                  4       T P                  TP                  TP                  4       Ki  	  RRR4       R#   \         P                  \        3 d     K  i ; i  + '       g   i     R# ; ir  )r/   r0   r.   r+   r  r  FilterErrorr  rk  r   r  r  s   &   r   test_data_filter&TestExtractionFilters.test_data_filter  s     __!!'K!@@C>>+&227B?H hmmW\\:hmmW\\: , A@  ++-?@ 	 A@@s0   CB4AC4C	CC	CC'	r  zrequires native bytes pathsc                   \         P                  ! \        P                  4      p\         P                  ! VR 4      pV P                  VP                  VP                  4       \         P                  ! VR 4      pV P                  VP                  VP                  4       \         P                  ! R4      pV P                  \        \         P                  VR 4       V P                  \        \         P                  VR 4       \         P                  ! R4      pV P                  \        \         P                  VR 4       V P                  \        \         P                  VR 4       R# )r   ztest    N)r/   rW  r	   TESTFNr  rk  r   r  rM  r  r  )r#   rs   r  s   &  r   test_filter_unencodable-TestExtractionFilters.test_filter_unencodable  s     //)"2"23%%gr2hmmW\\2&&w3hmmW\\2//*-*g&8&8'2F*g&9&97BG//(+,g.@.@'2N,g.A.A7BOr   c           	        \        R RR7      ;_uu_ 4       pVP                  R4       RRR4       \        P                  ! 4       ;_uu_ 4       pXP	                  RR^R7      pV P                  VP                  4       R.4       V P                  \        4      ;_uu_ 4        VP                  4        RRR4       V P                  \        P                  ! 4       . 4       VP	                  RR^ ^R	7      p\        P                  ! 4       ;_uu_ 4       pVP                  4        RRR4       V P                  \        P                  ! 4       . 4       V P                  R
XP                  4       4       RRR4       R#   + '       g   i     ELY; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r   r   r  u	   Nr  surrogatepass)rW   r  r  r#  )rW   r  r  debugztarfile: UnicodeEncodeError )r  r   r	   r   r.   rn   r?  rM  r  r  r}   listdirr   captured_stderrr  r   )r#   r  r  rY   stderrs   &    r   test_extract_unencodable.TestExtractionFilters.test_extract_unencodable#  s<    73DEEGG() F!!S((GO&'  )CS\\^hZ8""#566  7RZZ\2.((GO&'q  2C((**f  +RZZ\2.MM8&//:KL "! FEE 76 +* "!!sJ   E8AF2 F	1AF2F	!AF28F		FF2F/*F22G	c                    \         P                  ! \        R 4      pR pW!n        V P	                  VR4      ;_uu_ 4        V P                  R4       RRR4       R#   + '       g   i     R# ; i)rz   c                 ,    V P                   R 8X  d   V # R# ri   NrD  rs   r~   s   &&r   strict_filterSTestExtractionFilters.test_change_default_filter_on_instance.<locals>.strict_filter:      ||.r   Nri   )r/   r0   r+   r  rk  rz  )r#   rY   r3  s   &  r   &test_change_default_filter_on_instance<TestExtractionFilters.test_change_default_filter_on_instance8  sO    oogs+	
 !.T**_- +***s   AA,	c           	     x   R  p\         P                  ! \        R4      p\        P                  ! \         P                  R\        V4      4      ;_uu_ 4        V P                  VR4      ;_uu_ 4        V P                  R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c                 ,    V P                   R 8X  d   V # R# r1  rD  r2  s   &&r   r3  PTestExtractionFilters.test_change_default_filter_on_class.<locals>.strict_filterD  r5  r   rz   r  Nri   )r/   r0   r+   r   r   r  rk  rz  )r#   r3  rY   s   &  r   #test_change_default_filter_on_class9TestExtractionFilters.test_change_default_filter_on_classC  s    	
 oogs+w0C+M:< <##C..  1 /< <..< < <s$   B(1B	B(B% B((B9	c                     ! R  R\         P                  4      pV! \        R4      pV P                  VR4      ;_uu_ 4        V P	                  R4       RRR4       R#   + '       g   i     R# ; i)c                   &   a  ] tR tRt o R tRtV tR# )QTestExtractionFilters.test_change_default_filter_on_subclass.<locals>.TarSubclassiP  c                ,    VP                   R 8X  d   V# R# r1  rD  r#   rs   r~   s   &&&r   r  cTestExtractionFilters.test_change_default_filter_on_subclass.<locals>.TarSubclass.extraction_filterQ  s    <<?2"Nr   r&   N)r'   r(   r)   r*   r  r3   r4   r5   s   @r   TarSubclassr?  P  s        r   rC  rz   Nri   )r/   r0   r+   rk  rz  )r#   rC  rY   s   &  r   &test_change_default_filter_on_subclass<TestExtractionFilters.test_change_default_filter_on_subclassO  sP    	 '// 	  '3'T**_- +***s   AA.	c                    \         P                  ! \        R 4      pRVn        V P	                  VR4      ;_uu_ 4        V P                  \        4       RRR4       R#   + '       g   i     R# ; i)rz   r   N)r/   r0   r+   r  rk  r  rv  rB  s   & r   $test_change_default_filter_to_string:TestExtractionFilters.test_change_default_filter_to_string[  sJ    oogs+ &T**!!), +***s   AA.	c                  a  V 3R  lp\        4       ;_uu_ 4       pVP                  R4       VP                  R4       VP                  R4       RRR4       S P                  XP                  4       V4      ;_uu_ 4        S P	                  R4       S P	                  R4       RRR4       R#   + '       g   i     Le; i  + '       g   i     R# ; i)c                    < SP                  VSP                  4       V P                  R 8X  d   V P                  RR7      # V P                  R8X  d   R# V # )	move_thismovedrD  ignore_thisN)rk  r2  r   r>  )rs   r~   r#   s   &&r   custom_filter?TestExtractionFilters.test_custom_filter.<locals>.custom_filterb  sF    MM$-||{*G44||},Nr   rK  rM  keepNrL  r  )r#   rN  r  s   f  r   test_custom_filter(TestExtractionFilters.test_custom_filtera  s    	 ^^sGGK GGM"GGFO  
M::W%V$ ;:	 ^ ;::s   4B+>#B>+B;	>C	c                8   \        4       ;_uu_ 4       pVP                  R 4       RRR4       V P                  XP                  4       R4      ;_uu_ 4        V P	                  \
        4       RRR4       R#   + '       g   i     LX; i  + '       g   i     R# ; i)rQ  Nzbad filter name)r  r   rk  r.   r  r  r  s   & r   test_bad_filter_name*TestExtractionFilters.test_bad_filter_namer  s]    ^^sGGEN 
,=>>!!*- ?> ^>>>s   A5B5B	B	c           	     P    ! R  R4      p\        4       ;_uu_ 4       pVP                  R4       VP                  RRR7       VP                  R4       RRR4       V! 4       ;_uu_ 4       pV P                  XP                  4       V4      ;_uu_ 4        V P	                  R4       RRR4       RRR4       V P                  XP                  ^4       V P                  VP                  R4       R#   + '       g   i     L; i  + '       g   i     Le; i  + '       g   i     Lp; i)c                   2   a  ] tR tRt o R tR tR tRtV tR# )BTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilteri|  c                    ^ V n         V # )r   )num_files_processedr"   s   &r   rQ  LTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilter.__enter__}  s    +,(r   c                     \         P                  ! W4      pT ;P                  ^,          un        T#   \         P                   d     R # i ; ir   )r/   r  r  rZ  rA  s   &&&r   __call__KTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilter.__call__  sI     %11'@G ((A-( **   s   3 AAc                    R V n         R# )TN)done)r#   exc_infos   &*r   rT  KTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilter.__exit__  s	     	r   )r`  rZ  N)	r'   r(   r)   r*   rQ  r]  rT  r3   r4   r5   s   @r   StatefulFilterrX  |  s     ! !r   rc  goodbadr   r  NT)r  r   rk  r.   rz  rn   rZ  r`  )r#   rc  r  rN  s   &   r   test_stateful_filter*TestExtractionFilters.test_stateful_filterx  s    	! 	!  ^^sGGFOGGEcG*GGFO  ##CHHJ>>  ( ?  	::A>++T2 ^
 ?> s/   6C/*)DD	%D/C?	DDD%	c                   R  pR pR pR pR p\        4       ;_uu_ 4       pVP                  R4       RRR4       V P                  XP                  ^ R7      V4      ;_uu_ 4         RRR4       V P                  VP                  ^ R7      V4      ;_uu_ 4         RRR4       V P                  VP                  ^ R7      V4      ;_uu_ 4         RRR4       V P                  VP                  ^ R7      V4      ;_uu_ 4        V P	                  \
        P                  4       RRR4       V P                  VP                  ^ R7      V4      ;_uu_ 4        V P	                  \        4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4         RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \
        P                  4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \        4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \
        P                  4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \        4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \
        P                  4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \
        P                  4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \        4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \
        P                  4       RRR4       V P                  VP                  ^R7      V4      ;_uu_ 4        V P	                  \        4       RRR4       V P                  VP                  RR7      V4      ;_uu_ 4        V P	                  \        4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL_; i  + '       g   i     EL?; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELO; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELk; i  + '       g   i     EL-; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     R# ; i)	c                 .    \         P                  ! R 4      h)zfailed with ExtractError)r/   ExtractErrorr2  s   &&r   extracterror_filterBTestExtractionFilters.test_errorlevel.<locals>.extracterror_filter  s    &&'ABBr   c                 .    \         P                  ! R 4      h)zfailed with FilterError)r/   r  r2  s   &&r   filtererror_filterATestExtractionFilters.test_errorlevel.<locals>.filtererror_filter  s    %%&?@@r   c                     \        R 4      h)zfailed with OSError)r  r2  s   &&r   oserror_filter=TestExtractionFilters.test_errorlevel.<locals>.oserror_filter  s    /00r   c                 .    \         P                  ! R 4      h)zfailed with base TarError)r/   TarErrorr2  s   &&r   tarerror_filter>TestExtractionFilters.test_errorlevel.<locals>.tarerror_filter  s    ""#>??r   c                     \        R 4      h)zfailed with ValueError)r  r2  s   &&r   valueerror_filter@TestExtractionFilters.test_errorlevel.<locals>.valueerror_filter  s    566r   rq  Nr  zboo!)r  r   rk  r.   r  r/   rt  r  r  r  rj  rv  )r#   rk  rn  rq  ru  rx  r  s   &      r   test_errorlevel%TestExtractionFilters.test_errorlevel  sY   	C	A	1	@	7 ^^sGGFO 
 A 68KLL M A 68JKK L A 6GG H A 6HH!!'"2"23 I A 68IJJ!!*- K
 A 68KLL M A 68JKK!!'"5"56 L A 6GG!!'* H A 6HH!!'"2"23 I A 68IJJ!!*- K
 A 68KLL!!'"6"67 M A 68JKK!!'"5"56 L A 6GG!!'* H A 6HH!!'"2"23 I A 68IJJ!!*- K
 F ;=OPP!!), QPq ^^
 MLL LKK HGG IHH KJJ
 MLL LKK HGG IHH KJJ
 MLL LKK HGG IHH KJJ
 QPPs   R*&R>SS& S:TT" T6"U
* U<U2 V V(V.0 WW
W**R;	>S	S#	&S7	:T	T	"T3	6U	
U	U/	2V	V	V+	.V?	W	W'	*W;	)ri  rg  rh  )NNNNN)r  )6r'   r(   r)   r*   r  r  r|   rc  r2  r   rk  rz  r  r  r  r  r_  r  r	   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r  r   r  r%  r-  r6  r;  rD  rG  rQ  rT  rf  rz  r3   r4   r5   s   @r   rb  rb    s    
 ||G$z1H G'1t '1 '1R*0X
%/K2 00 00d ""FH # FHP T0 T0l : :::"  -  -D % %& @ @. 9 92 1: 1:f  , @ @>* ND`+$?1;
; __S\\W,.KLP MP __S\\W,.KLM MM(	.
2
.-%".3<E- E-r   rb  c                   t   a  ] tR tRt o ]P
                  P                  ]R4      t]	R 4       t
R tR tRtV tR# )OverwriteTestsi  testoverwritec                   \         P                  P                  \        R 4      ;qn        V P                  \        P                  V4       \        P                  ! VR4      ;_uu_ 4       p\        P                  ! R4      p^
Vn        VP                  V\        P                  ! R4      4       RRR4       \         P                  P                  \        R4      ;qn        V P                  \        P                  V4       \        P                  ! VR4      ;_uu_ 4       pVP                  VP!                  \         P"                  R4      4       RRR4       \         P                  P                  \        R4      pWn        V P                  \        P                  V4       \        P                  ! VR4      ;_uu_ 4       p\        P                  ! R4      p^
Vn        VP                  V\        P                  ! R4      4       RRR4       R#   + '       g   i     ELi; i  + '       g   i     L; i  + '       g   i     R# ; i)ztar-with-file.tarr   r  s
   newcontentNztar-with-dir.tarztar-with-implicit-dir.tarz	test/file)r}   r~   r   r|   ar_with_fileaddClassCleanupr	   r  r/   r.   rW  rp   r^  r,   r   ar_with_dirrF  curdirar_with_implicit_dir)r[  r  rY   ra  s   &   r   r\  OverwriteTests.setUpClass  sw   !ww||G5HIII,,a0\\!S!!S'AAFKK2::m45 "
 !ggll74FGGOI,,a0\\!S!!SKKryy&9: " GGLL"=>#$ I,,a0\\!S!!S,AAFKK2::m45 "! "!! "! "!!s&   *AH0H" AH5H	"H2	5I	c                0    \         P                  ! VR 4      # )rz   )r/   r.   )r#   r~   s   &&r   r.   OverwriteTests.open  s    ||D#&&r   c                @    VP                  V P                  R R7       R# )r  rx   N)r  testdir)r#   ars   &&r   r  OverwriteTests.extractall  s    
dll?;r   r&   N)r'   r(   r)   r*   r}   r~   r   r|   r  r|  r\  r.   r  r3   r4   r5   s   @r   r}  r}    s:     ggll7O4G6 6*'< <r   r}  c                   H	  a  ] tR tRt o ]t]P                  ]P                  ,          R,           ]	,           ]P                  ,           R,           ]	,           ]P                  ,           R,           ]	,           ]P                  ,           R,           ]	,           ]P                  ^,          ,           ]	,           R,           ]P                  ,           ]P                  ,           ]P                  ]P                  ,          ,           ]P                  ,           ]P                  ^ ,          ,           ]P                  ^ ,          ,           ]P                  ^,          ,           ]	,           ]P                  ,           ]P                  ^,          ,           ]	,           ]P                  ,           ]P                  ]P                  ,          ,           ]P                  ^,          ,           t]P                  ]P                  ,          R,           ]P                  ,           R,           ]P                  ,           R,           ]P                  ,           R,           ]	,           ]P                  ^,          ,           ]	,           R,           ]P                  ,           ]P                  ,           ]P                  ]P                  ,          ,           ]P                  ,           ]P                  ^ ,          ,           ]P                  ^ ,          ,           ]P                  ^,          ,           ]P                  ^,          ,           ]P                  ^,          ,           t]P                  ]P                  ,          R,           ]	,           ]P                  ,           R,           ]	,           ]P                  ,           R,           ]	,           ]P                  ,           R,           ]	,           ]P                  ^,          ,           ]	,           R	,           ]P                  ,           ]P                  ,           ]P                  ]P                  ,          ,           ]P                  ^,          ,           t]P$                  ! R
4      P'                  ]P(                  4      tR]P,                  ,          tR tRR ltR tR tR tR tR tRtV t R# )OffsetValidationTestsi  s   000755s   000001   s   0011407s   0000755s   0000001s   0011327s   0010070r  c                    \        V P                  R 4      ;_uu_ 4       pVP                  V4       RRR4       R#   + '       g   i     R# ; irL  )r.   r+   rV  )r#   bufferr  s   && r   _write_buffer#OffsetValidationTests._write_buffer[  s/    $,,%%GGFO &%%%r^  Nc           	     .   \        V P                  R 4      ;_uu_ 4       p\        P                   ! RW!R7      ;_uu_ 4       pVP                  4       uuRRR4       uuRRR4       #   + '       g   i     M; i RRR4       R#   + '       g   i     R# ; i)r   rz   )r$   ry  rR  N)r.   r+   r/   r  )r#   rR  r  rY   s   &&  r   _get_members"OffsetValidationTests._get_members_  si    $,,%%! ~~'  &%   &%%%s#   !B A%	
B%A50BB	c                    V P                  \        P                  R 4      ;_uu_ 4        V P                  4        RRR4       R#   + '       g   i     R# ; i)re  N)rG  r/   rA  r  r"   s   &r   #_assert_raises_read_error_exception9OffsetValidationTests._assert_raises_read_error_exceptionf  sD    ##F
 
 
 
 
 
s   AA	c                   R V P                   3RV P                  3RV P                  33 FI  w  rV P                  VR7      ;_uu_ 4        V P	                  V4       V P                  4        RRR4       KK  	  R#   + '       g   i     K`  ; i)posixr  v7r  N)invalid_posix_headerinvalid_gnu_headerinvalid_v7_headerr&  r  r  )r#   
tar_formatinvalid_headers   &  r   &test_invalid_offset_header_validations<OffsetValidationTests.test_invalid_offset_header_validationsl  s|    d//0D++,4))*+
&J
 Z00"">288: 10+

 100s   	"A99B
c                f   V P                   V P                  ,           V P                   ,           pV P                  V4       V P                  4       pV P	                  \        V4      ^4       V P	                  V^ ,          P                  R4       V P	                  V^ ,          P                  ^ 4       R# )r  r  N)valid_gnu_headerr  r  r  rn   ro   r   r  r#   r  r  s   &  r   (test_early_stop_at_invalid_offset_header>OffsetValidationTests.test_early_stop_at_invalid_offset_headerv  s    &&)@)@@4CXCXX6"##%Wq)*5**A.r   c                    V P                   V P                  ,           ^,          pV P                  V4       V P                  RR7      pV P	                  \        V4      ^ 4       R# )r  TrR  N)r  
data_blockr  r  rn   ro   r  s   &  r   test_ignore_invalid_archive1OffsetValidationTests.test_ignore_invalid_archive~  sP    ))DOO;q@6"###6Wq)r   c                   V P                   V P                  V P                  ,           ^ 3V P                  V P                  ,           V P                   R33 F  w  rpV P                  W,           4       V P	                  RR7      pV P                  \        V4      ^4       V P                  V^ ,          P                  R4       V P                  V^ ,          P                  V4       K  	  R# )r   r   Tr  r  N)	r  r  r  r  r  rn   ro   r   r  )r#   first_blocksecond_blockexpected_offsetr  s   &    r   "test_ignore_invalid_offset_headers8OffsetValidationTests.test_ignore_invalid_offset_headers  s     &&((4??: ((4??:&&;
6K {9:''T':GS\1-WQZ__j9WQZ..@!;
r   r&   s   r   )!r'   r(   r)   r*   r   r+   r/   r  r  SPACErG  r  r  r  r  r  r  r  rW  rX  r  r  r5  r  r  r  r  r  r  r  r  r3   r4   r5   s   @r   r  r    s=    G 	g)))
		%kk	* 		 		 &kk		* 	 	 &kk	* 	 	 ++

	 #
	# 	 {{	# //	  ++++
+!	,$ 

%	( ++
)	, ++
-	0 ++/1	0 "1	"0 %,KK1	04 ++/5	4 "5	"4 %,KK5	08 ++--
-9	.< ++
=	 H 	g)))
	{{	# 		 {{		# 	 {{	# 	 	 ++

	 #
	# 	 {{	# //	  ++++
+!	,$ 

%	( ++
)	, ++
-	0 ++/1	4 ++/5	8 ++
9	 D 	g)))
		%kk	* 		 		 &kk		* 	 	 &kk	* 	 	 ++

	 #
	# 	 {{	# //	  ++++
+!	,$ ++
%	 , z2889K9KL7,,,J( ;/*A Ar   r  c                     \         P                  ! \        4       \        P                  ! \        4       \
        .s\        \
        R 4      ;_uu_ 4       p V P                  4       pRRR4       \        \        \        \        3 F  pVP                  '       g   K  \         P                  ! VP
                  4       \        P                  VP
                  4       VP                  VP
                  R4      ;_uu_ 4       pVP                  X4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)r   Nr-  )r	   r  r|   r}   r  r+   r  r.   rm   r8   r?   rE   rL   rR  rV  )rt   r   r  rY   s       r   setUpModuler    s    WKK 9L	gt		yy{ 
 w(2666QYY'		*		4((C		$ )(	 3	 
	 )((s   D=D0D-	0Ec                      \         P                  P                  \        4      '       d   \        P
                  ! \        4       R # R # r   )r}   r~   r  r|   r	   r  r&   r   r   tearDownModuler    s(    	ww~~g! r   __main__)r  r   r}   r,   hashlibr   
contextlibr   r   randomr   r  r  r,  r  r  r   unittest.mockr/   r  r   r   test.supportr	   r
   r   r;   r  r  r@   rH   compressionr   r   r~   r|  r$  r|   r(  rf  r+   r   r:   rA   rG   rN   r   r  r  rq   r  r   requires_gzipr8   r
  r?   requires_lzmarE   requires_zstdrL   rR   rb   TestCaserg   r   r   r   r   r   r#  r%  r'  r)  r+  ru  r  r!  r#  r%  r'  r)  rC  rE  rG  rI  rK  rQ  rS  rU  rW  rY  rn  rp  rw  ry  r{  r  r  r  r  r.  r9  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r@  rU  r~  r  r  r  r  r   r   r  r  r  r  r  r  r  r(  rU  rW  rY  r[  r]  rk  r  r=  r  rQ  rf  r  r  r  r  r  r  r  r  r  rI  r  r  r_  rb  r}  r  r  r  r'   r  r&   r   r   <module>r     s	    
 	 	  0    	        " & ( $ ''//)**
+i
7o%	


=1B
C77<<!12
'',,w 1
2	g/	0
'',,w 1
2
'',,w	
*ggll7I. G  G 
) ) 	% % % 	& & & 	% % % 	& & &	w 	-X -UHh// Un	- 		w 		- 		- 	Y1x** Y1x	8X 		'8 		8X 		8X 	Z1X Z1zb.~ b.H	#X%6%6 	x!183D3D 		g/1B1B 		x!183D3D 		x!183D3D 	<^X%6%6 <|	> 		 		> 		> 	/NH,=,= /	X'< 		G%: 		X'< 		X'< 	&1Wh// &1P	> 	, ,	> 		> 	1x1B1B 1"^EXx00 ^EB6O 6Op9,(*;*; 9xT@,(*;*; T@nGG G<~%x00 ~%B
	Hi 		7I 		Hi 		Hi 	(%mX%6%6 (%V7(O 78/ 8;(O ;;(O ;?7 ?,!7$8(:K:K !!*>! (%98;L;L   *> C(++ C$O58$$ O5d+&}h&7&7 +&\W. 1 1 W.tXz GZ %Xz %%Xz %(* ( 
WR(*KL'18$$ '1 M'1TH8< H8VN NbL{H$5$5 L^G[("3"3 G$K[("3"3 K(I I(>%!2!2 >%@	X~x/@/@ 		G^X->-> 		X~x/@/@ 		X~x/@/@ 	8*"" 8*vs&x   s&la h'' a H7B** 7Bt 
V$&FG@("3"3 @ H@B*("3"3 *>	 
WR)+=>	WR+-ABwOx(( wO C ?wOt%-8X.. %-Pd8 dL 4h6G6G ((<(0(9(9(3X5F5F #7#+#4#4^8** ^8@8D3 D3V ???CP-H-- P-f<^22H4E4E <@XAH-- XAv "" zMMO gT  D  D  
C  D  DsZ   $d )d .d! 3d1 8e 	dd	dd!	d.-d.1	d>=d>	ee