Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.11/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.11/test/__pycache__/test_tarfile.cpython-311.opt-1.pyc

�

SԚg�y��"�ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZddlmZddlmZddlmZdd	lmZ	ddlZn
#e$rdZYnwxYw	ddlZn
#e$rdZYnwxYw	ddlZn
#e$rdZYnwxYw	ddlZn
#e$rdZYnwxYwd
�Zej� ej!��dzZ"e"dzZ#ej$d
��Z%ej�&e"d��Z'ej�&e"d��Z(ej�&e"d��Z)ej�&e"d��Z*ej�&e"d��Z+dZ,dZ-Gd�d��Z.ej/��Gd�d����Z0ej1��Gd�d����Z2ej3��Gd�d����Z4Gd�de.��Z5Gd�d e5ej6��Z7Gd!�d"e0e7��Z8Gd#�d$e2e7��Z9Gd%�d&e4e7��Z:Gd'�d(e5ej6��Z;Gd)�d*e0e;��Z<Gd+�d,e2e;��Z=Gd-�d.e4e;��Z>Gd/�d0e5��Z?Gd1�d2e?��Z@Gd3�d4e@ej6��ZAGd5�d6e0e@ej6��ZBGd7�d8e2e@ej6��ZCGd9�d:e4e@ej6��ZDGd;�d<e?ej6��ZEGd=�d>e0eE��ZFGd?�d@e2eE��ZGGdA�dBe4eE��ZHGdC�dDe.ej6��ZIGdE�dFe0eI��ZJGdG�dHe2eI��ZKGdI�dJe4eI��ZLGdK�dLe0ej6��ZMGdM�dNe5ej6��ZNGdO�dP��ZOGdQ�dReOe5ej6��ZPGdS�dTeOe5ej6��ZQGdU�dVe.��ZRGdW�dXeRej6��ZSGdY�dZe0eS��ZTGd[�d\e2eS��ZUGd]�d^e4eS��ZVGd_�d`eRej6��ZWGda�dbe0eW��ZXGdc�dde2eW��ZYGde�dfe4eW��ZZGdg�dhej6��Z[Gdi�djeRej6��Z\Gdk�dleRej6��Z]Gdm�dne0e]��Z^Gdo�dpe2e]��Z_Gdq�dre4e]��Z`Gds�dte]��Zaejbecedu��dv��Gdw�dxej6����ZdGdy�dze[��ZeGd{�d|��ZfGd}�d~efej6��ZgGd�d�efej6��ZhGd��d�efej6��ZiGd��d���ZjGd��d�ejej6��ZkGd��d�e0ejej6��ZlGd��d�e2ejej6��ZmGd��d�e4ejej6��ZnGd��d�ej6��ZoGd��d�ej6��ZpGd��d�ej6��ZqGd��d�ej6��Zrejsecedu��d���Gd��d�e5ej6����ZtGd��d�e2ej6��Zud��Zvejbeced���d���ejbeced���d���Gd��d�ej6������ZwGd��d�e5ej6��ZxGd��d�e5��ZyGd��d�eyej6��ZzGd��d�eyej6��Z{Gd��d�eyej6��Z|Gd��d�eyej6��Z}Gd��d�ej6��Z~d��ZGd��d���Z�ej�rd��Z�nd��Z�Gd��d�ej6��Z�Gd��d�ej�ej6��Z�d��Z�d��Z�e�d�krej���dSdS)��N)�sha256)�contextmanager)�Random)�archiver_tests)�support)�	os_helper)�
script_helper)�warnings_helperc�D�t|�����S�N)r�	hexdigest)�datas �./usr/local/lib/python3.11/test/test_tarfile.py�	sha256sumr*s���$�<�<�!�!�#�#�#�z-tardirz
-extract-testztesttar.tarztesttar.tar.gzztesttar.tar.bz2�testtar.tar.xzztmp.tar�testtar�@e09e4bc8b3c9d9177e77256353b36c159f5f040531bbd4b024a8f9b9196c71ce�@4f05a776071146756345ceee937b33fc5644f5a96b9780d1c7d6a32cdf164d7bc�R�eZdZeZdZejZej	j
Z
ed���ZdS)�TarTest�c� �|j|jzSr)�prefix�suffix��selfs r�modezTarTest.modeDs���{�T�[�(�(rN)
�__name__�
__module__�__qualname__�tarnamer�io�FileIO�open�tarfile�TarFile�taropen�propertyr�rrrr>sH�������G�
�F�
�9�D��o�%�G�
�)�)��X�)�)�)rrc�D�eZdZeZdZerejndZe	j
jZdS)�GzipTest�gzN)
rr r!�gzipnamer"r�gzip�GzipFiler%r&r'�gzopenr(r*rrr,r,Hs2�������G�
�F� �*�4�=�=�d�D��o�$�G�G�Grr,c�D�eZdZeZdZerejndZe	j
jZdS)�Bz2Test�bz2N)
rr r!�bz2namer"rr4�BZ2Filer%r&r'�bz2openr(r*rrr3r3Os2�������G�
�F��'�3�;�;�4�D��o�%�G�G�Grr3c�D�eZdZeZdZerejndZe	j
jZdS)�LzmaTest�xzN)
rr r!�xznamer"r�lzma�LZMAFiler%r&r'�xzopenr(r*rrr9r9Vs2�������G�
�F� �*�4�=�=�d�D��o�$�G�G�Grr9c��eZdZdZd�Zd�ZdS)�ReadTest�r:c�R�tj|j|jd���|_dS)N�	iso8859-1�r�encoding�r&r%r"r�tarrs r�setUpzReadTest.setUpbs)���<���4�9�)4�6�6�6����rc�8�|j���dSr)rG�closers r�tearDownzReadTest.tearDownfs����������rN)rr r!rrHrKr*rrr@r@^s7������
�F�6�6�6�����rr@c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zejeed
��oeed��d��d���ZdS)�
UstarReadTestc�l�|j�d��}|j�|��5}|���}|�t|��|jd��|�t|��td��ddd��dS#1swxYwYdS)N�
ustar/regtype�regular file extraction failed)	rG�	getmember�extractfile�read�assertEqual�len�sizer�sha256_regtype�r�tarinfo�fobjrs    r�test_fileobj_regular_filez'UstarReadTest.test_fileobj_regular_filels����(�$�$�_�5�5��
�X�
!�
!�'�
*�
*�	6�d��9�9�;�;�D����S��Y�Y���4�
6�
6�
6����Y�t�_�_�n�4�
6�
6�
6�		6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�	6�	6s�A'B)�)B-�0B-c��|j�dtd���|j�d��}t	t
j�td��d��5}|���}ddd��n#1swxYwY|j�	|��5}tj|��}|���}|�||d��|�t|��dd��|�|ddd��ddd��dS#1swxYwYdS)	NrOr��filter�rzfileobj.readlines() failed�r�SzOI will gladly admit that Python is not the fastest running scripting language.
)rG�extract�TEMPDIRrQr%�os�path�join�	readlinesrRr#�
TextIOWrapperrTrU)rrY�fobj1�lines1rZ�fobj2�lines2s       r�test_fileobj_readlinesz$UstarReadTest.test_fileobj_readlinesus��������'�&��A�A�A��(�$�$�_�5�5��
�"�'�,�,�w��8�8�#�
>�
>�	'�%��_�_�&�&�F�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��X�
!�
!�'�
*�
*�
	2�d��$�T�*�*�E��_�_�&�&�F����V�V�0�
2�
2�
2����S��[�[�#�0�
2�
2�
2����V�B�Z�4�0�
2�
2�
2�
	2�
	2�
	2�
	2�
	2�
	2�
	2�
	2�
	2�
	2�
	2�
	2����
	2�
	2�
	2�
	2�
	2�
	2s%�0B�B�B�6BE�E�Ec��|j�dtd���|j�d��}t	t
j�td��d��5}|���}ddd��n#1swxYwY|j�	|��5}ttj|����}|�
||d��ddd��dS#1swxYwYdS)NrOrr]r_zfileobj.__iter__() failed)rGrbrcrQr%rdrerfrgrR�listr#rhrT)rrYrirjrkrls      r�test_fileobj_iterzUstarReadTest.test_fileobj_iter�sc�������'�&��A�A�A��(�$�$�_�5�5��
�"�'�,�,�w��8�8�#�
>�
>�	'�%��_�_�&�&�F�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�
�X�
!�
!�'�
*�
*�	1�e��"�*�5�1�1�2�2�F����V�V�/�
1�
1�
1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s$�0B�B�B�69C<�<D�Dc��|j�dtd���ttj�td��d��5}|���}ddd��n#1swxYwY|j�d��}|j�	|��5}|���}|�
d��|�d|���d��|�
dd��|�d|���d��|�
d	d
��|�d|���d��|�
dd
��|�d|���d
��|�d��}|�||dd�d��|�
dd��|�|j
|���d��|�|���dd��|�
|j
d��|�d|���d��|�
d��|���}|�
d��|���}|�||d��|�
d��|�t|�����|���d��|�
d��|�t|�����dz|���d��|�
d��|���}|�|���|t|��d�d��ddd��dS#1swxYwYdS)NrOrr]�rbrzseek() to file's start failediz"seek() to absolute position failedi�����z+seek() to negative relative position failedz+seek() to positive relative position failed�
i
zread() after seek failed�zseek() to file's end failedrz0read() at file's end did not return empty stringz$relative seek() to file's end failed�zreadlines() after seek failedztell() after readline() failedz)tell() after seek() and readline() failedzread() after readline() failed)rGrbrcr%rdrerfrSrQrR�seekrT�tellrVrgrU�readline)	rrZrrY�text�s�s1�s2�lines	         r�test_fileobj_seekzUstarReadTest.test_fileobj_seek�sM�������'� &�	�	(�	(�	(�
�"�'�,�,�w��8�8�$�
?�
?�	�4��9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��(�$�$�_�5�5��
�X�
!�
!�'�
*�
*�(	;�d��9�9�;�;�D��I�I�a�L�L�L����Q��	�	���8�
:�
:�
:��I�I�d�A�������T�4�9�9�;�;�=�
?�
?�
?��I�I�e�Q�������T�4�9�9�;�;�F�
H�
H�
H��I�I�d�A�������T�4�9�9�;�;�F�
H�
H�
H��	�	�"�
�
�A����Q��T�$�Y��3�
5�
5�
5��I�I�a��O�O�O����W�\�4�9�9�;�;�6�
8�
8�
8����T�Y�Y�[�[�#�K�
M�
M�
M��I�I�w�|�m�Q�'�'�'����Q��	�	���?�
A�
A�
A��I�I�c�N�N�N����!�!�B��I�I�c�N�N�N����!�!�B����R��8�
:�
:�
:��I�I�a�L�L�L����S������1�1�4�9�9�;�;�9�
;�
;�
;��I�I�c�N�N�N����S������1�1�C�7������D�
F�
F�
F��I�I�a�L�L�L��=�=�?�?�D����T�Y�Y�[�[�$�s�4�y�y�z�z�*:�9�
;�
;�
;�O(	;�(	;�(	;�(	;�(	;�(	;�(	;�(	;�(	;�(	;�(	;�(	;����(	;�(	;�(	;�(	;�(	;�(	;s%�A7�7A;�>A;�6NQ�Q
�
Q
c��|j�d��5}tj|��}|����d��}|�t|��t��	|�	d��n%#t$r|�d��YnwxYwddd��dS#1swxYwYdS)NrOrC�dzseeking failed in text mode)rGrRr#rhrS�encoderTrrWrx�AttributeError�fail�rrZrs   r�test_fileobj_textzUstarReadTest.test_fileobj_text�s��
�X�
!�
!�/�
2�
2�		9�d��#�D�)�)�D��9�9�;�;�%�%�k�2�2�D����Y�t�_�_�n�=�=�=�
9��	�	�#������!�
9�
9�
9��	�	�7�8�8�8�8�8�
9����
		9�		9�		9�		9�		9�		9�		9�		9�		9�		9�		9�		9����		9�		9�		9�		9�		9�		9s6�A$C�B�C�B8�5C�7B8�8C�C�Cc��|j�|��5}|j�|��5}|�|j|j��ddd��n#1swxYwYddd��dS#1swxYwYdSr)rGrRrT�name)r�lnktype�regtype�a�bs     r�_test_fileobj_linkz UstarReadTest._test_fileobj_link�s���
�X�
!�
!�'�
*�
*�	-�a�
�X�
!�
!�'�
*�
*�	-�./����Q�V�Q�V�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s4�A;�!A#�A;�#A'	�'A;�*A'	�+A;�;A?�A?c�2�|�dd��dS)N�
ustar/lnktyperO�r�rs r�test_fileobj_link1z UstarReadTest.test_fileobj_link1���������A�A�A�A�Arc�2�|�dd��dS)N�./ustar/linktest2/lnktype�ustar/linktest1/regtyper�rs r�test_fileobj_link2z UstarReadTest.test_fileobj_link2��*����� ;� 9�	;�	;�	;�	;�	;rc�2�|�dd��dS)N�
ustar/symtyperOr�rs r�test_fileobj_symlink1z#UstarReadTest.test_fileobj_symlink1�r�rc�2�|�dd��dS)N�./ustar/linktest2/symtyper�r�rs r�test_fileobj_symlink2z#UstarReadTest.test_fileobj_symlink2�r�rc�2�|�dd��dS)N�symtype2rOr�rs r�test_issue14160zUstarReadTest.test_issue14160�s�����
�O�<�<�<�<�<rc�Z�|�d��|�d��dS)N�bar�eaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)�add_dir_and_getmemberrs r�test_add_dir_getmemberz$UstarReadTest.test_add_dir_getmember�s0���"�"�5�)�)�)��"�"�7�+�+�+�+�+r�getuid�getgidz'Missing getuid or getgid implementationc	��d�}tj��5tjtd��5}tj|_	tj|��|�	||���tj
|��n#tj
|��wxYw	ddd��n#1swxYwYtjt��5}|�|�|��|�|dz����ddd��n#1swxYwYddd��dS#1swxYwYdS)Nc�"�dx|_|_|S)Nr�)�uid�gid�rYs rr^z3UstarReadTest.add_dir_and_getmember.<locals>.filter�s��(+�+�G�K�'�+��Nr�wr]�/)
r�temp_cwdr&r%�tmpname�USTAR_FORMAT�formatrd�mkdir�add�rmdirrTrQ)rr�r^rGs    rr�z#UstarReadTest.add_dir_and_getmember�s���	�	�	��
�
!�
!�	�	���g�s�+�+�
#�s�$�1��
�#��H�T�N�N�N��G�G�D��G�0�0�0��H�T�N�N�N�N��B�H�T�N�N�N�N����N�

#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#���g�&�&�
�#�� � ��M�M�$�'�'��M�M�$��*�-�-����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	sq�D3�B+�+B�0B+�B�B+�D3�+B/	�/D3�2B/	�3D3�AD�D3�D	�D3�"D	�#D3�3D7�:D7N)rr r!r[rmrpr�r�r�r�r�r�r�r�r��unittest�
skipUnless�hasattrrdr�r*rrrMrMjs"������6�6�6�2�2�2�$1�1�1�/;�/;�/;�b
9�
9�
9�-�-�-�
B�B�B�;�;�;�B�B�B�;�;�;�=�=�=�,�,�,�
�X�����X�.�.�H�7�7�2�x�3H�3H�B�D�D���D�D���rrMc��eZdZdS)�GzipUstarReadTestN�rr r!r*rrr�r���������Drr�c��eZdZdS)�Bz2UstarReadTestNr�r*rrr�r�r�rr�c��eZdZdS)�LzmaUstarReadTestNr�r*rrr�r�r�rr�c�&�eZdZd�Zd�Zd�Zd�ZdS)�ListTestc�P�tj|j|j���|_dS)N�rrFrs rrHzListTest.setUps ���<���4�9�=�=�=����rc�d��tjtj��dd���}tjt
d|��5�j�d���ddd��n#1swxYwY|����	��}��
d|����
d|����
d	|����
d
|����
d|����
d|����
d
|����
d|���fd�}��
|d��|����
|d��|����
|d��|����
|d��|����
|d��|����|d����d|����d|��dS)N�ascii�
��newline�stdoutF��verbose�ustar/conttype�
ustar/regtypes
ustar/lnktypesustar/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/longnames./ustar/linktest2/symtypes./ustar/linktest2/lnktypesustar/dirtype/sustar/dirtype-with-size/c�p��|��jjd��}|�dd��S)N�surrogateescaper��backslashreplace)�decoderGrEr�)r�r|rs  �r�convz ListTest.test_list.<locals>.conv s1��������*�,=�>�>�A��8�8�G�%7�8�8�8rsustar/umlauts-�����s'misc/regtype-hpux-signed-chksum-�����s)misc/regtype-old-v7-signed-chksum-�����spax/bad-pax-�spax/hdrcharset-�s)ustar/conttype ?\r?\nustar/regtype ?\r?\nslink tos->)
r#rh�BytesIOr�	swap_attr�sysrGro�detach�getvalue�assertIn�assertRegex�assertNotIn)r�tio�outr�s`   r�	test_listzListTest.test_lists������r�z�|�|�W�d�C�C�C��
�
�s�H�c�
2�
2�	)�	)��H�M�M�%�M�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)��j�j�l�l�#�#�%�%���
�
�'��-�-�-��
�
�&��,�,�,��
�
�&��,�,�,��
�
�B�C�H�H�H��
�
�2�C�8�8�8��
�
�2�C�8�8�8��
�
�'��-�-�-��
�
�1�3�7�7�7�	9�	9�	9�	9�	9�	
�
�
�d�d�H�I�I�3�O�O�O��
�
�d�d�;�<�<�=@�	B�	B�	B��
�
�d�d�;�<�<�=@�	B�	B�	B��
�
�d�d�6�7�7��=�=�=��
�
�d�d�9�:�:�C�@�@�@�	
����7�	8�	8�	8�	
����S�)�)�)������$�$�$�$�$s�A-�-A1�4A1c�F�tjtj��dd���}tjt
d|��5|j�d���ddd��n#1swxYwY|����	��}|�
|d��|�d|��|�d	|��|�d
|��|�d|��|�d|��dS)
Nr�r�r�r�Tr�s�\?rw-r--r-- tarfile/tarfile\s+7011 \d{4}-\d\d-\d\d\s+\d\d:\d\d:\d\d ustar/\w+type ?\r?\n\?rw-r--r-- tarfile/tarfile\s+7011 \d{4}-\d\d-\d\d\s+\d\d:\d\d:\d\d ustar/\w+type ?\r?\nsustar/symtype -> regtypes1./ustar/linktest2/symtype -> ../linktest1/regtypes;./ustar/linktest2/lnktype link to ./ustar/linktest1/regtypes	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#rhr�rr�r�rGror�r�r�r�)rr�r�s   r�test_list_verbosezListTest.test_list_verbose6si����r�z�|�|�W�d�C�C�C��
�
�s�H�c�
2�
2�	(�	(��H�M�M�$�M�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(��j�j�l�l�#�#�%�%��	
����=�	>�	>�	>�	
�
�
�1�3�7�7�7��
�
�J�C�P�P�P��
�
�3�47�	9�	9�	9��
�
�5�69�	;�	;�	;��
�
�5�69�	;�	;�	;�	;�	;s�A,�,A0�3A0c��tjtj��dd���}d�}tjt
d|��5|j�d||j�����ddd��n#1swxYwY|����	��}|�
d|��|�d	|��dS)
Nr�r�r�c3�RK�|���D]}d|jvr|V��dS)N�reg)�
getmembersr�)rGrYs  r�membersz+ListTest.test_list_members.<locals>.membersPs@�����>�>�+�+�
"�
"���G�L�(�(�!�M�M�M��
"�
"rr�F)r�r�r�r�)r#rhr�rr�r�rGror�r�r�r�)rr�r�r�s    r�test_list_memberszListTest.test_list_membersNs����r�z�|�|�W�d�C�C�C��	"�	"�	"��
�s�H�c�
2�
2�	D�	D��H�M�M�%�����1B�1B�M�C�C�C�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D����	D�	D�	D�	D��j�j�l�l�#�#�%�%���
�
�&��,�,�,����*�C�0�0�0�0�0s�+A>�>B�BN)rr r!rHr�r�r�r*rrr�r�sQ������>�>�>�#%�#%�#%�J;�;�;�0
1�
1�
1�
1�
1rr�c��eZdZdS)�GzipListTestNr�r*rrr�r�[r�rr�c��eZdZdS)�Bz2ListTestNr�r*rrr�r�_r�rr�c��eZdZdS)�LzmaListTestNr�r*rrr�r�cr�rr�c�J�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�CommonReadTestc�P�ttd��5	ddd��n#1swxYwY|�tjt����|�tjtjt������ttd��5}|�tj|����ddd��n#1swxYwY|�tjtjd������dS)N�wbrrsinvalid)	r%r��assertFalser&�
is_tarfile�pathlib�Pathr#r��rrZs  r�test_is_tarfile_erroneousz(CommonReadTest.test_is_tarfile_erroneousisj��
�'�4�
 �
 �	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
����+�G�4�4�5�5�5�	
����+�G�L��,A�,A�B�B�C�C�C��'�4�
 �
 �	7�D����W�/��5�5�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	
����+�B�J�z�,B�,B�C�C�D�D�D�D�Ds�$�(�(�.(C"�"C&�)C&c	�t�|�tj|j����|�tjt	j|j������t
|jd��5}|�tj|����ddd��n#1swxYwYt
|jd��5}|�tjtj|�	��������ddd��dS#1swxYwYdS)Nrr)
�
assertTruer&r�r"r�r�r%r#r�rSr�s  r�test_is_tarfile_validz$CommonReadTest.test_is_tarfile_validzs�������*�4�<�8�8�9�9�9�	
����*�7�<���+E�+E�F�F�G�G�G��$�,��
%�
%�	6���O�O�G�.�t�4�4�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6��$�,��
%�
%�	I���O�O�G�.�r�z�$�)�)�+�+�/F�/F�G�G�H�H�H�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�	I�	Is%�(B4�4B8�;B8�AD-�-D1�4D1c��t|jd��5}tj|��|�|���d��ddd��n#1swxYwYt|jd��5}t
j|�����}tj|��|�|���d��ddd��dS#1swxYwYdS)Nrrr)	r%r"r&r�rTryr#r�rS)rrZ�	file_likes   r�test_is_tarfile_keeps_positionz-CommonReadTest.test_is_tarfile_keeps_position�sT���$�,��
%�
%�	-����t�$�$�$����T�Y�Y�[�[�!�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-��$�,��
%�
%�	2���
�4�9�9�;�;�/�/�I���y�)�)�)����Y�^�^�-�-�q�1�1�1�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�	2�	2s$�=A�A#�&A#�?A#C/�/C3�6C3c��tjt|j�dd����5	ddd��n#1swxYwY	tjt|j��}|���|�|���g��n*#tj$r|�	d��YnwxYw|�
��dS#|�
��wxYw)Nr_r�z&tarfile.open() failed on empty archive)r&r%r�r�replace�getnames�assertListEqualr��	ReadErrorr�rJ�rrGs  r�test_empty_tarfilez!CommonReadTest.test_empty_tarfile�s,��
�\�'�4�9�#4�#4�S�#�#>�#>�
?�
?�	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	��,�w��	�2�2�C��L�L�N�N�N�
� � ����!1�!1�2�6�6�6�6��� �	@�	@�	@��I�I�>�?�?�?�?�?�	@����

�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s;�A�A�	A�3B*�)C*�*$C�C*�C�C*�*Dc��|�td��5tjd|j��ddd��dS#1swxYwYdS)N�xxx)�assertRaisesRegex�FileNotFoundErrorr&r%rrs r�test_non_existent_tarfilez(CommonReadTest.test_non_existent_tarfile�s����
#�
#�$5�u�
=�
=�	+�	+��L���	�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�A�A�Ac�.�ttd��5	ddd��n#1swxYwY|�tjtjt|j��|�tjtjt��dS�Nr�)r%r��assertRaisesr&rrrs r�test_null_tarfilez CommonReadTest.test_null_tarfile�s����'�4�
 �
 �	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����'�+�W�\�7�D�I�N�N�N����'�+�W�\�7�C�C�C�C�Cs�$�(�(c��td���d��}dD�])}|�td��5}|�|dz��tjd��}t|��|_|�|�	����|�|��ddd��n#1swxYwYtjtdd�	��}	|�
|���dgd
|z��|�����#|���wxYwdS)Nrrw)��ar�rt�foor_T)r�ignore_zerosz3ignore_zeros=True should have skipped the %r-blocks)
r�	randbytesr%r��writer&�TarInforUrV�tobufrrrJ)rr�charrZrYrGs      r�test_ignore_zerosz CommonReadTest.test_ignore_zeros�sm���a�y�y�"�"�3�'�'��!�	�	�D����7�C�(�(�
!�D��
�
�4�$�;�'�'�'�!�/�%�0�0��"�4�y�y����
�
�7�=�=�?�?�+�+�+��
�
�4� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!��,�w�S�t�D�D�D�C�
��$�$�S�\�\�^�^�e�W�I�������	�	�������	�	��������!	�	s�A=C�C	�C	�4-D7�7E
c�R�dD�]"}tjtd��5}tjd��}d|_|�|t
jd����ddd��n#1swxYwYttd��5}|�|��ddd��n#1swxYwYtjt��5}|�	tj
d��5|D]}�	ddd��n#1swxYwYddd��n#1swxYwYtjt��5}|���}|�	tj
d��5|�|td�	��ddd��n#1swxYwY|�	tj
d��5|�|�����ddd��n#1swxYwYddd��n#1swxYwY��$dS)
N)rwiXrti��w:rrtsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazr+bzunexpected end of datarr])r&r%r�rrV�addfiler#r��truncaterr�nextrbrcrRrS)rrVrG�trZs     r�test_premature_end_of_archivez,CommonReadTest.test_premature_end_of_archive�s���*�	.�	.�D���g�t�,�,�
8���O�E�*�*��������A�r�z�+�6�6�7�7�7�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8����
8�
8�
8�
8�
�g�u�%�%�
$���
�
�d�#�#�#�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$���g�&�&�
�#��+�+�G�,=�?W�X�X��� ������������������������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
��g�&�&�
.�#��H�H�J�J���+�+�G�,=�?W�X�X�;�;��K�K��7�6�K�:�:�:�;�;�;�;�;�;�;�;�;�;�;����;�;�;�;��+�+�G�,=�?W�X�X�.�.��O�O�A�&�&�+�+�-�-�-�.�.�.�.�.�.�.�.�.�.�.����.�.�.�.�

.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��	.�	.s��AA0�0A4	�7A4	�B2�2B6	�9B6	�!D!�7D
�>D!�
D�D!�D�D!�!D%	�(D%	�5H�:F$�H�$F(�(H�+F(�,#H�(H�7H�H�H�
H�H�H	�!H	c��|�tjd��5tjt	jd����5}	ddd��n#1swxYwYddd��dS#1swxYwYdS)Nz%file could not be opened successfullyz
recursion.tar)rr&rr%r�findfilers  r�test_length_zero_headerz&CommonReadTest.test_length_zero_header�s����
#�
#�G�$5�7^�
_�
_�	�	���g�.��?�?�@�@�
�C��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s5�'A.�A�
A.�A	�A.�A	�A.�.A2�5A2c��|j�d��}|j�|��5}|�t|j��|�|���d��|�|���d��|j	r!|�t|j
��n(|�|�
��d��|�|jd��ddd��n#1swxYwY|�|jd��|�t|j��|�|���d��|�|���d��|j	r"|�t|j
��dS|�|�
��d��dS)NrOTF)rGrQrRrr��fileno�assertIs�readable�writable�	is_stream�seekable�closed)r�filerZs   r�test_extractfile_attrsz%CommonReadTest.test_extractfile_attrs�s����x�!�!�/�2�2��
�X�
!�
!�$�
'�
'�	.�4����n�d�k�:�:�:��M�M�$�-�-�/�/�4�0�0�0��M�M�$�-�-�/�/�5�1�1�1��~�
5��!�!�.�$�-�@�@�@�@��
�
�d�m�m�o�o�t�4�4�4��M�M�$�+�u�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	
�
�
�d�k�4�(�(�(����.�$�+�6�6�6��
�
�d�m�m�o�o�t�,�,�,��
�
�d�m�m�o�o�u�-�-�-��>�	1����n�d�m�<�<�<�<�<��M�M�$�-�-�/�/�4�0�0�0�0�0s�CD�D!�$D!N)
rr r!r�r�r�rr	r
rrr"r,r*rrr�r�gs�������E�E�E�"
I�
I�
I�
2�
2�
2����"+�+�+�D�D�D����,.�.�.�0���1�1�1�1�1rr�c�^�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zejeed��d��ejd�����Zejd���Zejd���Zd�Zd�Zd�Zd�Zej e!dud��d���Z"d�Z#dS)�MiscReadTestBaseFc��dSrr*rs r�requires_name_attributez(MiscReadTestBase.requires_name_attributes���rc���|���t|jd��5}|�|jt
��t
j||j���5}|�|jt
��|�|jtj
�|j����ddd��n#1swxYwYddd��dS#1swxYwYdS�Nrr��fileobjr)r0r%r"�assertIsInstancer��strr&rrTrdre�abspath�rrZrGs   r�test_no_name_argumentz&MiscReadTestBase.test_no_name_argumentsk���$�$�&�&�&�
�$�,��
%�
%�	G���!�!�$�)�S�1�1�1���d���;�;�;�
G�s��%�%�c�h��4�4�4�� � ���2�7�?�?�4�9�+E�+E�F�F�F�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G����
G�
G�
G�
G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G����	G�	G�	G�	G�	G�	Gs6�<C(�&AC�C(�C	�C(�C	�C(�(C,�/C,c�^�t|jd��5}|���}ddd��n#1swxYwYtj|��}|�tt|d��tj||j	���}|�
|j��dS)Nrrr�r3)r%r"rSr#r�rr��getattrr&r�assertIsNoner��rrZrrGs    r�test_no_name_attributez'MiscReadTestBase.test_no_name_attribute
s���
�$�,��
%�
%�	���9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��z�$�������.�'�4��@�@�@��l�4�d�i�8�8�8�����#�(�#�#�#�#�#s�7�;�;c�Z�t|jd��5}|���}ddd��n#1swxYwYtj|��}d|_t
j||j���5}|�|j��ddd��dS#1swxYwYdS)Nrrrr3)	r%r"rSr#r�r�r&rr<r=s    r�test_empty_name_attributez*MiscReadTestBase.test_empty_name_attributes��
�$�,��
%�
%�	���9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��z�$������	�
�\�$�T�Y�
7�
7�
7�	(�3����c�h�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s�7�;�;�8B � B$�'B$c�z�tj|jtj��}t|d��5}|�|jt��tj||j���5}|�	|j��ddd��n#1swxYwYddd��dS#1swxYwYdSr2)
rdr%r"�O_RDONLYr5r��intr&rr<)r�fdrZrGs    r�test_int_name_attributez(MiscReadTestBase.test_int_name_attributes���W�T�\�2�;�
/�
/��
�"�d�^�^�	,�t��!�!�$�)�S�1�1�1���d���;�;�;�
,�s��!�!�#�(�+�+�+�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,s5�<B0�1B�B0�B	�B0�B	� B0�0B4�7B4c��|���tj|j��}t	|d��5}|�|jt��tj||j	���5}|�|jt��|�
|jtj�|j����ddd��n#1swxYwYddd��dS#1swxYwYdSr2)
r0rd�fsencoder"r%r5r��bytesr&rrTrer7)rr"rZrGs    r�test_bytes_name_attributez*MiscReadTestBase.test_bytes_name_attribute&sz���$�$�&�&�&��+�d�l�+�+��
�'�4�
 �
 �	G�D��!�!�$�)�U�3�3�3���d���;�;�;�
G�s��%�%�c�h��6�6�6�� � ���2�7�?�?�4�9�+E�+E�F�F�F�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G����
G�
G�
G�
G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G����	G�	G�	G�	G�	G�	Gs6�<C<�:AC$�C<�$C(	�(C<�+C(	�,C<�<D�Dc	�<�tj|j��}tj||j���5}|�|jt��|�	|jtj�tj
|������ddd��n#1swxYwY|�|��5}|�|jt��|�	|jtj�tj
|������ddd��n#1swxYwYtj�||j���5}|�|jt��|�	|jtj�tj
|������ddd��n#1swxYwY|jdkr�tj|d���5}|�|jt��|�	|jtj�tj
|������ddd��dS#1swxYwYdSdS)Nr�rr_)r�r�r"r&r%rr5r�r6rTrdrer7�fspathr(r'r)rr"rGs   r�test_pathlike_namez#MiscReadTestBase.test_pathlike_name/sC���,�t�|�,�,��
�\�'��	�
2�
2�
2�	L�c��!�!�#�(�C�0�0�0����S�X�r�w���r�y��7I�7I�'J�'J�K�K�K�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L����	L�	L�	L�	L��\�\�'�
"�
"�	L�c��!�!�#�(�C�0�0�0����S�X�r�w���r�y��7I�7I�'J�'J�K�K�K�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L����	L�	L�	L�	L��_�
!�
!�'��	�
!�
:�
:�	L�c��!�!�#�(�C�0�0�0����S�X�r�w���r�y��7I�7I�'J�'J�K�K�K�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L�	L����	L�	L�	L�	L��;�"������s�3�3�3�
P�s��%�%�c�h��4�4�4�� � ���2�7�?�?�2�9�W�;M�;M�+N�+N�O�O�O�
P�
P�
P�
P�
P�
P�
P�
P�
P�
P�
P�
P����
P�
P�
P�
P�
P�
P��sK�A+B,�,B0�3B0�A+E�E�
E�4A+G+�+G/�2G/�A+J�J�Jc�8�ttd��5	ddd��n#1swxYwY|�td��5|�td��}ddd��n#1swxYwY|�td��5|�td��}ddd��n#1swxYwY|�td��5|�td��}ddd��dS#1swxYwYdS)Nr�z
mode must be �q�rwr)r%r�r�
ValueErrorr(rs  r�test_illegal_mode_argz&MiscReadTestBase.test_illegal_mode_arg?s���
�'�4�
 �
 �	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
#�
#�J��
@�
@�	-�	-��,�,�w��,�,�C�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�
�
#�
#�J��
@�
@�	.�	.��,�,�w��-�-�C�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�
�
#�
#�J��
@�
@�	,�	,��,�,�w��+�+�C�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,sB�$�(�(�
A2�2A6�9A6�C�C�C�&D�D�Dc��tj|j|j���}	|���|���}|j}|j}|�|��5}|���}ddd��n#1swxYwY|�	��n#|�	��wxYw|�|j��5}|�
|��|�|jd|���5}|���}|�|j|��|���|�|�|�����|d��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nr�rA�rr4zseek back did not work)
r&r%r"rrr��offsetrRrSrJrxrTr�)rrGrr�rT�frrZs        r�test_fileobj_with_offsetz)MiscReadTestBase.test_fileobj_with_offsetIsB���l�4�<�d�i�8�8�8��	��H�H�J�J�J����
�
�A��6�D��X�F�����#�#�
 �q��v�v�x�x��
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 �
�I�I�K�K�K�K��C�I�I�K�K�K�K�����Y�Y�t�|�
$�
$�	2���I�I�f�������$�,�T�4��@�@�
2�C��H�H�J�J��� � ����.�.�.���� � � �� � �����!3�!3�!8�!8�!:�!:�D�0�2�2�2�

2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2�		2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�	2�	2sg�AB.�-B�B.�B�B.�B�B.�.C�!3F8�BF �F8� F$	�$F8�'F$	�(F8�8F<�?F<c�2�|�tjtjt|j��ttd��5}|�tjtj||j���ddd��dS#1swxYwYdSr2)rr&rr%r"rr�s  r�test_fail_compzMiscReadTestBase.test_fail_compes������'�+�W�\�7�D�I�N�N�N�
�'�4�
 �
 �	<�D����g�/���&*���
�
<�
<�
<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�	<�	<s�3B�B�Bc��|j�d��}|�|jtjd��dS)Nzmisc/dirtype-old-v7zv7 dirtype failed)rGrQrT�typer&�DIRTYPE�rrYs  r�test_v7_dirtypez MiscReadTestBase.test_v7_dirtypelsG���(�$�$�%:�;�;�������w��#�	%�	%�	%�	%�	%rc��	|j�d��dS#t$r|�d��YdSwxYw)Nzmisc/regtype-xstarz3failed to find misc/regtype-xstar (mangled prefix?))rGrQ�KeyErrorr�rs r�test_xstar_typez MiscReadTestBase.test_xstar_typets`��	M��H���3�4�4�4�4�4���	M�	M�	M��I�I�K�L�L�L�L�L�L�	M���s��A�Ac��|jD]r}|�t|j��dd|jz��|j�d��s�N|�|jdd|jz���sdS)N鏽>zwrong mtime for %szustar/r&zwrong uname for %s)rGrTrC�mtimer��
startswith�unamer\s  r�test_check_membersz#MiscReadTestBase.test_check_members}s����x�	9�	9�G����S���/�/��(�7�<�7�
9�
9�
9��<�*�*�8�4�4�
�����W�]�I�(�7�<�7�
9�
9�
9�
9�	9�	9rc�x�|�|j���djdd��dS)N���zmisc/eofzcould not find all members)rTrGr�r�rs r�test_find_membersz"MiscReadTestBase.test_find_members�sA�������,�,�.�.�r�2�7��,�	.�	.�	.�	.�	.r�link�Missing hardlink implementationc���tjtdd���5}|�dtd���|�tjtj	�
td����|�dtd���|�tjtj	�
td����ttj	�
td��d��5}|���}ddd��n#1swxYwY|�t|��t��|�d	td���|�tjtj	�
td	����ttj	�
td	��d��5}|���}ddd��n#1swxYwY|�t|��t��ddd��dS#1swxYwYdS)
NrsrC)�
errorlevelrErOrr]r�rrr�)r&r%r"rbrc�
addCleanupr�unlinkrdrerfrSrTrrW)rrGrUrs    r�test_extract_hardlinkz&MiscReadTestBase.test_extract_hardlink�so��
�\�'�a�+�
F�
F�
F�	>�#��K�K����K�@�@�@��O�O�I�,�b�g�l�l�7�O�.T�.T�U�U�U��K�K����K�@�@�@��O�O�I�,�b�g�l�l�7�O�.T�.T�U�U�U��b�g�l�l�7�O�<�<�d�C�C�
 �q��v�v�x�x��
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 ����Y�t�_�_�n�=�=�=��K�K����K�@�@�@��O�O�I�,�b�g�l�l�7�O�.T�.T�U�U�U��b�g�l�l�7�O�<�<�d�C�C�
 �q��v�v�x�x��
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 ����Y�t�_�_�n�=�=�=�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>s[�C4I�D2�&I�2D6	�6I�9D6	�:B>I�8H�
I�H	�I� H	�!+I�I� Ic�l�tjtd���}tj�td��}tj|��	d�|D��}|�||d���|D]�}tj�||j	��}tjdkr>|�|j
dztj|��jdz|j	��d	�}tj�|��}d
�||j��||��|��}|�|j||����	|���t)j|��dS#|���t)j|��wxYw)NrC�rE�
extractallc�:�g|]}|����|��Sr*��isdir��.0rs  r�
<listcomp>z4MiscReadTestBase.test_extractall.<locals>.<listcomp>��%��7�7�7��Q�W�W�Y�Y�7�1�7�7�7r�
fully_trustedr]�win32�c��t|t��r(d�||�����Sd�|��S)Nz{} ({})z
{!r} (int))�
isinstance�floatr��hex)rcs r�format_mtimez6MiscReadTestBase.test_extractall.<locals>.format_mtime�sF��!�%��/�/�:�(�/�/��u�y�y�{�{�C�C�C�+�2�2�5�9�9�9rz,tar mtime {0} != file time {1} of path {2!a})r&r%r"rdrerfrcr�rsr�r��platformrTr�stat�st_mode�getmtimer�rcrJr�rmtree)	rrG�DIR�directoriesrYrer��
file_mtime�errmsgs	         r�test_extractallz MiscReadTestBase.test_extractall�s����l�7�[�9�9�9���g�l�l�7�L�1�1��
���
�
�
�	"�7�7�c�7�7�7�K��N�N�3��O�N�D�D�D�&�
D�
D���w�|�|�C���6�6���<�7�*�*��$�$�W�\�E�%9�%'�W�T�]�]�%:�U�%B�%,�\�3�3�3�:�:�:�
 �W�-�-�d�3�3�
�G�N�N� �L���/�/� �L��,�,������ � ���
�F�C�C�C�C�#
D�&
�I�I�K�K�K���S�!�!�!�!�!��
�I�I�K�K�K���S�!�!�!�!���s
�DF	�	*F3c���d}tj�td��}tj|��	tjtd���5}|�|��}|�	||d���tj�||��}|�
tj�|��|j��tjdkr0|�
tj|��jdzd	��ddd��n#1swxYwYt#j|��dS#t#j|��wxYw)
N�
ustar/dirtype�
extractdirrCrrr{�rer^r|r}i�)rdrerfrcr�r&r%r"rQrbrTr�rcr�r�r�r�rr��r�dirtyper�rGrY�	extracteds      r�test_extract_directoryz'MiscReadTestBase.test_extract_directory�sp��!���g�l�l�7�L�1�1��
���
�
�
�		"���g��<�<�<�
P���-�-��0�0�����G�#�o��F�F�F��G�L�L��g�6�6�	�� � ���!1�!1�)�!<�!<�g�m�L�L�L��<�7�*�*��$�$�R�W�Y�%7�%7�%?�%�%G��O�O�O�

P�
P�
P�
P�
P�
P�
P�
P�
P�
P�
P����
P�
P�
P�
P�
��S�!�!�!�!�!��I��S�!�!�!�!���s0�E�CD*�E�*D.�.E�1D.�2E�E!c���tjt��dz}tj|��5tjtd���5}d�|D��}|�||d���|D]D}||j	z}|�
tj�
|��|j���E	ddd��n#1swxYwYddd��dS#1swxYwYdS)NrsrCrrc�:�g|]}|����|��Sr*rurws  rryzBMiscReadTestBase.test_extractall_pathlike_name.<locals>.<listcomp>�rzrr{r])r�r�rcr�temp_dirr&r%r"rsr�rTrdrer�rc)rr�rGr�rYres      r�test_extractall_pathlike_namez.MiscReadTestBase.test_extractall_pathlike_name�s����l�7�#�#�l�2��
�
��
$�
$�	H�	H�
�\�'�K�
8�
8�
8�	H�<?�7�7�c�7�7�7�K��N�N�3��O�N�D�D�D�&�
H�
H���W�\�)��� � ���!1�!1�$�!7�!7���G�G�G�G�
H�		H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H����	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H����	H�	H�	H�	H�	H�	Hs6�C�
A,C�:C�C
	�
C�
C
	�C�C"�%C"c���d}tjt��dz}tj|��5tjtd���5}|�|��}|�	||d���||z}|�
tj�
|��|j��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nr�rsrCrrr{r�)r�r�rcrr�r&r%r"rQrbrTrdrer�rcr�s      r�test_extract_pathlike_namez+MiscReadTestBase.test_extract_pathlike_name�sv��!���l�7�#�#�l�2��
�
��
$�
$�	I�	I�
�\�'�K�
8�
8�
8�	I�<?��m�m�G�,�,�G��K�K��c�/�K�B�B�B��g�
�I����R�W�-�-�i�8�8�'�-�H�H�H�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�	I�	Is6�C�A+C�:C�C
	�
C�
C
	�C�C"�%C"c�.�tj�td��}t	|d��5}|�d��ddd��n#1swxYwY	t�tj	��}	|�
|��|�d��n4#tj$r"|�
|jj��YnwxYwt!j|��dS#t!j|��wxYw)N�emptyr�rzReadError not raised)rdrerfrcr%r�object�__new__r&r'�__init__r�rr�r4r*rro)rr�rZrGs    r�test_init_close_fobjz%MiscReadTestBase.test_init_close_fobj�s>������W�g�.�.��
�%��
�
�	�$��J�J�s�O�O�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�		$��.�.���1�1�C�
2����U�#�#�#��	�	�0�1�1�1�1���$�
4�
4�
4������ 2�3�3�3�3�3�
4����

��U�#�#�#�#�#��I��U�#�#�#�#���sA�A�A�A�$$C>�	B4�C>�4.C%�"C>�$C%�%C>�>Dc�L�tj|j��5}t||��D]_\}}|�|j|j��|�|���|������`	ddd��dS#1swxYwYdSr)r&r%r"�ziprTrT�get_info)rrG�m1�m2s    r�test_parallel_iterationz(MiscReadTestBase.test_parallel_iteration�s����\�$�,�
'�
'�	?�3��c�3�-�-�
?�
?���B�� � ���B�I�6�6�6�� � ���������
�
�>�>�>�>�
?�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?����	?�	?�	?�	?�	?�	?s�A1B�B� BNz
requires zlibc�8�tj�d��5}tj|_|�tj��5tj	|j
��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nztarfile.TarInfo.fromtarfile)r��mock�patch�zlib�error�side_effectrr&rr%r")rr�s  r�test_zlib_error_does_not_leakz.MiscReadTestBase.test_zlib_error_does_not_leak�s���]�
 �
 �!>�
?�
?�	+�4�#�z�D���"�"�7�#4�5�5�
+�
+���T�\�*�*�*�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s5�1B�A7�+B�7A;	�;B�>A;	�?B�B�Bc�.�tj��}tj|d���}|���|�d��tj|d���5}|�|���d��ddd��n#1swxYwY|�d��tj|d���5}|�|���d��ddd��dS#1swxYwYdS)Nr�r3r�r|r_)r#r�r&r%rJrxrTr)rrD�tfs   r�test_next_on_empty_tarfilez+MiscReadTestBase.test_next_on_empty_tarfilesg��
�Z�\�\��
�\�"�3�
/�
/�
/��
���
�
�
�
����
�
�
�
�\�"�4�
0�
0�
0�	.�B����R�W�W�Y�Y��-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	����
�
�
�
�\�"�3�
/�
/�
/�	.�2����R�W�W�Y�Y��-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s$�))B�B"�%B"�)D
�
D�D)$rr r!r(r0r9r>r@rErIrLrQrVrXr]r`rfrir�r�r�rdr�skip_unless_symlinkrp�skip_unless_working_chmodr�r�r�r�r�r��skipIfr�r�r�r*rrr.r.s�������I�
�
�
�G�G�G�$�$�$�(�(�(�,�,�,�G�G�G�P�P�P� ,�,�,�2�2�2�8<�<�<�%�%�%�M�M�M�9�9�9�.�.�.��X�����V�,�,�:�<�<��"�>�>�#�"�<�<�>�$�(�"�"�)�(�"�>�(�
"�
"�)�(�
"�H�H�H�I�I�I�$�$�$�&?�?�?��X�_�T�T�\�?�3�3�+�+�4�3�+�.�.�.�.�.rr.c��eZdZdZdS)�MiscReadTestN)rr r!rXr*rrr�r�s�������N�N�Nrr�c��eZdZdS)�GzipMiscReadTestNr�r*rrr�r�r�rr�c��eZdZd�ZdS)�Bz2MiscReadTestc�0�|�d��dS)NzBZ2File have no name attribute��skipTestrs rr0z'Bz2MiscReadTest.requires_name_attributes���
�
�6�7�7�7�7�7rN�rr r!r0r*rrr�r�s#������8�8�8�8�8rr�c��eZdZd�ZdS)�LzmaMiscReadTestc�0�|�d��dS)NzLZMAFile have no name attributer�rs rr0z(LzmaMiscReadTest.requires_name_attributes���
�
�7�8�8�8�8�8rNr�r*rrr�r�s#������9�9�9�9�9rr�c�.�eZdZdZdZd�Zd�Zd�Zd�ZdS)�StreamReadTestr�Tc�6�|jD]�}|���s�|j�|��5}		|�d��}n*#tj$r|�d��YnwxYw|sn�E	ddd��n#1swxYwY��dS)NTrwz6simple read-through using TarFile.extractfile() failed)rG�isregrRrSr&�StreamErrorr�)rrYrZ�bufs    r�test_read_throughz StreamReadTest.test_read_through(s���x�	�	�G��=�=�?�?�
����%�%�g�.�.�
�$��B�"�i�i��n�n����"�.�B�B�B��	�	�#A�B�B�B�B�B�B���������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��	�	s4�B
�A�B
�$A9�6B
�8A9�9B
�
B	�B	c�h�|j���}|j�|��5}|���}ddd��n#1swxYwY|�t|��|jd��|�t|��td��dS)NrP)	rGrrRrSrTrUrVrrWrXs    rr[z(StreamReadTest.test_fileobj_regular_file8s����(�-�-�/�/��
�X�
!�
!�'�
*�
*�	�d��9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����T���G�L�0�	2�	2�	2�����4���.�0�	2�	2�	2�	2�	2s�A�A�Ac���|j���}|j�|d��5}|�tj|j��ddd��dS#1swxYwYdS�Nr)rGr�rRrr&r�rS)r�tarinfosrUs   r�test_provoke_stream_errorz(StreamReadTest.test_provoke_stream_errorAs����8�&�&�(�(��
�X�
!�
!�(�1�+�
.�
.�	;�!����g�1�1�6�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s�&A-�-A1�4A1c��tjtd���}	|j}	|���}|���}|��n|�|d��|���s|���rM|�tj	��5|�
|��ddd��n#1swxYwY��|�
|��}|�
|��}|���|�|d��|�|���|���d����7	|�
��dS#|�
��wxYw)NrCrrTzstream.next() failed.zstream.extractfile() failedzstream extraction failed)r&r%r"rGr�assertIsNotNone�islnk�issymrr�rRrTrSrJ)r�tar1�tar2�t1�t2�v1�v2s       r�test_compare_membersz#StreamReadTest.test_compare_membersFs����|�G�k�:�:�:��	��8�D�
4��Y�Y�[�[���Y�Y�[�[���:���$�$�R�)@�A�A�A��8�8�:�:���������*�*�7�+>�?�?�-�-��(�(��,�,�,�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-���%�%�b�)�)���%�%�b�)�)���:���$�$�R�)F�G�G�G�� � ������B�G�G�I�I�2�4�4�4�#
4�� 
�J�J�L�L�L�L�L��D�J�J�L�L�L�L���s1�BE3�.C�E3�C�E3�C�BE3�3F	N)	rr r!rr(r�r[r�r�r*rrr�r�#sZ�������F��I���� 2�2�2�;�;�;�
����rr�c��eZdZdS)�GzipStreamReadTestNr�r*rrr�r�ar�rr�c��eZdZdS)�Bz2StreamReadTestNr�r*rrr�r�dr�rr�c��eZdZdS)�LzmaStreamReadTestNr�r*rrr�r�gr�rr�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�DetectReadTestc��	tj||��}|���dS#tj$r}|���Yd}~dSd}~wwxYwr)r&r%rJrr�)rr�rrG�es     r�_testfunc_filezDetectReadTest._testfunc_filelsh��	��,�t�T�*�*�C�
�I�I�K�K�K�K�K��� �	�	�	��I�I�K�K�K�K�K�K�K�K�K�����	���s�-�A�A�Ac��	t|d��5}tj|||���}ddd��n#1swxYwY|���dS#tj$r}|���Yd}~dSd}~wwxYw)Nrr�r4)r%r&rJrr�)rr�rrUrGr�s      r�_testfunc_fileobjz DetectReadTest._testfunc_fileobjts���	��d�D�!�!�
:�Q��l�4��q�9�9�9��
:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:����
:�
:�
:�
:�

�I�I�K�K�K�K�K��� �	�	�	��I�I�K�K�K�K�K�K�K�K�K�����	���s2�A�6�A�:�A�:�A�B�&B�Bc��|j�rX|�tj��5tjt
d|jz���ddd��n#1swxYwY|�tj��5tjt
d|jz���ddd��n#1swxYwY|�tj��5tj|jd���ddd��n#1swxYwY|�tj��5tj|jd���ddd��n#1swxYwY||jd��||jd|jz��||jd��||jd|jz��||jd��dS)NrAr�r�r_zr:*�r|*)rrr&rr%r")r�testfuncs  r�_test_modeszDetectReadTest._test_modes}s����;�	6��"�"�7�#4�5�5�
?�
?���W�4�$�+�+=�>�>�>�>�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?����
?�
?�
?�
?��"�"�7�#4�5�5�
?�
?���W�4�$�+�+=�>�>�>�>�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?�
?����
?�
?�
?�
?��"�"�7�#4�5�5�
6�
6���T�\��5�5�5�5�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6��"�"�7�#4�5�5�
6�
6���T�\��5�5�5�5�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6�����s�#�#�#�����t�d�k�1�2�2�2�����u�%�%�%�����t�d�k�1�2�2�2�����u�%�%�%�%�%sG�$A�A�A�$B2�2B6�9B6�D�D�D�.E�E�Ec�:�|�|j��dSr)r�r�rs r�test_detect_filezDetectReadTest.test_detect_file�s������,�-�-�-�-�-rc�:�|�|j��dSr)r�r�rs r�test_detect_fileobjz"DetectReadTest.test_detect_fileobj�s������/�0�0�0�0�0rN)rr r!r�r�r�r�r�r*rrr�r�ks_������������&�&�&� .�.�.�1�1�1�1�1rr�c��eZdZdS)�GzipDetectReadTestNr�r*rrr�r��r�rr�c��eZdZd�ZdS)�Bz2DetectReadTestc�P�ttd��5}|���}ddd��n#1swxYwYtjt
dd���5}|�|��ddd��n#1swxYwY|�t
d��dS)Nrrr�rs��
compresslevelr�)r%r"rSr4r6r�rr�r�s   r�test_detect_stream_bz2z(Bz2DetectReadTest.test_detect_stream_bz2�s��
�'�4�
 �
 �	�D��9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��[��$�a�
8�
8�
8�	�D��J�J�t����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
���G�U�+�+�+�+�+s�7�;�;�B�B�BN)rr r!r�r*rrr�r��s#������,�,�,�,�,rr�c��eZdZdS)�LzmaDetectReadTestNr�r*rrr�r��r�rr�c��eZdZdZd�ZdS)� GzipBrokenHeaderCorrectExceptionz>
    See: https://github.com/python/cpython/issues/107396
    c���tjd��}|�tj��5tj|d���ddd��dS#1swxYwYdS)Ns�zr|gzr3)r#r�rr&rr%)rrUs  r�runTestz(GzipBrokenHeaderCorrectException.runTest�s����J�
�
�
���
�
�w�0�
1�
1�	1�	1��L���0�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s�A�A�AN)rr r!�__doc__r�r*rrr�r��s-��������
1�
1�
1�
1�
1rr�c��eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�MemberReadTestNc	���|�p|j�|��5}|�t|�����|d|jz��ddd��n#1swxYwYd|d<d|d<d|d<d|jvr
d	|d
<d	|d<|���D]5\}}|�t||��|d|�d
|j�����6dS)N�wrong sha256sum for %srbrc��r�r�r�zold-v7r&re�gnamezwrong value in z
 field of )rGrRrTrrSr��itemsr;)rrY�chksum�kwargsrU�k�vs       r�_test_memberzMemberReadTest._test_member�s_������%�%�g�.�.�
A�!�� � ��1�6�6�8�8�!4�!4�f�0�7�<�?�A�A�A�
A�
A�
A�
A�
A�
A�
A�
A�
A�
A�
A����
A�
A�
A�
A�'��w����u�
���u�
��7�<�'�'�'�F�7�O�'�F�7�O��L�L�N�N�	I�	I�D�A�q����W�W�a�0�0�!�!�78�q�q�'�,�,�G�
I�
I�
I�
I�	I�	Is�?A(�(A,�/A,c�t�|j�d��}|�|dt���dS)NrO�c�rVr�rGrQr	rWr\s  r�test_find_regtypez MemberReadTest.test_find_regtype�s8���(�$�$�_�5�5�����'��^��D�D�D�D�Drc�t�|j�d��}|�|dt���dS)Nzustar/conttyperrr
r\s  r�test_find_conttypez!MemberReadTest.test_find_conttype�s9���(�$�$�%5�6�6�����'��^��D�D�D�D�Drc�h�|j�d��}|�|d���dS)Nr�r�rV�rGrQr	r\s  r�test_find_dirtypez MemberReadTest.test_find_dirtype�s6���(�$�$�_�5�5�����'���*�*�*�*�*rc�h�|j�d��}|�|d���dS)Nzustar/dirtype-with-size�rrr\s  r�test_find_dirtype_with_sizez*MemberReadTest.test_find_dirtype_with_size�s7���(�$�$�%>�?�?�����'���,�,�,�,�,rc�j�|j�d��}|�|dd���dS)Nr�rrO�rV�linknamerr\s  r�test_find_lnktypez MemberReadTest.test_find_lnktype�s8���(�$�$�_�5�5�����'��O��D�D�D�D�Drc�j�|j�d��}|�|dd���dS)Nr�rr�rrr\s  r�test_find_symtypez MemberReadTest.test_find_symtype�s8���(�$�$�_�5�5�����'��I��>�>�>�>�>rc�l�|j�d��}|�|ddd���dS)Nz
ustar/blktyper��rV�devmajor�devminorrr\s  r�test_find_blktypez MemberReadTest.test_find_blktype��:���(�$�$�_�5�5�����'��A���B�B�B�B�Brc�l�|j�d��}|�|ddd���dS)Nz
ustar/chrtyperrsrr rr\s  r�test_find_chrtypez MemberReadTest.test_find_chrtype�r$rc�h�|j�d��}|�|d���dS)Nzustar/fifotyperrrr\s  r�test_find_fifotypez!MemberReadTest.test_find_fifotype�s7���(�$�$�%5�6�6�����'���*�*�*�*�*rc�t�|j�d��}|�|dt���dS)Nzustar/sparse�Pr�rGrQr	�
sha256_sparser\s  r�test_find_sparsezMemberReadTest.test_find_sparse�s8���(�$�$�^�4�4�����'��m��D�D�D�D�Drc�t�|j�d��}|�|dt���dS)N�
gnu/sparser*rr+r\s  r�test_find_gnusparsez"MemberReadTest.test_find_gnusparse�s8���(�$�$�\�2�2�����'��m��D�D�D�D�Drc�t�|j�d��}|�|dt���dS)N�gnu/sparse-0.0r*rr+r\s  r�test_find_gnusparse_00z%MemberReadTest.test_find_gnusparse_00��9���(�$�$�%5�6�6�����'��m��D�D�D�D�Drc�t�|j�d��}|�|dt���dS)N�gnu/sparse-0.1r*rr+r\s  r�test_find_gnusparse_01z%MemberReadTest.test_find_gnusparse_01�r4rc�t�|j�d��}|�|dt���dS)N�gnu/sparse-1.0r*rr+r\s  r�test_find_gnusparse_10z%MemberReadTest.test_find_gnusparse_10r4rc�t�|j�d��}|�|dt���dS)Nuustar/umlauts-ÄÖÜäöüßrrr
r\s  r�test_find_umlautsz MemberReadTest.test_find_umlautssB���(�$�$�&D�E�E�����'��^��D�D�D�D�Drc�d�d}|�||j�����dS)Naustar/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�rGr)rr�s  r�test_find_ustar_longnamez'MemberReadTest.test_find_ustar_longname
s/��<���
�
�d�D�H�-�-�/�/�0�0�0�0�0rc�t�|j�d��}|�|dt���dS)Nzmisc/regtype-old-v7rrr
r\s  r�test_find_regtype_oldv7z&MemberReadTest.test_find_regtype_oldv7s9���(�$�$�%:�;�;�����'��^��D�D�D�D�Drc���|j���tj|j|jd���|_|j�d��}|�|dt���dS)NrCrDupax/umlauts-ÄÖÜäöüßrr)	rGrJr&r%r"rrQr	rWr\s  r�test_find_pax_umlautsz$MemberReadTest.test_find_pax_umlautssw����������<���4�9�)4�6�6�6����(�$�$�&D�E�E�����'��^��D�D�D�D�Drr)rr r!r	rrrrrrr#r&r(r-r0r3r7r:r<r>r@rBr*rrr�r��sc������I�I�I�I�"E�E�E�E�E�E�+�+�+�-�-�-�E�E�E�?�?�?�C�C�C�C�C�C�+�+�+�E�E�E�E�E�E�E�E�E�E�E�E�E�E�E�E�E�E�
1�1�1�E�E�E�E�E�E�E�Err�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�LongnameTestc���|jdzdzdz}	|j�|��}n%#t$r|�d��YnwxYw|�|jtjd��dS)Nr���123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/�longnamezlongname not foundzread longname as dirtype)	�subdirrGrQr_r��assertNotEqualrZr&r[)rrGrYs   r�test_read_longnamezLongnameTest.test_read_longnames����;��$�|�3�j�@��	,��h�(�(��2�2�G�G���	,�	,�	,��I�I�*�+�+�+�+�+�	,�������G�L�'�/�*�	,�	,�	,�	,�	,s�-�A�Ac��|jdzdzdz}|jdzdzdz}	|j�|��}n%#t$r|�d��YnwxYw|�|j|d��dS)Nr�rFrG�longlinkzlonglink not foundzlinkname wrong)rHrGrQr_r�rTr)rrGrLrYs    r�test_read_longlinkzLongnameTest.test_read_longlink's����;��$�|�3�j�@���;��$�|�3�j�@��	,��h�(�(��2�2�G�G���	,�	,�	,��I�I�*�+�+�+�+�+�	,��������)�8�5E�F�F�F�F�Fs�=�A�Ac��|jdzdzdz}|j�|��}|j}|jj�|��t
j|jj�d����}|�	tj��5tjd|���ddd��dS#1swxYwYdS)Nr�rFrGizfoo.tar)r�r4)
rHrGrQrTr4rxr#r�rSrr&rr%)rrGrYrTrZs     r�test_truncated_longnamez$LongnameTest.test_truncated_longname0s����;��$�|�3�j�@���(�$�$�X�.�.����������f�%�%�%��z�$�(�*�/�/��8�8�9�9��
�
�
�w�0�
1�
1�	7�	7��L�i��6�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	7�	7s�!C�C	�C	c��|jdzdzdz}|j�|��j}t	t
d��5}|�|��tj�	|�
d��dd��}|�|j|j
��ddd��dS#1swxYwYdS)Nr�rFrGrrrwrC�strict)rHrGrQrTr%r"rxr&r�frombufrSrTrZ�longnametype)rrGrTrZrYs     r�test_header_offsetzLongnameTest.test_header_offset9s����;��$�|�3�j�@����#�#�H�-�-�4��
�'�4�
 �
 �	>�D��I�I�f�����o�-�-�d�i�i��n�n�.9�8�E�E�G����W�\�4�+<�=�=�=�		>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>s�A*B<�<C�Cc	��d}tj��5tjtd��5}|j|_	t
j|��|�|��t
j	|�
d����n,#t
j	|�
d����wxYw	ddd��n#1swxYwYtjt��5}|�|�|����|�|�|�
d������ddd��n#1swxYwYddd��dS#1swxYwYdS)Nzfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/r�r�)rr�r&r%r�r�rdr�r�r��rstripr�rQ�removesuffix)r�longdirrGs   r�test_longname_directoryz$LongnameTest.test_longname_directoryDs(��#��
�
�
!�
!�
	O�
	O���g�s�+�+�
2�s�!�[��
�2��H�W�%�%�%��G�G�G�$�$�$��H�W�^�^�C�0�0�1�1�1�1��B�H�W�^�^�C�0�0�1�1�1�1����1�

2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2���g�&�&�
O�#��$�$�S�]�]�7�%;�%;�<�<�<��$�$�S�]�]�7�3G�3G��3L�3L�%M�%M�N�N�N�
O�
O�
O�
O�
O�
O�
O�
O�
O�
O�
O����
O�
O�
O�
O�
	O�
	O�
	O�
	O�
	O�
	O�
	O�
	O�
	O�
	O�
	O�
	O����
	O�
	O�
	O�
	O�
	O�
	Osp�E5�
C	�)B�((C	�)B9�9C	�=E5�	C
	�
E5�C
	�E5�-A$E�E5�E!	�!E5�$E!	�%E5�5E9�<E9N)rr r!rJrMrOrTrYr*rrrDrDsg������,�,�,�G�G�G�7�7�7�	>�	>�	>�
O�
O�
O�
O�
OrrDc�b�eZdZdZejZejZd�Z	d�Z
d�Zd�Zd�Z
ed���ZdS)	�GNUReadTest�gnuc��|j�|td���tj�t|��}t
|d��5}|���}ddd��n#1swxYwY|�t|��td|z��|���r9tj|��}|�
|jdz|j��dSdS)Nrr]rrrrw)rGrbrcrdrerfr%rSrTrr,�_fs_supports_holesr��
assertLess�	st_blocks�st_size)rr��filenamerZrr|s      r�_test_sparse_filezGNUReadTest._test_sparse_file`s�������w�v��6�6�6��7�<�<���.�.��
�(�D�
!�
!�	�T��9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����4���-�(�4�/�	1�	1�	1��"�"�$�$�	:����!�!�A��O�O�A�K�#�-�q�y�9�9�9�9�9�	:�	:s�A9�9A=�A=c�0�|�d��dS)Nr/�rcrs r�test_sparse_file_oldz GNUReadTest.test_sparse_file_oldls�����|�,�,�,�,�,rc�0�|�d��dS)Nr2rers r�test_sparse_file_00zGNUReadTest.test_sparse_file_00o������/�0�0�0�0�0rc�0�|�d��dS)Nr6rers r�test_sparse_file_01zGNUReadTest.test_sparse_file_01rrirc�0�|�d��dS)Nr9rers r�test_sparse_file_10zGNUReadTest.test_sparse_file_10urirc���tj�d��r�tj�td��}t|d��5}|�d��|�	d��|�
��ddd��n#1swxYwYtj|��}tj
|��|jdz|jkSdS)N�linuxzsparse-testr�isxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrwF)r�r�rdrdrerfrcr%rxrrr�rror`ra)r�rZr|s   rr^zGNUReadTest._fs_supports_holesxs����<�"�"�7�+�+�	��7�<�<���7�7�D��d�D�!�!�
 �T��	�	�$�����
�
�;�'�'�'��
�
����	
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 �
���
�
�A���T�"�"�"��K�#�%��	�1�2��5s�?B � B$�'B$N)rr r!rHr&�GNUTYPE_LONGNAMErS�
GNU_FORMATr�rcrfrhrkrm�staticmethodr^r*rrr[r[Ss�������
�F��+�L�
�
�F�
:�
:�
:�-�-�-�1�1�1�1�1�1�1�1�1�����\���rr[c�@�eZdZdZejZejZd�Z	d�Z
d�ZdS)�PaxReadTest�paxc�n�tjtd���}	|�d��}|�|jd��|�|jd��|�|j�d��d��|�d��}|�|jd	��|�|jd��|�|j�d��d��|�d
��}|�|jd��|�|jd��|�|j�d��d��|�	��dS#|�	��wxYw)NrCrr�pax/regtype1rr�zVENDOR.umlautsuÄÖÜäöüßzpax/regtype2rzpax/regtype3r&)
r&r%r"rQrTrer�pax_headers�getrJ�rrGrYs   r�test_pax_global_headersz#PaxReadTest.test_pax_global_headers�s����l�7�[�9�9�9��	��m�m�N�3�3�G����W�]�E�2�2�2����W�]�E�2�2�2����W�0�4�4�5E�F�F�;�
=�
=�
=��m�m�N�3�3�G����W�]�B�/�/�/����W�]�E�2�2�2����W�0�4�4�5E�F�F�;�
=�
=�
=��m�m�N�3�3�G����W�]�I�6�6�6����W�]�I�6�6�6����W�0�4�4�5E�F�F�;�
=�
=�
=�
�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�E+F�F4c��tjtd���}	|�d��}|�|jd��|�|jd��|�|jd��|�|jd��|�t|j��t��|�t|jd��d��|�t|jd��d��|���dS#|���wxYw)	NrCrrzpax/regtype4r�{g��^�A�atime�ctime)
r&r%r"rQrTrVr�r�rcrZr�rxrJrzs   r�test_pax_number_fieldsz"PaxReadTest.test_pax_number_fields�s���l�7�[�9�9�9��
	��m�m�N�3�3�G����W�\�4�0�0�0����W�[�#�.�.�.����W�[�#�.�.�.����W�]�L�9�9�9����T�'�-�0�0�%�8�8�8����U�7�#6�w�#?�@�@�,�O�O�O����U�7�#6�w�#?�@�@�,�O�O�O��I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�D
D=�=Ec���d}ddi}|D�]�}|�|���5tjtdtjd���}	tj��}d|_d	|_||_|�	|��|�
��n#|�
��wxYwttd
��5}|���}|�d|��|�
d|��}ddd��n#1swxYwYttd��5}|���|�|��ddd��n#1swxYwY|�tjd
��5tjtd���ddd��n#1swxYwYddd��n#1swxYwY���dS)N)
s	 foo=bar
s0 
s1 
s2 
s3 =
s4 =a
s1000000 foo=bar
s
0 foo=bar
s-12 foo=bar
s$000000000000000000000000036 foo=bar
rr�)�headerr�rC�r�rErursrrs11 foo=bar
r�z)method tar: ReadError\('invalid header'\)rr)�subTestr&r%r��
PAX_FORMATrr�r�rxrrJrSr�r�rrrr)r�pax_header_replacementsrx�replacementrGrrUrs        r�test_pax_header_bad_formatsz'PaxReadTest.test_pax_header_bad_formats�s���#
���e�n��2�	@�	@�K����[��1�1�
@�
@��l�7�C��8J�,7�9�9�9�� ���)�)�A�"�A�F��A�E�$/�A�M��K�K��N�N�N��I�I�K�K�K�K��C�I�I�K�K�K�K�����'�4�(�(�F�A��6�6�8�8�D��M�M�/�4�8�8�8��<�<���E�E�D�F�F�F�F�F�F�F�F�F�F�F����F�F�F�F�
�'�4�(�(�"�A��J�J�L�L�L��G�G�D�M�M�M�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"��+�+�G�,=�?k�l�l�@�@��L��;�?�?�?�?�@�@�@�@�@�@�@�@�@�@�@����@�@�@�@�+
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@��	@�	@s��(G�=B�G�B3�3G�AD�G�D�G�D� G�8*E.�"G�.E2�2G�5E2�6#G�G�5G�G�G�G�	G�G	�G	N)rr r!rHr&�XHDTYPErSr�r�r{r�r�r*rrrtrt�sZ������
�F��?�L�
�
�F����.
�
�
�(@�(@�(@�(@�(@rrtc��eZdZd�Zd�ZdS)�
WriteTestBasec���tj��}tj||j���5}|�tjd����ddd��n#1swxYwY|�|jd��|�	��}~tj��|�|j��|�||�	����dS)Nr3rz#external fileobjs must never closed)
r#r�r&r%rrrr�r*r�r�
gc_collectrT)rrZrGrs    r�test_fileobj_no_closez#WriteTestBase.test_fileobj_no_close�s���z�|�|��
�\�$�T�Y�
7�
7�
7�	0�3��K�K����.�.�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0������&K�L�L�L��}�}���������������%�%�%�����t�}�}���/�/�/�/�/s�(A#�#A'�*A'c�$�tjt|j��5}tjd��}tjtjz
|_|�|tj
d|jz����ddd��n#1swxYwY|�td��5}|�t|�
����tjdz��ddd��dS#1swxYwYdS)Nrrrrrv)r&r%r�rr�
RECORDSIZE�	BLOCKSIZErVrr#r�rTrUrS)rrGrrZs    r�test_eof_markerzWriteTestBase.test_eof_marker�sg��
�\�'�4�9�
-�
-�	6�����&�&�A��'�'�*;�;�A�F��K�K��2�:�d�Q�V�m�4�4�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�
�Y�Y�w��
%�
%�	G�����S������-�-�w�/A�A�/E�F�F�F�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G�	G����	G�	G�	G�	G�	G�	Gs%�A#B�B�B�5AD�D	�D	N)rr r!r�r�r*rrr�r��s7������
0�
0�
0�G�G�G�G�Grr�c���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	e
jee
d��d	��d
���Zejd���Zd�Zd
�Zdd�Zejd���Zd�Zd�Zd�Zd�ZdS)�	WriteTestrc���d}tjt|j��}	tj|��}|�|��|���n#|���wxYwtjt��}	|�|���d|d��|���dS#|���wxYw)N�d0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789rz!failed to store 100 char filename)	r&r%r�rrrrJrTr)rr�rGrs    r�test_100_char_namezWriteTest.test_100_char_names���
!���l�7�D�I�.�.��	����%�%�A��K�K��N�N�N��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�#�#��	����S�\�\�^�^�A�.��7�
9�
9�
9�
�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�)A!�!A7�/C�C/c��tjt|j��}	tj�td��}t|d��5}|�d��ddd��n#1swxYwY|�	|��|�
��n#|�
��wxYw|�tj�t��dd��dS)Nr+r��aaarztarfile is empty)
r&r%r�rrdrerfrcrr�rJ�
assertGreater�getsize)rrGrerZs    r�
test_tar_sizezWriteTest.test_tar_sizes
���l�7�D�I�.�.��	��7�<�<���0�0�D��d�D�!�!�
#�T��
�
�6�"�"�"�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#��G�G�D�M�M�M��I�I�K�K�K�K��C�I�I�K�K�K�K�������2�7�?�?�7�3�3�Q�"�	$�	$�	$�	$�	$s/�5B-�A8�,B-�8A<�<B-�?A<�B-�-Cc�v�tjt|j��}	tj�td��}t|d��5	ddd��n#1swxYwY|�|��}|�	|j
d��t|d��5}|�d��ddd��n#1swxYwY|�|��}|�	|j
d��|���dS#|���wxYw)Nr+r�rr�r)
r&r%r�rrdrerfrc�
gettarinforTrVrrJ)rrGrerYrZs     r�test_file_sizezWriteTest.test_file_size*s����l�7�D�I�.�.��	��7�<�<���0�0�D��d�D�!�!�
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��n�n�T�*�*�G����W�\�1�-�-�-��d�D�!�!�
#�T��
�
�6�"�"�"�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#��n�n�T�*�*�G����W�\�1�-�-�-��I�I�K�K�K�K�K��C�I�I�K�K�K�K���sT�5D"�A$�D"�$A(�(D"�+A(�,AD"�/C�D"�C�D"�C�3D"�"D8c���tj�td��}tj|��	tjt|j��}	|�	|��}|�
|jd��|���n#|���wxYw	tj|��dS#tj|��wxYw)N�	directoryr)rdrerfrcr�r&r%r�rr�rTrVrJrr��rrerGrYs    r�test_directory_sizezWriteTest.test_directory_size:s����w�|�|�G�[�1�1��
������	"��,�w��	�2�2�C�
��.�.��.�.��� � ���q�1�1�1��	�	�������	�	����������O�D�!�!�!�!�!��I�O�D�!�!�!�!���s#�C�0B �C� B6�6C�C&c��tj�td��}tj|��ttj�|d��d�����ttj�|d��d�����	tjt|j	��}	tj�d��5}ddg|_
|�|��ddd��n#1swxYwYg}|���D]?}|�tj�|j��d���@|�|gd���|���n#|���wxYw	t)jtj�|d����t)jtj�|d����t)j|��dS#t)jtj�|d����t)jtj�|d����t)j|��wxYw)Nr��1r��2z
os.listdirrh)r�r�r�)rdrerfrcr�r%rJr&r�rr�r�r��return_valuer�r��append�splitr�rTrror�)rrerG�mock_listdir�paths�ms      r�test_ordered_recursionz WriteTest.test_ordered_recursionIsY���w�|�|�G�[�1�1��
�������R�W�\�\�$��
$�
$�c�*�*�0�0�2�2�2��R�W�\�\�$��
$�
$�c�*�*�0�0�2�2�2�	"��,�w��	�2�2�C�	
��]�(�(��6�6�"�,�14�c�
�L�-��G�G�D�M�M�M�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"������)�)�<�<�A��L�L�����q�v�!6�!6�r�!:�;�;�;�;�� � ��(?�(?�(?�@�@�@��	�	�������	�	�����������R�W�\�\�$��4�4�5�5�5���R�W�\�\�$��4�4�5�5�5��O�D�!�!�!�!�!��
��R�W�\�\�$��4�4�5�5�5���R�W�\�\�$��4�4�5�5�5��O�D�!�!�!�!���sJ�;I�F3�:D%�F3�%D)�)F3�,D)�-A1F3�I�3G	�	I�A:Kc�V�tjt|j��5}t	jt��dz}t|d��5}|�d��ddd��n#1swxYwY|�|��}|�tj
|����}|�|jt��|�|j|j��|�|jd��ddd��dS#1swxYwYdS)Nr+r�r�r)r&r%r�rr�r�rcrr�rdrKr5r�r6rTrV)rrGrerZrY�tarinfo2s      r�test_gettarinfo_pathlike_namez'WriteTest.test_gettarinfo_pathlike_name_ss��
�\�'�4�9�
-�
-�	.���<��(�(�6�1�D��d�D�!�!�
#�T��
�
�6�"�"�"�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#��n�n�T�*�*�G��~�~�b�i��o�o�6�6�H��!�!�'�,��4�4�4����W�\�8�=�9�9�9����W�\�1�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s6�-D�
A/�#D�/A3	�3D�6A3	�7BD�D"�%D"rjrkc�t�tj�td��}tj�td��}t	|d��5}|�d��ddd��n#1swxYwY	tj||��n/#t$r"}|�d|z��Yd}~nd}~wwxYw	tjt|j��}	|�|��|�|��}|�
|jd��|���n#|���wxYw	t!j|��t!j|��dS#t!j|��t!j|��wxYw)Nrj�link_targetr�r��
os.link(): %sr)rdrerfrcr%rrj�PermissionErrorr�r&r�rr�rTrVrJrro)rrj�targetrZr�rGrYs       r�test_link_sizezWriteTest.test_link_sizejs����w�|�|�G�V�,�,������g�}�5�5��
�&�$�
�
�	�4��J�J�v����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	/��G�F�D�!�!�!�!���	/�	/�	/��M�M�/�A�-�.�.�.�.�.�.�.�.�����	/����	#��,�w��	�2�2�C�
����v�&�&�&��.�.��.�.��� � ���q�1�1�1��	�	�������	�	�����������V�$�$�$���T�"�"�"�"�"��
��V�$�$�$���T�"�"�"�"���sO�A=�=B�B�	B�
C�)C�C�F
�/AE	�4F
�	E�F
�
*F7c���tj�td��}tjd|��	tjt|j��}	|�	|��}|�
|jd��|���n#|���wxYw	tj|��dS#tj|��wxYw)N�symlinkr�r)rdrerfrcr�r&r%r�rr�rTrVrJrror�s    r�test_symlink_sizezWriteTest.test_symlink_size�s����w�|�|�G�Y�/�/��
�
�=�$�'�'�'�	#��,�w��	�2�2�C�
��.�.��.�.��� � ���q�1�1�1��	�	�������	�	�����������T�"�"�"�"�"��I��T�"�"�"�"���s#�C�0B!�C�!B7�7C�C'c�z�tj�t��}t	jt|j��}	|�|j|d��|�	|��|�|�
��gd��tjt��5|�	|��ddd��n#1swxYwY|�|�
��gd��|���dS#|���wxYw)Nzarchive name must be absolutezadded the archive to itself)rdrer7r�r&r%rrTr�r�rr�
change_cwdrcrJ)r�dstnamerGs   r�
test_add_selfzWriteTest.test_add_self�sM���'�/�/�'�*�*���l�7�D�I�.�.��	����S�X�w�3�
5�
5�
5��G�G�G�������S�\�\�^�^�R�1�
3�
3�
3��%�g�.�.�
!�
!����� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!����S�\�\�^�^�R�1�
3�
3�
3�
�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s1�A3D$�8C�D$�C�D$�!C�",D$�$D:c�&�tj�td��}tj|��	dD]6}tj�||��}tj|���7d�}tjt|j
d���}	|�|d|���|���n#|���wxYw|�
t��5|�|ddd|��ddd��n#1swxYwYtjtd	��}	|D]8}|�|jd
��|�|jd���9|�t%|�����d��|���n#|���wxYw	tj|��dS#tj|��wxYw)
Nr^)rr��bazc�v�tj�|j��dkrdSd|_d|_|S)Nr�r}r)rdre�basenamer�r�rer�s rr^z%WriteTest.test_filter.<locals>.filter�s7���7�#�#�G�L�1�1�U�:�:��F�!��� %��
��rrCrr�	empty_dir)�arcnamer^Tr_r}rr)rdrerfrcr�r�create_empty_filer&r%r�rr�rJr�	TypeErrorrTr�rerUr�r�)r�tempdirr�r^rGrYs      r�test_filterzWriteTest.test_filter�s4���'�,�,�w��1�1��
������	&�-�
2�
2���w�|�|�G�T�2�2���+�D�1�1�1�1�
�
�
��,�w��	�K�H�H�H�C�
������V��D�D�D��	�	�������	�	���������"�"�9�-�-�
B�
B������d�D�&�A�A�A�
B�
B�
B�
B�
B�
B�
B�
B�
B�
B�
B����
B�
B�
B�
B��,�w��,�,�C�
�"�;�;�G��$�$�W�[�#�6�6�6��$�$�W�]�E�:�:�:�:�� � ��S�^�^�%5�%5�!6�!6��:�:�:��	�	�������	�	�����������W�%�%�%�%�%��I��W�%�%�%�%���sa�AG:�C�1G:�C�G:�9D�G:�D#�#G:�&D#�'G:�A0G
�5G:�
G � G:�:HNFc��tj�td��}|st	j|��ntj|��tjt|j
��}	|�||���|���n#|���wxYwtjtd��}	|�
��}|���n#|���wxYw|st	j|��nt	j|��|�|j|p|�tjd����dS)Nr�r�r_r�)rdrerfrcrr�r�r&r%r�rr�rJrror�rTr�r��sep)rre�cmp_path�dirrrGrs       r�_test_pathnamezWriteTest._test_pathname�s4���g�l�l�7�E�*�*���	��'��,�,�,�,��H�S�M�M�M��l�7�D�I�.�.��	��G�G�C��G�&�&�&��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�C�(�(��	����
�
�A��I�I�K�K�K�K��C�I�I�K�K�K�K�����	!���S�!�!�!�!��O�C� � � �������!F�T�\�\�"�&�#�-F�-F�G�G�G�G�Gs�1B�B3�C:�:Dc� �tj�td��}tj�td��}tj|��	tj�|d��}tj�|d��}t|d��5}|�d��ddd��n#1swxYwYtj||��tj|d��5}|�	|d���|�	|d���ddd��n#1swxYwYtj|d�	��5}	|�
|d
���n%#t$r|�d��YnwxYwddd��n#1swxYwYtj|��tj|��dS#tj|��tj|��wxYw)
N�testsymlinksztestsymlinks.tar�sourcer�r�z
something
r�rv�rmr{r�z&extractall failed with symlinked files)rdrerfrcr�r%rr�r&r�rs�OSErrorr�rror�)rr��temparchive�source_file�target_filerUrGs       r�test_extractall_symlinksz"WriteTest.test_extractall_symlinks�s����'�,�,�w��7�7���g�l�l�7�,>�?�?��
������	&��'�,�,�w�x�8�8�K��'�,�,�w�y�9�9�K��k�#�&�&�
'�!����
�&�&�&�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'����
'�
'�
'�
'��J�{�K�0�0�0���k�3�/�/�
8�3�����X��6�6�6�����Y��7�7�7�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8�
8����
8�
8�
8�
8���k�a�8�8�8�
H�C�H��N�N��*9�#�;�;�;�;���H�H�H��I�I�F�G�G�G�G�G�H����
H�
H�
H�
H�
H�
H�
H�
H�
H�
H�
H����
H�
H�
H�
H�
��[�)�)�)���W�%�%�%�%�%��
��[�)�)�)���W�%�%�%�%���s�� AG#�0C�G#�C�G#�C�-G#�/E�6G#�E�G#�	E�
G#�#F.�%E=�<F.�=F�F.�F�F.�"G#�.F2�2G#�5F2�6G#�#*H
c�v�|�d��|�tj�ddd����|�tj�ddd����|�tj�dd����|�tj�ddd����|�tj�dddd����|�tj�dddd����|�tj�dddd����|�tj�dd����|�tj�ddd����|�tj�dddd����|�tj�dddd����|�dtjztjzdz��|�dtjztjzdd���dS)Nr�.r��..T)r�)r�rdrerfr�rs r�test_pathnameszWriteTest.test_pathnamess�����E�"�"�"����B�G�L�L���U�;�;�<�<�<����B�G�L�L���e�<�<�=�=�=����B�G�L�L��e�4�4�5�5�5����B�G�L�L��e�S�9�9�:�:�:����B�G�L�L��e�S�%�@�@�A�A�A����B�G�L�L��e�T�5�A�A�B�B�B����B�G�L�L��e�T�5�A�A�B�B�B����B�G�L�L��u�5�5�6�6�6����B�G�L�L��u�d�;�;�<�<�<����B�G�L�L��u�c�5�A�A�B�B�B����B�G�L�L��u�d�E�B�B�C�C�C����E�B�F�N�R�V�3�e�;�<�<�<����E�B�F�N�R�V�3�U���E�E�E�E�Erc��tjdkr|�dd��dS|�dd��|�dd��dS)Nr|zC:\foorz/fooz///foo)r�r�r�rs r�test_abs_pathnameszWriteTest.test_abs_pathnamess]���<�7�"�"����	�5�1�1�1�1�1������.�.�.�����%�0�0�0�0�0rc�L�tjt��5tjt
|j��}	|�d��|���n#|���wxYwtjt
d��}	|D]@}|j	dkr3|�
|j	�d��|j	���A	|���n#|���wxYw	ddd��dS#1swxYwYdS)Nr�r_z./)rr�rcr&r%r�rr�rJr�r�rd�rrGrs   r�test_cwdzWriteTest.test_cwdsC��
�
!�'�
*�
*�
	�
	��,�w��	�2�2�C�
���������	�	�������	�	���������,�w��,�,�C�
��I�I�A��v��}�}������(9�(9�$�(?�(?���H�H�H��I��	�	�������	�	���������
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	����
	�
	�
	�
	�
	�
	sA� D�A%�D�%A;�;D�AC2�D�2D�D�D� Dc
�j��tttfD]��G�fd�dtj��}|��}|����5t
jt|j	|tj
ddi���}ddd��n#1swxYwY|�|j����dS)Nc���eZdZdZ�fd�ZdS)�8WriteTest.test_open_nonwritable_fileobj.<locals>.BadFileTc�(��|jr	d|_��dS�NF)�first)rr�exctypes  �rrz>WriteTest.test_open_nonwritable_fileobj.<locals>.BadFile.write/s#����z�&�%*��
�%�
�&�&rN)rr r!r�r)r�s�r�BadFiler�-s3���������&�&�&�&�&�&�&rr��nonr�)r4r�rx)
r��EOFError�RuntimeErrorr#r�rr&r%r�rr�r�r*)rr�rUrGr�s    @r�test_open_nonwritable_fileobjz'WriteTest.test_open_nonwritable_fileobj+s*�����,�6�
	'�
	'�G�
&�
&�
&�
&�
&�
&�
&�"�*�
&�
&�
&���	�	�A��"�"�7�+�+�
A�
A��l�7�D�I�q�*1�*<�05�w�/?�A�A�A��
A�
A�
A�
A�
A�
A�
A�
A�
A�
A�
A����
A�
A�
A�
A�
���Q�X�&�&�&�&�
	'�
	's�0B
�
B	�B	r�)rr r!rr�r�r�r�r�r�r�r�r�rdr�rr�r�r�r�r�r�r�r�r�r�r*rrr�r�se������
�F����($�$�$���� "�"�"�"�"�"�,	.�	.�	.��X�����V�,�,�:�<�<�#�#�<�<�#�,�"�#�#�#�"�#����$"&�"&�"&�PH�H�H�H�:�"�&�&�#�"�&�4F�F�F�"1�1�1����"'�'�'�'�'rr�c��eZdZdS)�
GzipWriteTestNr�r*rrr�r�<r�rr�c��eZdZdS)�Bz2WriteTestNr�r*rrr�r�@r�rr�c��eZdZdS)�
LzmaWriteTestNr�r*rrr�r�Dr�rr�c��eZdZdZdZd�Zejej	dkoe
ed��d��eje
jpe
jd��d�����ZdS)	�StreamWriteTestzw|Nc�z�tjt|j��}|���|jr�|���}ttd��5}|���}ddd��n#1swxYwY|�|��}|�|j	d��nF|�t��5}|���}ddd��n#1swxYwY|�
|�d��tjd��dS)Nrrzfound trailing datarzincorrect zero padding)
r&r%r�rrJ�decompressorrS�
decompressr��unused_datarT�countr�)rrG�decrZrs     r�test_stream_paddingz#StreamWriteTest.test_stream_paddingMs����l�7�D�I�.�.���	�	������	#��#�#�%�%�C��g�t�$�$�
#���y�y�{�{��
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#��>�>�$�'�'�D����S�_�.C�D�D�D�D����7�#�#�
#�t��y�y�{�{��
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#�������E�*�*�G�,>�0�	2�	2�	2�	2�	2s$�$B�B	�B	�C<�<D�Dr|�umaskzMissing umask implementationz$Emscripten's/WASI's umask is a stub.c���tj�t��rt	jt��tjd��}	tjt|j	��}|�
��tjt��jdz}|�
|dd��tj|��dS#tj|��wxYw)N�r}i�zwrong file permissions)rdre�existsr�rror�r&r%rrJr�r�rT)r�original_umaskrGrs    r�test_file_modezStreamWriteTest.test_file_mode]s����7�>�>�'�"�"�	&���W�%�%�%���%����	%��,�w��	�2�2�C��I�I�K�K�K��7�7�#�#�+�e�3�D����T�5�*B�C�C�C��H�^�$�$�$�$�$��B�H�^�$�$�$�$���s
�A+C�C*)rr r!rr�r�r�r�r�r�r�rdr�r�
is_emscripten�is_wasirr*rrr�r�Hs�������
�F��L�2�2�2� �X�����0�I�W�W�R��5I�5I�7�9�9��X�_���0���.���
%�
%�	��9�9�
%�
%�
%rr�c��eZdZd�ZdS)�GzipStreamWriteTestc���tjt|j�����tjt���d���}dS)zf
        Ensure the source directory is not included in the tar header
        per bpo-41316.
        zlatin-1rrN)r&r%r�rrJr�r��	read_text)r�payloads  r� test_source_directory_not_leakedz4GzipStreamWriteTest.test_source_directory_not_leakedtsH��
	��W�d�i�(�(�.�.�0�0�0��,�w�'�'�1�1�9�1�E�E���rN)rr r!rr*rrrrss#������7�7�7�7�7rrc�$�eZdZerejndZdS)�Bz2StreamWriteTestN)rr r!r4�BZ2Decompressorr�r*rrr
r
~s ������*-�7�3�&�&�4�L�L�Lrr
c�$�eZdZerejndZdS)�LzmaStreamWriteTestN)rr r!r<�LZMADecompressorr�r*rrr
r
�s ������,0�:�4�(�(�d�L�L�Lrr
c�Z�eZdZd�Zdd�Zdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�ZdS)�GNUWriteTestc�6�t|��dzdz}|dzS)Nrwrs)rU)rr|�blockss   r�_lengthzGNUWriteTest._length�s ���Q���3���"����|�rNc��d}t|��tjkr|dz
}||�|��z
}|�:t|��tjkr|dz
}||�|��z
}|S)Nrw)rUr&�LENGTH_NAMEr�LENGTH_LINK)rr�rjr�s    r�
_calc_sizezGNUWriteTest._calc_size�sw�����t�9�9�w�*�*�*��S�L�E��T�\�\�$�'�'�'�E����D�	�	�G�,?� ?� ?��S�L�E��T�\�\�$�'�'�'�E��rc��tj|��}|r||_tj|_tjtd��}	tj|_|�	|��|�
||��}|j}|�||d��|�
��n#|�
��wxYwtjt��}	|���}|�|d��|�|j|jd��|�|j|jd��|�
��dS#|�
��wxYw)Nr�z%GNU longname/longlink creation failedzunable to read longname member)r&rr�LNKTYPErZr%r�rqr�rrrTrTrJrr�r�)rr�rjrYrGr�r��members        r�_testzGNUWriteTest._test�sZ���/�$�'�'���	+�#�G��"�?�G�L��l�7�C�(�(��	� �+�C�J��K�K�� � � �����t�,�,�B���B����R��%L�M�M�M��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�#�#��		��X�X�Z�Z�F�� � ��4�
6�
6�
6����W�\�6�;�4�
6�
6�
6����W�-�v��4�
6�
6�
6�
�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�
AB9�9C�,A,E.�.Fc�0�|�d��dS)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�rrs r�test_longname_1023zGNUWriteTest.test_longname_1023�s���
�
�1�2�2�2�2�2rc�0�|�d��dS)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/longnamerrs r�test_longname_1024zGNUWriteTest.test_longname_1024�s���
�
�2�3�3�3�3�3rc�0�|�d��dS)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_rrs r�test_longname_1025zGNUWriteTest.test_longname_1025�s���
�
�3�4�4�4�4�4rc�2�|�dd��dS)Nr��longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnkrrs r�test_longlink_1023zGNUWriteTest.test_longlink_1023�s���
�
�6�9�:�:�:�:�:rc�2�|�dd��dS)Nr��longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlinkrrs r�test_longlink_1024zGNUWriteTest.test_longlink_1024�s���
�
�6�:�;�;�;�;�;rc�2�|�dd��dS)Nr��longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/longlnk/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_rrs r�test_longlink_1025zGNUWriteTest.test_longlink_1025�s���
�
�6�;�<�<�<�<�<rc�2�|�dd��dS)Nrr'rrs r�test_longnamelink_1023z#GNUWriteTest.test_longnamelink_1023�s(���
�
�1�1�	3�	3�	3�	3�	3rc�2�|�dd��dS)Nr!r*rrs r�test_longnamelink_1024z#GNUWriteTest.test_longnamelink_1024�s(���
�
�2�2�	4�	4�	4�	4�	4rc�2�|�dd��dS)Nr$r-rrs r�test_longnamelink_1025z#GNUWriteTest.test_longnamelink_1025�s(���
�
�3�3�	5�	5�	5�	5�	5rr)rr r!rrrrr"r%r(r+r.r0r2r4r*rrrr�s������������������:3�3�3�4�4�4�5�5�5�;�;�;�<�<�<�=�=�=�3�3�3�4�4�4�5�5�5�5�5rrc��eZdZdZd�ZdS)�DeviceHeaderTestrc�|�tj�td��}tj|��	tjt|j��}	tj	d���}tj	d���}t
j
|_t
j|_|�
|��|�
|��|���n#|���wxYwtjtd��}	|�d��}|�d��}|���n#|���wxYw|�|jd��|�|jd��|�|jd��|�|jd��t
td��5}|���}ddd��n#1swxYwY||j|j�}	||j|j�}
t-dd	��}|�|	|d
��|�|
|d��t/j|��dS#t/j|��wxYw)N�device_header_test�my_block_device�r��my_regular_filer_rrriIiYs00000000000000s)rdrerfrcr�r&r%r�rr�BLKTYPErZ�REGTYPErrJrQrTr!r"rSrT�offset_data�slicerr�)rr�rG�	input_blk�	input_reg�
output_blk�
output_reg�infiler��buf_blk�buf_reg�device_headerss            r�*test_headers_written_only_for_device_filesz;DeviceHeaderTest.test_headers_written_only_for_device_files�s����'�,�,�w�(<�=�=��
������#	&��,�w��	�2�2�C�
�#�O�1B�C�C�C�	�#�O�1B�C�C�C�	�!(��	��!(��	�����I�&�&�&����I�&�&�&��	�	�������	�	���������,�w��,�,�C�
� �]�]�+<�=�=�
� �]�]�+<�=�=�
��	�	�������	�	�����������Z�0�!�4�4�4����Z�0�!�4�4�4����Z�0�!�4�4�4����Z�0�!�4�4�4��g�t�$�$�
$���k�k�m�m��
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$��*�+�J�,B�B�C�G��*�+�J�,B�B�C�G�#�3��1�1�N����W�^�4�6F�G�G�G����W�^�4�j�A�A�A���W�%�%�%�%�%��I��W�%�%�%�%���sb�J%�A6C&�J%�&C<�<J%�*E�J%�E/�/BJ%�3H�J%�H�J%�H�A3J%�%J;N)rr r!rrHr*rrr6r6�s(������
�F�'&�'&�'&�'&�'&rr6c��eZdZdZej�ed��Zd�Z	e
d���Ze
d���Zd�Z
d�Zd�Zd	�Zd
�Zd�ZdS)
�
CreateTestzx:�
spameggs42c�8�tjt��dSr)rror�rs rrHzCreateTest.setUps�����!�!�!�!�!rc��t|jd��5}|�d��ddd��dS#1swxYwYdS)Nr�r�)r%�	file_pathr)�clsrZs  r�
setUpClasszCreateTest.setUpClasss���
�#�-��
&�
&�	�$��J�J�v����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s
�9�=�=c�8�tj|j��dSr)rrorN�rOs r�
tearDownClasszCreateTest.tearDownClasss������'�'�'�'�'rc��tjt|j��5}|�|j��ddd��n#1swxYwY|�t��5}|���}ddd��n#1swxYwY|�t|��d��|�
d|d��dS�NrsrKr)r&r%r�rr�rNr(rrTrUr��r�tobj�namess   r�test_createzCreateTest.test_creates)��
�\�'�4�9�
-�
-�	%���H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��\�\�'�
"�
"�	$�d��M�M�O�O�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�-�-s#�A�A�A�,B
�
B�Bc�T�tjt|j��5}|�|j��ddd��n#1swxYwY|�t��5tjt|j��}ddd��n#1swxYwY|�t��5}|�	��}ddd��n#1swxYwY|�
t|��d��|�d|d��dSrU)
r&r%r�rr�rNr�FileExistsErrorr(rrTrUr�rVs   r�test_create_existingzCreateTest.test_create_existing s���
�\�'�4�9�
-�
-�	%���H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��
�
��
/�
/�	4�	4��<����3�3�D�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4��\�\�'�
"�
"�	$�d��M�M�O�O�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�-�-s5�A�A�A�, B�B�B�=C�C"�%C"c��|�td��5}|�|j��ddd��n#1swxYwY|�t��5}|���}ddd��n#1swxYwY|�t
|��d��|�d|d��dS�N�xrsrKr)r(r�r�rNrrTrUr�rVs   r�test_create_taropenzCreateTest.test_create_taropen,s)��
�\�\�'�3�
'�
'�	%�4��H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��\�\�'�
"�
"�	$�d��M�M�O�O�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�-�-s#�A�A�
A�(B	�	B
�B
c�v�|�td��5}|�|j��ddd��n#1swxYwY|�t
��5|�td��5	ddd��n#1swxYwYddd��n#1swxYwY|�t��5}|���}ddd��n#1swxYwY|�t|��d��|�	d|d��dSr^)
r(r�r�rNrr[rrTrUr�rVs   r�test_create_existing_taropenz'CreateTest.test_create_existing_taropen5s��
�\�\�'�3�
'�
'�	%�4��H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��
�
��
/�
/�	�	����g�s�+�+�
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��\�\�'�
"�
"�	$�d��M�M�O�O�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�-�-sY�A�A�
A�(B)�B�B)�B	�B)�B	�B)�)B-�0B-�C/�/C3�6C3c�Z�tjtjt��|j��5}|�|jt��|�	|jtj�t����|�
tj|j����|���}ddd��n#1swxYwY|�	t!|��d��|�d|d��|�t��5}|���}ddd��n#1swxYwY|�	t!|��d��|�d|d��dSrU)r&r%r�r�r�rr5r�r6rTrdrer7r�rNrrUr�r(rVs   r�test_create_pathlike_namez$CreateTest.test_create_pathlike_nameBs���
�\�'�,�w�/�/���
;�
;�	$�t��!�!�$�)�S�1�1�1����T�Y������(@�(@�A�A�A��H�H�W�\�$�.�1�1�2�2�2��M�M�O�O�E�		$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�
	
����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�
�\�\�'�
"�
"�	$�d��M�M�O�O�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�-�-s$�BC�C �#C �E!�!E%�(E%c�R�|�tjt��d��5}|�|jt��|�|jtj	�
t����|�tj|j����|�
��}ddd��n#1swxYwY|�t|��d��|�d|d��|�t��5}|�
��}ddd��n#1swxYwY|�t|��d��|�d|d��dSr^)r(r�r�r�r5r�r6rTrdrer7r�rNrrUr�rVs   r�!test_create_taropen_pathlike_namez,CreateTest.test_create_taropen_pathlike_namePs���
�\�\�'�,�w�/�/��
5�
5�	$���!�!�$�)�S�1�1�1����T�Y������(@�(@�A�A�A��H�H�W�\�$�.�1�1�2�2�2��M�M�O�O�E�		$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�
	
����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�
�\�\�'�
"�
"�	$�d��M�M�O�O�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����U���Q�'�'�'��
�
�l�E�!�H�-�-�-�-�-s$�BC�C�C�<E�E!�$E!N)rr r!rrdrerfrcrNrH�classmethodrPrSrYr\r`rbrdrfr*rrrJrJs�������
�F�����W�l�3�3�I�"�"�"�����[���(�(��[�(�.�.�.�
.�
.�
.�.�.�.�.�.�.�.�.�.�.�.�.�.�.rrJc��eZdZd�ZdS)�GzipCreateTestc��tjt|jd���5}|�|j��ddd��n#1swxYwYtjtdd���5}	ddd��dS#1swxYwYdS)Nrsr�zr:gz�r&r%r�rr�rN�rrWs  r�test_create_with_compresslevelz-GzipCreateTest.test_create_with_compresslevelas���
�\�'�4�9�A�
>�
>�
>�	%�$��H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�
�\�'�6��
;�
;�
;�	�t��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�#�A	�	A
�A
�0A?�?B�BN�rr r!rmr*rrriri_�#����������rric��eZdZd�ZdS)�
Bz2CreateTestc��tjt|jd���5}|�|j��ddd��n#1swxYwYtjtdd���5}	ddd��dS#1swxYwYdS)Nrsr��r:bz2rkrls  rrmz,Bz2CreateTest.test_create_with_compressleveljs���
�\�'�4�9�A�
>�
>�
>�	%�$��H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�
�\�'�7�!�
<�
<�
<�	���	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	rnNror*rrrrrrhrprrrc��eZdZd�ZdS)�LzmaCreateTestc��tjt|jd���5}|�|j��ddd��dS#1swxYwYdS)Nrs)�presetrkrls  r�test_create_with_presetz&LzmaCreateTest.test_create_with_presetus���
�\�'�4�9�Q�
7�
7�
7�	%�4��H�H�T�^�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s�A
�
A�AN)rr r!ryr*rrrvrvqs#������%�%�%�%�%rrvc��eZdZdZdZdZdS)�CreateWithXModeTestr_N)rr r!rr`rbr*rrr{r{zs!������
�F���#'� � � rr{rjrkc�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�HardlinkTestc�N�tj�td��|_tj�td��|_t
|jd��5}|�d��ddd��n#1swxYwY	tj|j|j��n/#t$r"}|�
d|z��Yd}~nd}~wwxYwtjtd��|_
|j
�|j��dS)Nrr�r��foor�r�)rdrerfrcrr�r%rrjr�r�r&r�rGr�)rrZr�s   rrHzHardlinkTest.setUp�s:���7�<�<���/�/����7�<�<���/�/���
�$�(�D�
!�
!�	�T��J�J�v����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	/��G�D�H�d�h�'�'�'�'���	/�	/�	/��M�M�/�A�-�.�.�.�.�.�.�.�.�����	/�����<���-�-�������T�X�����s*�*B�B�B�B8�8
C$�C�C$c��|j���tj|j��tj|j��dSr)rGrJrrorr�rs rrKzHardlinkTest.tearDown�s@�������������"�"�"�����"�"�"�"�"rc��|j�|j��}|�|jt
jd��dS)Nzadd file as regular failed)rGr�rrTrZr&r=r\s  r�test_add_twicezHardlinkTest.test_add_twice�sH���(�%�%�d�h�/�/�������w��,�	.�	.�	.�	.�	.rc��|j�|j��}|�|jt
jd��dS)Nzadd file as hardlink failed)rGr�r�rTrZr&rr\s  r�test_add_hardlinkzHardlinkTest.test_add_hardlink�sF���(�%�%�d�h�/�/�������w��-�	/�	/�	/�	/�	/rc��d|j_|j�|j��}|�|jtjd��dS)NTzdereferencing hardlink failed)rG�dereferencer�r�rTrZr&r=r\s  r�test_dereference_hardlinkz&HardlinkTest.test_dereference_hardlink�sP��#�����(�%�%�d�h�/�/�������w��/�	1�	1�	1�	1�	1rN)rr r!rHrKr�r�r�r*rrr}r}�s_������
�
�
�#�#�#�
.�.�.�/�/�/�
1�1�1�1�1rr}c�(�eZdZdd�Zd�Zd�Zd�ZdS)�PaxWriteTestNc��tj|��}|r||_tj|_tjtdtj���}	|�|��|�	��n#|�	��wxYwtjt��}	|r7|�
��dj}|�||d��n6|�
��dj}|�||d��|�	��dS#|�	��wxYw)Nr��r�rzPAX longlink creation failedzPAX longname creation failed)
r&rrrrZr%r�r�rrJr�rTr�)rr�rjrYrG�l�ns       rrzPaxWriteTest._test�s���/�$�'�'���	+�#�G��"�?�G�L��l�7�C��0B�C�C�C��	��K�K�� � � ��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�#�#��	��
J��N�N�$�$�Q�'�0��� � ��q�*H�I�I�I�I��N�N�$�$�Q�'�,��� � ��q�*H�I�I�I��I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�B�B�3A/D8�8Ec���dddddd�}tjtdtj|���}	|�tjd����|���n#|���wxYwtjtd	�
��}	|�|j|��|�|�	��dj|��|j�
��D]�\}}|�t|��t��|�t|��t��|tjvrH	tj||���#tt f$r|�d��Y��wxYw��	|���dS#|���wxYw)
Nr��0z1.23�äöü�test)rr�rcr�r�r�)r�rxrCrrrz"unable to convert pax header field)r&r%r�r�rrrJrTrxr�r�assertIsNotrZrH�PAX_NUMBER_FIELDSr�rPr�)rrxrG�key�vals     r�test_pax_global_headerz#PaxWriteTest.test_pax_global_header�s������&� &�(�(���l�7�C��0B�'�)�)�)��	��K�K����/�/�0�0�0��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�[�9�9�9��
	����S�_�k�:�:�:����S�^�^�-�-�a�0�<�k�J�J�J��O�1�1�3�3�
H�
H���S�� � ��c���E�2�2�2�� � ��c���E�2�2�2��'�3�3�3�H��1�#�6�s�;�;�;�;��%�z�2�H�H�H��	�	�"F�G�G�G�G�G�H����4�
H�
�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s<�'A-�-B�"C
G�-F�G�&F1�.G�0F1�1G�G"c��ddd�}tjtdtjd���}	tj��}d|_d|_||_|�|��|�	��n#|�	��wxYwtjtd�	��}	|�
��d
}|�|j|��|�|jd��|�|jd��|�	��dS#|�	��wxYw)Nr�123)rer�r�rCr�r��rrrr})r&r%r�r�rr�r�rxrrJr�rT)rrxrGrs    r�test_pax_extended_headerz%PaxWriteTest.test_pax_extended_header�s"�� %�U�3�3���l�7�C��0B�$/�1�1�1��	���!�!�A�#�A�F��A�E�'�A�M��K�K��N�N�N��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�[�9�9�9��	���� � ��#�A����Q�]�K�8�8�8����Q�V�U�+�+�+����Q�U�C�(�(�(��I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�=B�B�5A+D6�6Ec�h�tj��}d|_d|_d|_d|_d|_|���}|�|d���}|�	|dd��|�
|d	t��|�	|d	d
��|�	|dd��|�	|dd��|�	|d
d��|�	|dtd��zdztd��zdztd��zdztd��zdztd��zdztd��zdztd��z��tj��}d|_d|_d|_d|_d|_|���}|�|d���}|�	|dd��|�	|d	d��|�	|dd��|�	|dd��|�	|d
d��|�	|dtd��zdztd��zdztd��zdzdzd ztd!��zd"ztd#��zd$ztd��zdztd��z��dS)%Nrg�����@�@r�r}�|rCrrr�rcrrVr�r�s././@PaxHeader�Vs90000000000000000000000000000002000000000000010205 xsustar00�s16 mtime=1000.1
i�r�as90000644000017300001740000000014400000001750006516 0ufoo㍴ld(	r�irs90000000000000000000000000000013000000000000010207 xs15 path=foo㍴
16 uid=16777216
s$16 gid=16777217
20 size=10000000000
s21 mtime=10000000000
i�sfoo?�`s90000644000000000000000000000000000000000000006540 0)
r&rr�rcrVr�r�r��create_pax_headerrTr5rCrH)rr�infor�s    r�test_create_pax_headerz#PaxWriteTest.test_create_pax_headerso��
�O��������������������z�z�|�|���$�$�T�K�$�@�@������f��u�-�-�-����d�7�m�S�1�1�1�����g���-�-�-�����f��s�+�+�+�����e��c�*�*�*�����e��c�*�*�*�������b�	�	�)�\�
]��C�j�j�
�)�
*�+0��:�:�
6�#�
#�&+�3�Z�Z�
0�39�
9�<A��9�9�
E�]�	
]�
�C�j�j�
�
*�
*�
-2�#�J�J�
7�	8�	8�	8�
�O��������������������z�z�|�|���$�$�T�K�$�@�@������f��{�3�3�3�����g���*�*�*�����f��q�)�)�)�����e��a�(�(�(�����e��a�(�(�(�������b�	�	�)�\�
]��C�j�j�
�)�
*�,1�#�J�J�
7�<�
<�8�	
8�
(�
(�
*/�s���
4�
7>�
>�
AF�b�	�	�
J�]�

]��C�j�j�
�*�
*�-2�#�J�J�
7�	8�	8�	8�	8�	8rr)rr r!rr�r�r�r*rrr�r��sV����������0���@���258�58�58�58�58rr�c�8�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�UnicodeTestc�0�|�d��dS)NrC��_test_unicode_filenamers r�test_iso8859_1_filenamez#UnicodeTest.test_iso8859_1_filename:s���#�#�K�0�0�0�0�0rc�0�|�d��dS)N�utf7r�rs r�test_utf7_filenamezUnicodeTest.test_utf7_filename=s���#�#�F�+�+�+�+�+rc�0�|�d��dS)N�utf-8r�rs r�test_utf8_filenamezUnicodeTest.test_utf8_filename@s���#�#�G�,�,�,�,�,rc���tjtd|j|d���}	d}|�tj|����|���n#|���wxYwtjt|���}	|�|���dj	|��|���dS#|���wxYw)Nr�rQ�r�rE�errorsr�rrr)
r&r%r�r�rrrJrTr�r�)rrErGr�s    rr�z"UnicodeTest._test_unicode_filenameCs����l�7�C���$,�X�?�?�?��	�!�D��K�K����-�-�.�.�.��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�X�6�6�6��	����S�^�^�-�-�a�0�5�t�<�<�<��I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�)A#�#A9�3C!�!C7c�|�tjtd|jdd���}	tj��}d|_|�t|j|��d|_d|_	|�t|j|��|�
��dS#|�
��wxYw)Nr�r�rQr�r�r)r&r%r�r�rr�r�UnicodeErrorrrerJrzs   r�test_unicode_filename_errorz'UnicodeTest.test_unicode_filename_errorRs����l�7�C���$+�H�>�>�>��
	��o�'�'�G�)�G�L����l�C�K��A�A�A� �G�L�*�G�M����l�C�K��A�A�A��I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�A*B%�%B;c��tjtddd���}	|D]�}|�t	|j��t��|�t	|j��t��|�t	|j��t��|�t	|j	��t����	|�
��dS#|�
��wxYw)Nr_rCrQ�rEr�)r&r%r"r%rZr�r6rrerrJr�s   r�test_unicode_argumentz!UnicodeTest.test_unicode_argumentas����l�7�C�$/��B�B�B��	��
2�
2���
�
�d�1�6�l�l�C�0�0�0��
�
�d�1�:�.�.��4�4�4��
�
�d�1�7�m�m�S�1�1�1��
�
�d�1�7�m�m�S�1�1�1�1�	
2�
�I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�B9C/�/Dc�\�tjd��}d|_d|_tjt
d|jd���}	|�|��|���n#|���wxYwtjt
d���}	|�	d��}|�
|jd��|�
|jd��|jtjkrz|���tjt
d���}|�	d��}|�
|jd��|�
|jd��|���dS#|���wxYw)	Nrr�r�rC)rr�rErrr�u	���)r&rrerr%r�r�rrJrQrTr�)rrrGs   r�test_uname_unicodezUnicodeTest.test_uname_unicodemsf���O�E�"�"�� ��� ����l�7��T�[�$/�1�1�1��	��K�K��N�N�N��I�I�K�K�K�K��C�I�I�K�K�K�K�����l�7�[�9�9�9��	��
�
�e�$�$�A����Q�W�n�5�5�5����Q�W�n�5�5�5��{�g�0�0�0��	�	�����l�7�W�=�=�=���M�M�%�(�(��� � ���*>�?�?�?�� � ���*>�?�?�?��I�I�K�K�K�K�K��C�I�I�K�K�K�K���s�A0�0B�%CF�F+N)
rr r!r�r�r�r�r�r�r�r*rrr�r�8s}������1�1�1�,�,�,�-�-�-�
�
�
�
�
�
�
�
�
�����rr�c�\�eZdZejZd�Zd�Zd�Zd�Z	d�Z
d�Zdd�Zd	�Z
d
�Zdd�ZdS)
�UstarUnicodeTestc���|�d��|�dt��|�d��|�dt��dS�Nr��e01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890ud01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567ÿue012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678ÿ��_test_ustar_namerPrs r�test_unicode_name1z#UstarUnicodeTest.test_unicode_name1��`�����/�0�0�0����5�z�B�B�B����?�@�@�@����@�*�M�M�M�M�Mrc�f�|�d��|�dt��dS�Nud012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345ÿÿue0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456ÿÿr�rs r�test_unicode_name2z#UstarUnicodeTest.test_unicode_name2��4�����A�B�B�B����B�J�O�O�O�O�Orc���|�d��|�dt��|�d��|�dt��dS)Na01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123/40123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012ÿ/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123ÿ/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789r�rs r�test_unicode_longname1z'UstarUnicodeTest.test_unicode_longname1�sb�����N�O�O�O����N�PZ�[�[�[����P�Q�Q�Q����Q�S]�^�^�^�^�^rc�r�|�dt��|�dt��dS)Nu01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901ÿ/20123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901ÿÿ/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789r�rs r�test_unicode_longname2z'UstarUnicodeTest.test_unicode_longname2�s8�����P�R\�]�]�]����S�U_�`�`�`�`�`rc��|�dt��|�d��|�dt��dS)Nu01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901ÿÿ/20123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789u01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567ÿu01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678ÿr�rs r�test_unicode_longname3z'UstarUnicodeTest.test_unicode_longname3�sM�����T�V`�a�a�a����^�_�_�_����_�ak�l�l�l�l�lrc�f�|�d��|�dt��dS)Nu01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345ÿÿu01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456ÿÿr�rs r�test_unicode_longname4z'UstarUnicodeTest.test_unicode_longname4�s5�����`�a�a�a����a�cm�n�n�n�n�nrNc��tjtd|jd���5}tj|��}|�|�|��n|�||j|��ddd��n#1swxYwY|�Wtjtdd���5}|D]}|�||j��ddd��dS#1swxYwYdSdS)Nr�r�r�r_rr)	r&r%r�r�rrrrTr��rr��excrGrs     rr�z!UstarUnicodeTest._test_ustar_name�s_��
�\�'�3�t�{�W�
M�
M�
M�	7�QT����%�%�A��{����A������!�!�#�s�{�A�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7��;���g�s�W�=�=�=�
�����A��$�$�T�1�6�2�2�2��
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
��;s$�A	A8�8A<�?A<�!!C�C�Cc���|�d��|�dt��|�d��|�dt��dSr���_test_ustar_linkrPrs r�test_unicode_link1z#UstarUnicodeTest.test_unicode_link1�r�rc�f�|�d��|�dt��dSr�r�rs r�test_unicode_link2z#UstarUnicodeTest.test_unicode_link2�r�rc���tjtd|jd���5}tjd��}||_|�|�|��n|�||j|��ddd��n#1swxYwY|�Wtjtdd���5}|D]}|�||j��ddd��dS#1swxYwYdSdS)Nr�r�r�rr_rr)	r&r%r�r�rrrrrTr�s     rr�z!UstarUnicodeTest._test_ustar_link�sf��
�\�'�3�t�{�W�
M�
M�
M�	7�QT����&�&�A��A�J��{����A������!�!�#�s�{�A�6�6�6�
	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7��;���g�s�W�=�=�=�
�����A��$�$�T�1�:�6�6�6��
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
��;s$�AA?�?B�B�(!C�C�Cr)rr r!r&r�r�r�r�r�r�r�r�r�r�r�r�r*rrr�r��s�������
�
!�F�
N�N�N�P�P�P�_�_�_�a�a�a�m�m�m�
o�o�o�����N�N�N�P�P�P�
�
�
�
�
�
rr�c�"�eZdZejZd�ZdS)�GNUUnicodeTestc��dD]u\}}tjt|d���5}	|�|��}n%#t$r|�d��YnwxYwddd��n#1swxYwY�vdS)N))r�upax/bad-pax-���)rCupax/bad-pax-äöür�r�z%unable to read bad GNU tar pax header�r&r%r"rQr_r��rrEr�rGrs     r�test_bad_pax_headerz"GNUUnicodeTest.test_bad_pax_header�s���<�	G�	G�N�H�d���g��%6�8�8�8�
G�;>�G��
�
�d�+�+�A�A���G�G�G��I�I�E�F�F�F�F�F�G����	
G�
G�
G�
G�
G�
G�
G�
G�
G�
G�
G����
G�
G�
G�
G��	G�	G�1�A-�<�A-�A�A-�A�A-�-A1	�4A1	N)rr r!r&rqr�r�r*rrr�r��s0������
�
�F�G�G�G�G�Grr�c�&�eZdZejZdZd�ZdS)�PAXUnicodeTestNc��dD]u\}}tjt|d���5}	|�|��}n%#t$r|�d��YnwxYwddd��n#1swxYwY�vdS)N))r�upax/hdrcharset-���)rCupax/hdrcharset-äöür�r�z)unable to read POSIX.1-2008 binary headerr�r�s     r�test_binary_headerz!PAXUnicodeTest.test_binary_header�s���?�	K�	K�N�H�d���g��%6�8�8�8�
K�;>�K��
�
�d�+�+�A�A���K�K�K��I�I�I�J�J�J�J�J�K����	
K�
K�
K�
K�
K�
K�
K�
K�
K�
K�
K����
K�
K�
K�
K��	K�	Kr�)rr r!r&r�r�r�r�r*rrr�r��s8������
�
�F�#'��
K�
K�
K�
K�
Krr�c�"�eZdZd�Zdd�Zd�ZdS)�AppendTestBasec��t|_tj�|j��rtj|j��dSdSr)r�r"rdrer�rrors rrHzAppendTestBase.setUp	sD�����
�7�>�>�$�,�'�'�	+���T�\�*�*�*�*�*�	+�	+rrc��tjtd���5}|�d��}d|_|�|��5}tj|j|��5}|�||��ddd��n#1swxYwYddd��n#1swxYwYddd��dS#1swxYwYdS)NrCrrrOr)r&r%r"rQr�rRr)rr�srcrrUrGs      r�_create_testtarzAppendTestBase._create_testtar	sn��
�\�'�K�
8�
8�
8�	&�C��
�
�o�.�.�A��A�F�����#�#�
&�q��\�$�,��5�5�&���K�K��1�%�%�%�&�&�&�&�&�&�&�&�&�&�&����&�&�&�&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&����
&�
&�
&�
&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	&�	&sY�2B;�B#�)B�B#�B�B#�B�B#�B;�#B'	�'B;�*B'	�+B;�;B?�B?c��|�d|jz��|�tjtjtd��dS)Nrr�)r�rrr&rr%r�rs r�test_append_compressedz%AppendTestBase.test_append_compressed	sB�����T�D�K�/�0�0�0����'�+�W�\�7�C�H�H�H�H�HrN)r)rr r!rHr�r�r*rrr�r��sK������+�+�+�
&�&�&�&�I�I�I�I�Irr�c�j�eZdZdZdd�Zdgdfd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�ZdS)�
AppendTestNc��tj|jd|���5}|�tjd����ddd��dS#1swxYwYdS)Nr�r�r�)r&r%r"rr)rr4rGs   r�
_add_testfilezAppendTest._add_testfile	s���
�\�$�,��W�
=�
=�
=�	0���K�K����.�.�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s�(A�A�Ar�c��tj|j|���5}|�|���|��ddd��dS#1swxYwYdS)Nr�)r&r%r"rTr)rrXr4rGs    rrzAppendTest._test	s���
�\�$�,��
8�
8�
8�	4�C����S�\�\�^�^�U�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�	4�	4s�)A�A�Ac�V�|���|���dSr)r�rrs r�test_non_existingzAppendTest.test_non_existing	s%���������
�
�����rc��tj|jd�����|���|���dS)Nr)r&r%r"rJr�rrs r�
test_emptyzAppendTest.test_empty!	sE����T�\�4�(�(�.�.�0�0�0��������
�
�����rc��tjd��}|�|��|�d��|�|���dS)Nsrr�)r#r�r�rxrr�s  r�test_empty_fileobjzAppendTest.test_empty_fileobj&	sN���z�,�'�'�����4� � � ��	�	�!�����
�
�4�
� � � � � rc�^�|���t|jd��5}|���}ddd��n#1swxYwYt	j|��}|�|��|�d��|�ddg|���dS)Nrrrrr�)rXr4)	r�r%r"rSr#r�r�rxrr�s   r�test_fileobjzAppendTest.test_fileobj,	s���������
�$�,��
%�
%�	���9�9�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��z�$�������4� � � ��	�	�!�����
�
�%����
�6�6�6�6�6s�A�A�Ac��|���|���|�ddg���dS)Nrr�)rX)r�r�rrs r�
test_existingzAppendTest.test_existing5	sD���������������
�
�%���
�(�(�(�(�(rc���t|jd��5}|�|��ddd��n#1swxYwY|�tj|j��dSr)r%r"rrr&rr�)rrrZs   r�_test_errorzAppendTest._test_error<	s���
�$�,��
%�
%�	���J�J�t����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����'�+�T�-?�@�@�@�@�@s�8�<�<c�0�|�d��dS)Nr�r�rs r�	test_nullzAppendTest.test_nullA	s����������rc�0�|�d��dS)N�
r�rs r�test_incompletezAppendTest.test_incompleteD	�������$�$�$�$�$rc�|�tjd�����}|�|��dS)Nr�r&rrr��rrs  r�test_premature_eofzAppendTest.test_premature_eofG	s7����u�%�%�+�+�-�-����������rc��tjd�����}|�|dz��dS)Nrrrrs  r�test_trailing_garbagez AppendTest.test_trailing_garbageK	s<����u�%�%�+�+�-�-������
�*�+�+�+�+�+rc�0�|�d��dS)Nsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar�rs r�test_invalidzAppendTest.test_invalidO	rrr)rr r!r�r�rr�r�r�r�r�r�rrrr
rr*rrr�r�	s�������!��0�0�0�0�!�'�4�4�4�4�4�������
!�!�!�7�7�7�)�)�)�A�A�A�
���%�%�%����,�,�,�%�%�%�%�%rr�c��eZdZdS)�GzipAppendTestNr�r*rrrrR	r�rrc��eZdZdS)�
Bz2AppendTestNr�r*rrrrU	r�rrc��eZdZdS)�LzmaAppendTestNr�r*rrrrX	r�rrc� �eZdZd�Zd�Zd�ZdS)�
LimitsTestc�d�tjd��}|�tj��tjd��}|�t
|jtj��tjd��}|�tj��tjd��}|�t
|jtj��tjd��}|�t
|jtj��tjd��}d|_|�t
|jtj��tjd��}d|_|�t
|jtj��dS)	Nr�r�a123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/123/longnamea1234567/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/longnamerLr�� )r&rrr�rrPrr�r\s  r�test_ustar_limitszLimitsTest.test_ustar_limits^	sL���/�"3�4�4���
�
�g�*�+�+�+��/�"9�:�:�����*�g�m�W�5I�J�J�J��/�":�;�;���
�
�g�*�+�+�+��/�">�?�?�����*�g�m�W�5I�J�J�J��/�";�<�<�����*�g�m�W�5I�J�J�J��/�*�-�-��4������*�g�m�W�5I�J�J�J��/�&�)�)�� ������*�g�m�W�5I�J�J�J�J�Jrc�l�tjd��}|�tj��tjd��}d|_|�tj��tjd��}d|_|�t|jtj��dS�NrrLr�l)r&rrrqrr�rrPr\s  r�test_gnu_limitszLimitsTest.test_gnu_limits}	s����/�";�<�<���
�
�g�(�)�)�)��/�*�-�-��4����
�
�g�(�)�)�)��/�&�)�)��+������*�g�m�W�5G�H�H�H�H�Hrc�T�tjd��}|�tj��tjd��}d|_|�tj��tjd��}d|_|�tj��dSr)r&rrr�rr�r\s  r�test_pax_limitszLimitsTest.test_pax_limits�	s����/�";�<�<���
�
�g�(�)�)�)��/�*�-�-��4����
�
�g�(�)�)�)��/�&�)�)��+����
�
�g�(�)�)�)�)�)rN)rr r!rrrr*rrrr\	sG������K�K�K�>I�I�I�
*�
*�
*�
*�
*rrc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�MiscTestc�Z�|�tjdddd��d��|�tjdddd��d��|�tjddd��d��|�tjd	dd��d��dS)
Nr�r�rQsfoo�foobarrrsfoobar)rTr&�stn�ntsrs r�test_char_fieldszMiscTest.test_char_fields�	s��������U�A�w��A�A�)�	+�	+�	+������X�q�'�8�D�D��	!�	!�	!������%5�w��I�I��	 �	 �	 ������]�G�X�F�F��	 �	 �	 �	 �	 rc���|�tjd��d��|�tjd��d��|�tjd��d��|�tjd��d��|�tjd	��d
��|�tjd��d��|�tjd
��d��|�tjd��d��|�tjd��d��dS)N�0000001rs�7777777��� r������������������rh�����������������rrs       )rTr&�ntirs r�test_read_number_fieldsz MiscTest.test_read_number_fields�	sT��	
�����^�4�4�a�8�8�8������^�4�4�i�@�@�@������%H�I�I�#�	%�	%�	%������%H�I�I�#�	%�	%�	%������%H�I�I��	�	�	������%H�I�I��	�	�	������%H�I�I�+�	-�	-�	-�	
�����U�+�+�Q�/�/�/������\�2�2�A�6�6�6�6�6rc�
�|�tjd��d��|�tjd��d��|�tjdtj���d��|�tjdtj���d	��|�tjd
tj���d��|�tjdtj���d
��|�tjdtj���d��|�tjdtj���d
��|�tjdtj���d��|�tjtjdtj�����d��dS)Nrsr'r)r(rr�r*r,r+rhr-r/r.r1r0gY�g0Bs�g��������r)rTr&�itnrqr2rs r�test_write_number_fieldsz!MiscTest.test_write_number_fields�	s��������Q����8�8�8������Y�/�/��@�@�@������Z��8J�K�K�K�<�	>�	>�	>������Z��8J�K�K�K�<�	>�	>�	>������R��0B�C�C�C�<�	>�	>�	>������T�'�2D�E�E�E�<�	>�	>�	>������%7�,3�,>�@�@�@�<�	>�	>�	>�	
�����V�G�4F�G�G�G�<�	>�	>�	>������]�7�;M�N�N�N�<�	>�	>�	>������W�[��g�>P�%Q�%Q�%Q�R�R�TU�V�V�V�V�Vrc��|�t��5tjddtj��ddd��n#1swxYwY|�t��5tjddtj��ddd��n#1swxYwY|�t��5tjddtj��ddd��n#1swxYwY|�t��5tjddtj��ddd��dS#1swxYwYdS)Nrhr!rl�����l)rrPr&r5r�rqrs r�test_number_field_limitsz!MiscTest.test_number_field_limits�	s��
�
�
�z�
*�
*�	5�	5��K��A�w�3�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
�
�z�
*�
*�	=�	=��K�
�A�w�';�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�
�
�
�z�
*�
*�	?�	?��K���7�+=�>�>�>�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?����	?�	?�	?�	?�
�
�
�z�
*�
*�	>�	>��K�
�q�'�*<�=�=�=�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>sG�!A�A�A�-!B�B�!B�?!C,�,C0�3C0�!D?�?E�Ec�F�hd�}tj|t|���dS)N>8�NUL�grpr5r2r$�pwdr#�mainr<�CHRTYPEr[rr=�SYMTYPE�XGLTYPEr��version�AREGTYPE�CONTTYPE�FIFOTYPE�filemoder��	GNU_MAGIC�	GNU_TYPES�
PAX_FIELDSr��
tar_filter�FilterErrorrr�POSIX_MAGIC�copyfileobj�data_filter�ExFileObject�calc_chksums�
LENGTH_PREFIX�
REGULAR_TYPES�EOFHeaderError�GNUTYPE_SPARSE�PAX_NAME_FIELDS�SOLARIS_XHDTYPE�SUPPORTED_TYPES�EmptyHeaderError�GNUTYPE_LONGLINKrp�SpecialFileError�AbsoluteLinkError�AbsolutePathErrorr��symlink_exception�InvalidHeaderError�TruncatedHeaderError�fully_trusted_filter�SubsequentHeaderError�OutsideDestinationError�LinkOutsideDestinationError)�not_exported)r�check__all__r&)rrds  r�test__all__zMiscTest.test__all__�	s3������"	��T�7��F�F�F�F�F�Frc�,�tj�tj�t��d��}|�tj��5}t
jd��f}tj
j�tj
d|���5t
j|��ddd��n#1swxYwYddd��n#1swxYwY|�dt!|j����dS)Nrzlzma module is not availabler>)r�z?
- method xz: CompressionError('lzma module is not available')
)rdrerf�dirname�__file__rr&r�CompressionErrorr�r�r�r�r'r%r�r6�	exception)r�fname�excinfor�s    r�.test_useful_error_message_when_modules_missingz7MiscTest.test_useful_error_message_when_modules_missing�	s^������R�W�_�_�X�6�6�8H�I�I��
�
�
�w�0�
1�
1�	$�W��,�-K�L�L�M�E���$�+�+�G�O�X�SX�+�Y�Y�
$�
$���U�#�#�#�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$�
$����
$�
$�
$�
$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�
	
�
�
�O���!�"�"�	
�	
�	
�	
�	
s7�"AC!�)C
�>C!�
C	�C!�C	�C!�!C%�(C%N)	rr r!r%r3r6r9rfrnr*rrrr�	st������ � � �7�7�7�(W�W�W�.>�>�>�G�G�G�(

�

�

�

�

rrc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�CommandLineTestc��tjddg|�Ri|��\}}}|�tj���d��S)N�-mr&�
)r	�assert_python_okr�rd�linesepr�)r�argsr�rcr��errs      r�
tarfilecmdzCommandLineTest.tarfilecmd�	s_��$�5�d�I�@��@�@�@�8>�@�@���C���{�{�2�:�,�,�.�.��6�6�6rc�(�tjddg|�R�S)Nrrr&)r	�assert_python_failure)rrvs  r�tarfilecmd_failurez"CommandLineTest.tarfilecmd_failure
s���2�4��J�T�J�J�J�Jrc�n�tjdd���tjdd���g}|�tj|��tj|d��5}|D]6}|�|tj	�
|������7	ddd��dS#1swxYwYdS)N�tokenize_tests.txt�tokenizedata�rH�9tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txtr�r�)rr!rnrror&r%r�rdrer�)r�tar_name�filesr��tardatas     r�make_simple_tarfilez#CommandLineTest.make_simple_tarfile
s ���!�"6�)7�9�9�9��!�#>�)7�9�9�9�:��
	
���	�(�(�3�3�3�
�\�(�C�
(�
(�	C�B� �
C�
C�����w���(8�(8��(A�(A��B�B�B�B�
C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�	C�	Cs�":B*�*B.�1B.c��|�tj|��tj|d��5}tjd��}|�|tjd�����tjd��}|�|tjd�����ddd��dS#1swxYwYdS)Nr��benignrr��../evil)	rnrror&r%rrr#r�)rr�r�r��evils     r�make_evil_tarfilez!CommandLineTest.make_evil_tarfile
s������	�(�(�3�3�3�
�\�(�C�
(�
(�	6�B��_�X�.�.�F��J�J�v�r�z�#���J�7�7�7��?�9�-�-�D��J�J�t�R�Z��_�_�J�5�5�5�		6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�	6�	6s�A;B>�>C�Cc��|���\}}}|�|d��|�d|�����|�d|�����|�d|�����|�dd��\}}}|�|d��|�|���d��dS)Nrsusageserrorsrequired�-lr)r|rTr��lowerrI�strip)rrwr�rxs    r�test_bad_usezCommandLineTest.test_bad_use
s����.�.�0�0���C������c�"�"�"��
�
�h��	�	���,�,�,��
�
�h��	�	���,�,�,��
�
�k�3�9�9�;�;�/�/�/��.�.�t�R�8�8���C������c�"�"�"����C�I�I�K�K��-�-�-�-�-rc�|�tD]3}dD].}|�||��}|�|d���/�4dS)N)�-tz--testr)�testtarnamesryrT�rr��optr�s    r�test_test_commandz!CommandLineTest.test_test_command 
s[��$�	+�	+�H�%�
+�
+���o�o�c�8�4�4��� � ��c�*�*�*�*�
+�	+�	+rc��tD]6}dD]1}|�|d|d���}|�d|���2�7dS)N��-vz	--verboser�r���PYTHONIOENCODINGsis a tar archive.
)r�ryr�r�s    r�test_test_command_verbosez)CommandLineTest.test_test_command_verbose&
sj��$�	;�	;�H�(�
;�
;���o�o�c�4��7>�&�@�@���
�
�4�c�:�:�:�:�
;�	;�	;rc�p�tjd��}|�d|��\}}}|�d|��|�|d��|�|d��t
D�]<}|�|���5t|d��5}|���}ddd��n#1swxYwY	ttd��5}|�
|dd	���ddd��n#1swxYwY|�dt��\}}}|�|d��|�|d��tjt��n#tjt��wxYw	ddd��n#1swxYwY��>dS)
N�
zipdir.zipr�� is not a tar archive.rrs)r�rrr�r})
rr!r|r�rTr�r�r%rSr�rrro)r�zipnamerwr�rxr�rUrs        r�test_test_command_invalid_filez.CommandLineTest.test_test_command_invalid_file-
sV���"�<�0�0���.�.�t�W�=�=���C���
�
�/��5�5�5�����c�"�"�"�����Q����$�	.�	.�H����x��0�0�

.�

.��(�D�)�)�$�Q��6�6�8�8�D�$�$�$�$�$�$�$�$�$�$�$����$�$�$�$�.��g�t�,�,�,������T�c�T�
�+�+�+�,�,�,�,�,�,�,�,�,�,�,����,�,�,�,�#'�#:�#:�4��#I�#I�L�B��S��$�$�S�#�.�.�.��$�$�R��+�+�+��$�W�-�-�-�-��I�$�W�-�-�-�-����-�

.�

.�

.�

.�

.�

.�

.�

.�

.�

.�

.����

.�

.�

.�

.��	.�	.ss�F)�"C�7F)�C�F)�
C�F)�E>�$D�E>�D�E>�D�AE>�$F)�>F�F)�)F-	�0F-	c��tD]�}tj��5}tj|d��5}|�d���ddd��n#1swxYwYddd��n#1swxYwY|����dd��}dD]0}|�||d���}|�	||���1��dS)Nr_Fr�r�r�)r�z--listr��
r�r�captured_stdoutr&r%ror�r�ryrT�rr�rr��expectedr�r�s       r�test_list_commandz!CommandLineTest.test_list_commandA
sb��$�	0�	0�H��(�*�*�
+�a��\�(�C�0�0�+�B��G�G�E�G�*�*�*�+�+�+�+�+�+�+�+�+�+�+����+�+�+�+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+��z�z�|�|�*�*�7�4F�G�G�H�%�
0�
0���o�o�c�8�7>�&�@�@��� � ��h�/�/�/�/�
0�	0�	0�4�A-�A�
A-�A�A-�A�A-�-A1	�4A1	c��tD]�}tj��5}tj|d��5}|�d���ddd��n#1swxYwYddd��n#1swxYwY|����dd��}dD]1}|�|d|d���}|�	||���2��dS)	Nr_Tr�r�r�r�r�r�r�r�s       r�test_list_command_verbosez)CommandLineTest.test_list_command_verboseL
sd��$�	0�	0�H��(�*�*�
*�a��\�(�C�0�0�*�B��G�G�D�G�)�)�)�*�*�*�*�*�*�*�*�*�*�*����*�*�*�*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*�
*����
*�
*�
*�
*��z�z�|�|�*�*�7�4F�G�G�H�(�
0�
0���o�o�c�4��7>�&�@�@��� � ��h�/�/�/�/�
0�	0�	0r�c���tjd��}|�d|��\}}}|�d|��|�|d��|�|d��dS)Nr�r�r�rrs)rr!r|r�rT�rr�rwr�rxs     r�test_list_command_invalid_filez.CommandLineTest.test_list_command_invalid_fileW
st���"�<�0�0���.�.�t�W�=�=���C���
�
�/��5�5�5�����c�"�"�"�����Q�����rc��tjdd���tjdd���g}dD]�}	|j|tg|�R�}|�|d��tjt��5}|���ddd��n#1swxYwYtj	t����#tj	t��wxYwdS)Nr~rr�r�)�-cz--creater)
rr!ryr�rTr&r%r�rro�rr�r�r�rGs     r�test_create_commandz#CommandLineTest.test_create_command^
s1���!�"6�)7�9�9�9��!�#>�)7�9�9�9�:��
$�	*�	*�C�
*�%�d�o�c�7�;�U�;�;�;��� � ��c�*�*�*��\�'�*�*�%�c��N�N�$�$�$�%�%�%�%�%�%�%�%�%�%�%����%�%�%�%�� ��)�)�)�)��	� ��)�)�)�)����	*�	*s0�AB;�5B�
B;�B	�B;�B	�B;�;Cc��tjdd���tjdd���g}dD]�}	|j|dtg|�Rddi�}|�d	|��tjt��5}|���ddd��n#1swxYwYtj	t����#tj	t��wxYwdS)
Nr~rr�r�r�r�r�r�s file created.)
rr!ryr�r�r&r%r�rror�s     r�test_create_command_verbosez+CommandLineTest.test_create_command_verbosem
sM���!�"6�)7�9�9�9��!�#>�)7�9�9�9�:��
%�	*�	*�C�
*�%�d�o�c�4��@�5�@�@�@�7>�@�@���
�
�/��5�5�5��\�'�*�*�%�c��N�N�$�$�$�%�%�%�%�%�%�%�%�%�%�%����%�%�%�%�� ��)�)�)�)��	� ��)�)�)�)����	*�	*s0�AB?�9B�B?�B	�B?�!B	�"B?�?Cc��tjdd���g}	|jdtg|�R�}|�|d��tjt��5}|���ddd��n#1swxYwYtj	t��dS#tj	t��wxYw)Nr~rr�r�r)
rr!ry�dotlessnamerTr&r%r�rro)rr�r�rGs    r�$test_create_command_dotless_filenamez4CommandLineTest.test_create_command_dotless_filename}
s����!�"6�~�N�N�N�O��	*�!�$�/�$��<�e�<�<�<�C����S�#�&�&�&���k�*�*�
!�c���� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!�
��[�)�)�)�)�)��I��[�)�)�)�)���s0�AB#�A=�1B#�=B�B#�B�B#�#B>c��tj�td��}t	jdd���g}	|jd|g|�R�}|�|d��tj	|��5}|�
��ddd��n#1swxYwYtj|��dS#tj|��wxYw)Nz.testtarr~rr�r�r)
rdrerfrcrr!ryrTr&r%r�rro)rr�r�r�rGs     r�(test_create_command_dot_started_filenamez8CommandLineTest.test_create_command_dot_started_filename�
s���7�<�<���4�4���!�"6�~�N�N�N�O��	'�!�$�/�$��9�5�9�9�9�C����S�#�&�&�&���h�'�'�
!�3���� � � �
!�
!�
!�
!�
!�
!�
!�
!�
!�
!�
!����
!�
!�
!�
!�
��X�&�&�&�&�&��I��X�&�&�&�&���s/�9B9�7B�B9�B�B9�B� B9�9Cc��tjdd���tjdd���g}tttfD]�}|js�
	tdz|jz}|jd|g|�R�}|�	|��5}|�
��ddd��n#1swxYwYtj|����#tj|��wxYwdS)Nr~rr�r�r�r�)
rr!r,r3r9r%r�rryr(r�rro)rr��filetyper�r�rGs      r�test_create_command_compressedz.CommandLineTest.test_create_command_compressed�
sC���!�"6�)7�9�9�9��!�#>�)7�9�9�9�:��
"�7�H�5�		+�		+�H��=�
��
+�"�S�=�8�?�:��%�d�o�d�H�=�u�=�=�=���%�%�h�/�/�%�3��N�N�$�$�$�%�%�%�%�%�%�%�%�%�%�%����%�%�%�%�� ��*�*�*�*��	� ��*�*�*�*����		+�		+s0�6C�B#�C�#B'	�'C�*B'	�+C�Cc�x�|�t��dD]�}	tjt��5|�|t��}ddd��n#1swxYwY|�|d��tjt���#tjt��wxYwdS)N)�-ez	--extractr�r�r�rr��	tarextdirryrTr��rr�r�s   r�test_extract_commandz$CommandLineTest.test_extract_command�
s���� � ��)�)�)�$�	,�	,�C�
,��'�	�2�2�8�8��/�/�#�w�7�7�C�8�8�8�8�8�8�8�8�8�8�8����8�8�8�8�� � ��c�*�*�*�� ��+�+�+�+��	� ��+�+�+�+����
	,�	,s.�B�A!�B�!A%	�%B�(A%	�)B�B7c�~�|�t��dD]�}	tjt��5|�|dtd���}ddd��n#1swxYwY|�d|��tjt����#tjt��wxYwdS)Nr�r�r�r�� file is extracted.)r�r�rr�r�ryr�r�r�s   r�test_extract_command_verbosez,CommandLineTest.test_extract_command_verbose�
s��� � ��)�)�)�$�	,�	,�C�
,��'�	�2�2�D�D��/�/�#�t�W�;B�*�D�D�C�D�D�D�D�D�D�D�D�D�D�D����D�D�D�D��
�
�4�c�:�:�:�� ��+�+�+�+��	� ��+�+�+�+����	,�	,s.�B�A$�B�$A(	�(B�+A(	�,B�B:c	�&�|�t��tj�t
d��}tjt
��	tj|��5|�	dtddd��|�
dtdddd���}|�d	|��ddd��n#1swxYwYtjt
��dS#tjt
��wxYw)
N�destr�r�z--filterrr{r�r�r�)
r�r�rdrerfr�r�rr�r|ryr�r�)r�destdirr�s   r�test_extract_command_filterz+CommandLineTest.test_extract_command_filter�
s>�����w�'�'�'��'�,�,�y�&�1�1��
������	(��#�G�,�,�
;�
;��'�'��g�(,�(2�F�<�<�<��o�o�d�G�&*�&0�/�7>�&�@�@���
�
�4�c�:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�
��Y�'�'�'�'�'��I��Y�'�'�'�'���s1�C5�.AC�C5�C�C5�C�C5�5Dc�p�|�t��	tjt��5|�dtd��}ddd��n#1swxYwY|�|d��tjt��dS#tjt��wxYw)Nr��spamdirrr�)rr�s  r�(test_extract_command_different_directoryz8CommandLineTest.test_extract_command_different_directory�
s���� � ��)�)�)�	(��#�I�.�.�
@�
@��o�o�d�G�Y�?�?��
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@����S�#�&�&�&���Y�'�'�'�'�'��I��Y�'�'�'�'���s.�B�A�B�A"�"B�%A"�&B�B5c�H�tjd��}tjt��5|�d|��\}}}ddd��n#1swxYwY|�d|��|�|d��|�|d��dS)Nr�r�r�rrs)rr!rr�r�r|r�rTr�s     r�!test_extract_command_invalid_filez1CommandLineTest.test_extract_command_invalid_file�
s����"�<�0�0��
�
�	�
*�
*�	B�	B��2�2�4��A�A�L�B��S�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B����	B�	B�	B�	B��
�
�/��5�5�5�����c�"�"�"�����Q�����s�A�A�AN)rr r!ryr|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r*rrrprp�	sU������7�7�7�
K�K�K�	C�	C�	C�6�6�6�.�.�.�+�+�+�;�;�;�.�.�.�(	0�	0�	0�	0�	0�	0� � � �
*�
*�
*�*�*�*� *�*�*�	'�	'�	'�+�+�+�",�,�,�	,�	,�	,�(�(�(�&(�(�(� � � � � rrpc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�ContextManagerTestc���tjt��5}|�|jd��ddd��n#1swxYwY|�|jd��dS)Nzclosed inside runtime context�context manager failed)r&r%r"r�r*r�rs  r�
test_basiczContextManagerTest.test_basic�
s���
�\�'�
"�
"�	J�c����S�Z�)H�I�I�I�	J�	J�	J�	J�	J�	J�	J�	J�	J�	J�	J����	J�	J�	J�	J�����
�$<�=�=�=�=�=s�A�A�	Ac��tjt��}|���|�t
��5|5	ddd��n#1swxYwYddd��dS#1swxYwYdSr)r&r%r"rJrr�rs  r�test_closedzContextManagerTest.test_closed�
s����l�7�#�#���	�	����
�
�
�w�
'�
'�	�	��
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s6�A1�A�
A1�A	�A1� A	�!A1�1A5�8A5c�<�|�t��5}tjt��5}t
�#1swxYwY	ddd��n#1swxYwY|�|jt
d��|�|j	d��dS)Nz)wrong exception raised in context managerr�)
r�	Exceptionr&r%r"r�r5rkr�r*)rr�rGs   r�test_exceptionz!ContextManagerTest.test_exception�
s���
�
�
�y�
)�
)�	�S���g�&�&�
�#��
�
�
�
�
����
�
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
���c�m�W�I�	K�	K�	K�����
�$<�=�=�=�=�=s,�A�=�A	�A�A	�A�A�Ac��	tjtd��5}t�#1swxYwYn#YnxYw|�t
j�t��dd��|�|j	d��dS)Nr�rz-context manager wrote an end-of-archive blockr�)
r&r%r�r�rTrdrer�r�r*rs  r�test_no_eofzContextManagerTest.test_no_eof�
s���	���g�s�+�+�
 �s���
 �
 �
 �
 ����
 �
 �
 �
 �
 ��	��D������������1�1�1�?�	A�	A�	A�����
�$<�=�=�=�=�=s�0�$�(�0�(�0�4c���tjtd��5	ddd��n#1swxYwY|�tj�t��dd��dS)Nr�rz-context manager wrote no end-of-archive block)r&r%r�rIrdrer�rs r�test_eofzContextManagerTest.test_eofs����\�'�3�
'�
'�	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����B�G�O�O�G�4�4�a�?�	A�	A�	A�	A�	As�)�-�-c�2�ttd��5}	tj|d���5}t�#1swxYwYn#YnxYw|�|jd��|�|jd��ddd��dS#1swxYwYdS)Nr�r�r3zexternal file object was closedr�)r%r�r&r�r�r*r�r8s   rr�zContextManagerTest.test_fileobj
s���'�4�
 �
 �	B�D�
��\�$�S�9�9�9�$�S�#�O�$�$�$�$����$�$�$�$�$��
���������T�[�*K�L�L�L��O�O�C�J�(@�A�A�A�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B����	B�	B�	B�	B�	B�	Bs>�B�A�6�:	�A�:	�A�B�A�;B�B�BN)	rr r!r�r�r�r�r�r�r*rrr�r��
sv������>�>�>�
���>�>�>�
>�
>�
>�A�A�A�
B�
B�
B�
B�
Brr�zrequires os.link to be missingc�H�eZdZd�Zejeejd��d��d���Z	ejeejd��d��d���Z
ejeed��d��d���Zejeed��d��d	���Zd
S)�LinkEmulationTestc�X�|j�|td���ttj�t|��d��5}|���}ddd��n#1swxYwY|�t|��t��dS)Nr{r]rr)rGrbrcr%rdrerfrSrTrrW)rr�rUrs    r�_test_link_extractionz'LinkEmulationTest._test_link_extractions��������w���?�?�?�
�"�'�,�,�w��-�-�t�
4�
4�	���6�6�8�8�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����4���.�9�9�9�9�9s�A7�7A;�>A;�islinkz3Skip emulation - has os.path.islink but not os.linkc�0�|�d��dS)Nr��r�rs r�test_hardlink_extraction1z+LinkEmulationTest.test_hardlink_extraction1$���	
�"�"�?�3�3�3�3�3rc�0�|�d��dS)Nr�r�rs r�test_hardlink_extraction2z+LinkEmulationTest.test_hardlink_extraction2)���	
�"�"�#>�?�?�?�?�?rr�z Skip emulation if symlink existsc�0�|�d��dS)Nr�r�rs r�test_symlink_extraction1z*LinkEmulationTest.test_symlink_extraction1.r�rc�0�|�d��dS)Nr�r�rs r�test_symlink_extraction2z*LinkEmulationTest.test_symlink_extraction23r�rN)
rr r!r�r�r�r�rdrer�r�r�r�r*rrr�r�s+������:�:�:��X�_�W�W�R�W�h�/�/�J�L�L�4�4�L�L�4��X�_�W�W�R�W�h�/�/�J�L�L�@�@�L�L�@��X�_�W�W�R��+�+�7�9�9�4�4�9�9�4��X�_�W�W�R��+�+�7�9�9�@�@�9�9�@�@�@rr�c� �eZdZd�Zd�Zd�ZdS)�Bz2PartialReadTestc�j��G�fd�dtj���tjt	jd�������}tt|��dz��D]?}	t	j	�|d|���|����+#tj
$rY�<wxYwdS)Nc�2���eZdZdZ��fd�Z��fd�Z�xZS)�9Bz2PartialReadTest._test_partial_input.<locals>.MyBytesIOFc����|jrtd���|���t|�����k|_t�|���|��S)Nz(infinite loop detected in tarfile.open())�hit_eof�AssertionErrorryrUr��superrS)rr��	MyBytesIO�	__class__s  ��rrSz>Bz2PartialReadTest._test_partial_input.<locals>.MyBytesIO.read@sf����<�;�(�*:�;�;�;�#�y�y�{�{�c�$�-�-�/�/�.B�.B�B����Y��-�-�2�2�1�5�5�5rc�B��d|_t�|��j|�Sr�)r�r�rx)rrvr�r�s  ��rrxz>Bz2PartialReadTest._test_partial_input.<locals>.MyBytesIO.seekFs$���$���2�u�Y��-�-�2�D�9�9r)rr r!r�rSrx�
__classcell__)r�r�s@�rr�r�>sa���������G�
6�
6�
6�
6�
6�
6�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:rr�rrsr3)r#r�r4�compressr&rr�rangerUr%r)rrrr_r�s    @r�_test_partial_inputz&Bz2PartialReadTest._test_partial_input=s����
	:�
	:�
	:�
	:�
	:�
	:�
	:��
�
	:�
	:�
	:��|�G�O�E�2�2�8�8�:�:�;�;���s�4�y�y�1�}�%�%�	�	�A�
���Y�Y�t�B�Q�B�x�%8�%8�t�D�D�D�D�D���$�
�
�
���
����	�	s�6'B�B0�/B0c�0�|�d��dS�Nr_�r�rs r�test_partial_inputz%Bz2PartialReadTest.test_partial_inputQs��� � ��%�%�%�%�%rc�0�|�d��dS)Nrtr�rs r�test_partial_input_bz2z)Bz2PartialReadTest.test_partial_input_bz2Ts��� � ��)�)�)�)�)rN)rr r!r�r�rr*rrr�r�9sA���������(&�&�&�*�*�*�*�*rr�c��	ddl}ddl}n#t$rYdSwxYw|�d��ddkrdS|�d��ddkrdSdS)NrF�rootT)r=r<�ImportError�getpwuid�getgrgid)r=r<s  r�root_is_uid_gid_0rXs������������������u�u�����
�|�|�A���q��V�#�#��u�
�|�|�A���q��V�#�#��u��4s��
��chownzmissing os.chown�geteuidzmissing os.geteuidc� �eZdZed���Zeed�����Zej�	d��ej�	d��ej�	d��d�������Z
ej�	d��ej�	d��ej�	d��d�������Zeje
��d��ej�	d��ej�	d��ej�	d��d	���������Zej�	d��d
���ZdS)�NumericOwnerTestc��tjd��}|ddtj|f|ddtjdf|ddtj|fg}tjtd��5}|D]U\}}}}	}
tj|��}||_||_	d	|_
d	|_|	|_|�
||
���V	ddd��n#1swxYwYtS)
Nscontent�c�b�M�L�X�Wr�r)r#r�r&r=r[r%r�rr�r�rerrZr)�
filename_1�	dirname_1�
filename_2rZr�tarflr�r�r��typ�contentsrs            r�_make_test_archivez#NumericOwnerTest._make_test_archivems!���z�*�%�%���b�"�g�o�t�<��b�"�g�o�t�<��b�"�g�o�t�<����\�'�3�
'�
'�	+�5�16�
+�
+�-��c�3��X��O�D�)�)�������� ��� �������
�
�a��*�*�*�*�
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+��s�!AC�C�Cc#�
K�d|_d}d}|}|}tj�||��}t�|||��}t
j|��5}||||fV�ddd��dS#1swxYwYdS)Nrznumeric-owner-testfiler�)r�rdrerfrrr&r%)�mock_geteuidrlrhrrr�tar_filenamers        r�_setup_testzNumericOwnerTest._setup_test�s�����%&��!�(�����
��	��W�\�\�'�5�1�1�
�(�:�:�:�;D�;E�G�G���\�,�
'�
'�	;�5���Y�
�:�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s�"	A8�8A<�?A<zos.chownzos.chmodz
os.geteuidc�$�|�|��5\}}}}|�|tdd���|�|tdd���ddd��n#1swxYwYtj�t|��}tj�t|��}	|�tj�	|dd��tj�	|	dd��gd���dS)	NTr{��
numeric_ownerr^r
rrr��	any_order)
rrbrcrdrerf�assert_has_callsr�r��call)
rr�
mock_chmod�
mock_chownrr�_r�f_filename_1�f_filename_2s
          r�test_extract_with_numeric_ownerz0NumericOwnerTest.test_extract_with_numeric_owner�sH��
�
�
�l�
+�
+�	2�0<��z�1�0:��M�M�*�g�T�!0�
�
2�
2�
2��M�M�*�w�d�!0�
�
2�
2�
2�		2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2��w�|�|�G�Z�8�8���w�|�|�G�Z�8�8���#�#�X�]�%7�%7��b�"�%M�%M�%-�]�%7�%7��b�"�%M�%M�%'�/3�	$�	4�	4�	4�	4�	4s�AA$�$A(�+A(c	�p�|�|��5\}}}}|�tdd���ddd��n#1swxYwYtj�t|��}tj�t|��}	tj�t|��}
|�tj�	|dd��tj�	|	dd��tj�	|
dd	��gd�
��dS)NTr{rr
rrrrrr!)
rrsrcrdrerfr#r�r�r$)rrr%r&rrrrr(�f_dirname_1r)s           r�"test_extractall_with_numeric_ownerz3NumericOwnerTest.test_extractall_with_numeric_owner�sP��
�
�
�l�
+�
+�	5�0<��z�9�0:����W�D�$3�
�
5�
5�
5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5��w�|�|�G�Z�8�8���w�|�|�G�Y�7�7���w�|�|�G�Z�8�8���#�#�X�]�%7�%7��b�"�%M�%M�%-�]�%7�%7��R��%L�%L�%-�]�%7�%7��b�"�%M�%M�%'�/3�		$�	4�	4�	4�	4�	4s�#A�A	�A	z uid=0,gid=0 must be named "root"c��|�|��5\}}}}|�|tdd���ddd��n#1swxYwYtj�t|��}|�|dd��dS)NFr{rr)rrbrcrdrerf�assert_called_with)rrr%r&rrr'r(s        r�"test_extract_without_numeric_ownerz3NumericOwnerTest.test_extract_without_numeric_owner�s����
�
�l�
+�
+�	2�/H��z�1�a��M�M�*�g�U�!0�
�
2�
2�
2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�
�w�|�|�G�Z�8�8���%�%�l�A�q�9�9�9�9�9s�$A�A
�
A
c	��|�|��5\}}}}|�t|j|tdd��ddd��dS#1swxYwYdS)NFT)rrr�rbrc)rrrrr's     r�test_keyword_onlyz"NumericOwnerTest.test_keyword_only�s���
�
�
�l�
+�
+�	O�/H��z�1�a����i�#�m�Z��%��
O�
O�
O�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O����	O�	O�	O�	O�	O�	Os�/A�A�AN)rr r!rrrrrr�r�r�r*r-r�rr0r2r*rrrrds�����������\��.��;�;��^��\�;�(�]����$�$�
�]����$�$�
�]����&�&�4�4�'�&�%�$�%�$�4�$�]����$�$�
�]����$�$�
�]����&�&�4�4�'�&�%�$�%�$�4�,�X��*�*�,�,�;�=�=�
�]����$�$�
�]����$�$�
�]����&�&�	:�	:�'�&�%�$�%�$�=�=�
	:��]����&�&�O�O�'�&�O�O�Orrc�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�ReplaceTestsc�8�|j�d��}|�d���}|�|jd��|�|jd��|�|j�d��jd��dS)NrOz
misc/otherr:)rGrQr�rTr��rr�replaceds   r�test_replace_namezReplaceTests.test_replace_name�s�����#�#�O�4�4���>�>�|�>�4�4��������5�5�5������o�6�6�6������+�+�O�<�<�A�(�	*�	*�	*�	*�	*rc�*�|j�d��}|���}d|jd<|�|jdd��|�|j�d��jdd��dS)Nrw�not-barrr��rGrQr�rxrTr6s   r�test_replace_deepzReplaceTests.test_replace_deep�s�����#�#�N�3�3���>�>�#�#��(1���W�%�����+�G�4�e�<�<�<�����H���~�.�.�:�7�C�U�	L�	L�	L�	L�	Lrc�.�|j�d��}|�d���}d|jd<|�|jdd��|�|j�d��jdd��dS)NrwF)�deepr:rr;r6s   r�test_replace_shallowz!ReplaceTests.test_replace_shallow�s�����#�#�N�3�3���>�>�u�>�-�-��(1���W�%�����+�G�4�i�@�@�@�����H���~�.�.�:�7�C�Y�	P�	P�	P�	P�	Prc�N�|j�d��}dD]�}|�|���5|jdi|di��}|�t||��d��|�t||��d��ddd��n#1swxYwY��dS)NrO)r�rcrrr�r�rer��	attr_namer*)rGrQr�r�rTr;rI)rrrBr7s    r�test_replace_allzReplaceTests.test_replace_all�s
����#�#�O�4�4��:�	F�	F�I����	��2�2�
F�
F�)�6�>�>�>�Y��,=�>�>��� � ���9�!=�!=�t�D�D�D��#�#�G�F�I�$>�$>��E�E�E�
F�
F�
F�
F�
F�
F�
F�
F�
F�
F�
F����
F�
F�
F�
F��	F�	Fs�AB�B	� B	c���|j�d��}|�t��5|�d���ddd��dS#1swxYwYdS)NrOi�[)rT)rGrQrr�r�)rrs  r�test_replace_internalz"ReplaceTests.test_replace_internals�����#�#�O�4�4��
�
�
�y�
)�
)�	-�	-��N�N�)�N�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�A�A� AN)rr r!r8r<r?rCrEr*rrr4r4�sh������*�*�*�L�L�L�P�P�P�F�F�F�-�-�-�-�-rr4c��eZdZdZed���Zed���Zd�Zed���Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�ZdS)
�NoneInfoExtractTestsNc���tjtdd���}tjt
��dz�_d|_|��j�j	���|�
��t�fd�tj�j���d��D�����_
dS)	Nr_rCrD�extractall_ctrlrr]c3�L�K�|]}|��j��V��dSr)�relative_to�control_dir)rx�prOs  �r�	<genexpr>z2NoneInfoExtractTests.setUpClass.<locals>.<genexpr>sM����� A� A��
�M�M�#�/�*�*� A� A� A� A� A� Ar�**/*)r&r%r"r�r�rcrLrmrs�extraction_filterrJ�set�glob�
control_paths)rOrGs` rrPzNoneInfoExtractTests.setUpClasss�����l�7��{�C�C�C��!�,�w�/�/�2C�C���������s��s�/D��E�E�E��	�	����� A� A� A� A��\�#�/�2�2�7�7��?�?� A� A� A�A�A����rc�8�tj|j��dSr)�shutilr�rLrRs rrSz"NoneInfoExtractTests.tearDownClasss���
�c�o�&�&�&�&�&rc���t�fd�tj����d��D����}|�|j|��dS)Nc3�B�K�|]}|����V��dSr)rK)rxrMr�s  �rrNz;NoneInfoExtractTests.check_files_present.<locals>.<genexpr>!sC�����;�;��
�M�M�)�$�$�;�;�;�;�;�;rrO)rQr�r�rRrTrS)rr��	got_pathss ` r�check_files_presentz(NoneInfoExtractTests.check_files_present sq����;�;�;�;��\�)�,�,�1�1�&�9�9�;�;�;�;�;�	�	
����+�Y�7�7�7�7�7rc'�K�tjt��dz}d|j_|j���D]}|D]}t
||d����tj|��5|j�	|d���|�
|��|V�ddd��dS#1swxYwYdS)N�extractall_nonerr{r])r�r�rcrGrmr��setattrrr�rsrY)r�
attr_namesr�rrBs     r�extract_with_nonez&NoneInfoExtractTests.extract_with_none&s�����l�7�#�#�&7�7�������h�)�)�+�+�	1�	1�F�'�
1�
1�	���	�4�0�0�0�0�
1�
�
��
$�
$�	�	��H����O��<�<�<��$�$�S�)�)�)��I�I�I�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�16B4�4B8�;B8c�N�tjt�����j}|�d��5}tj|���d��D]�}|�|���5	|���j}|�|���j|��n%#t$r|�
��s�YnwxYwddd��n#1swxYwY��	ddd��dS#1swxYwYdS)NrcrO�re)r�r�rcr��st_mtimer^rRr��assertGreaterEqualr��
is_symlink)r�nowr�rercs     r�test_extractall_none_mtimez/NoneInfoExtractTests.test_extractall_none_mtime2s����l�7�#�#�(�(�*�*�3��
�
#�
#�G�
,�
,�
	K����S�)�)�.�.�v�6�6�	
K�	
K���\�\�t�\�,�,�K�K�K� $�	�	��� 4���/�/��	�	���0D�c�J�J�J�J��#�"�"�"�#���0�0�"�!�"�"�"����K�K�K�K�K�K�K�K�K�K�K����K�K�K�K��	
K�
	K�
	K�
	K�
	K�
	K�
	K�
	K�
	K�
	K�
	K�
	K�
	K����
	K�
	K�
	K�
	K�
	K�
	Ks[�AD�D�C�!.D�C1	�.D�0C1	�1D�4D�D�D�D�D�D�!Dc��tjt�����j}tjt��dz}|�d��|���j}|�d��5}tj|���d��D]�}|�|���5|�	��r.|�
|���j|��nA|���r-|�
|���j|��ddd��n#1swxYwY��	ddd��dS#1swxYwYdS)N�regular_filerrrOr`)r�r�rcr�r��
write_textr^rRr��is_dirrT�is_file)r�dir_moderg�regular_file_moder�res      r�test_extractall_none_modez.NoneInfoExtractTests.test_extractall_none_modeBs����<��(�(�-�-�/�/�7���|�G�,�,�~�=������#�#�#�(�-�-�/�/�7��
�
#�
#�F�
+�
+�	<�s���S�)�)�.�.�v�6�6�
<�
<���\�\�t�\�,�,�<�<��{�{�}�}�<��(�(������)<�h�G�G�G�G������<��(�(������)<�):�<�<�<�	<�<�<�<�<�<�<�<�<�<�<����<�<�<�<��
<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�	<�	<s8�AE:�BE �E:� E$�$E:�'E$�(E:�:E>�E>c�d�|�d��5	ddd��dS#1swxYwYdS)Nr��r^rs r�test_extractall_none_uidz-NoneInfoExtractTests.test_extractall_none_uidR�}��
�
#�
#�E�
*�
*�	�	��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��%�)�)c�d�|�d��5	ddd��dS#1swxYwYdS)Nr�rors r�test_extractall_none_gidz-NoneInfoExtractTests.test_extractall_none_gidVrqrrc�d�|�d��5	ddd��dS#1swxYwYdS)Nrerors r�test_extractall_none_unamez/NoneInfoExtractTests.test_extractall_none_unameZ�}��
�
#�
#�G�
,�
,�	�	��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	rrc�d�|�d��5	ddd��dS#1swxYwYdS)Nrrors r�test_extractall_none_gnamez/NoneInfoExtractTests.test_extractall_none_gname^rwrrc�j�|�dddd��5	ddd��dS#1swxYwYdS)Nr�r�rerrors r�test_extractall_none_ownershipz3NoneInfoExtractTests.test_extractall_none_ownershipbs���
�
#�
#�E�5�'�7�
C�
C�	�	��	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�(�,�,)rr r!rPrgrPrSrYrr^rermrprtrvryr{r*rrrGrGs����������A�A��[�A��'�'��[�'�8�8�8��	�	��^�	�K�K�K� <�<�<� ����������������rrGc��eZdZdZdS)�NoneInfoExtractTests_DatarN�rr r!rPr*rrr}r}fs���������rr}c��eZdZdZdS)�!NoneInfoExtractTests_FullyTrustedr{Nr~r*rrr�r�is������'���rr�c��eZdZdZdS)�NoneInfoExtractTests_TarrGNr~r*rrr�r�ms���������rr�c��eZdZdZdS)�NoneInfoExtractTests_DefaultNr~r*rrr�r�ps���������rr�c��eZdZd�Zd�ZdS)�NoneInfoTests_Miscc
���tj��}tjtjtjfD�]&}|�|���5tj|d|���}|�t��}	|�
|��dD]�}|�|���5|jdi|di��}|�t|���5|�
|��ddd��n#1swxYwYddd��n#1swxYwY��n"#t$r|tjkrn�YnwxYwddd��n#1swxYwY��(dS)N)�	tarformatr�)r4rr�)rcrr�r�rerrAr*)r#r�r&r�rqr�r�r%r�r"rr�rrPr�)r�bior�rGrYrBr7s       r�test_addzNoneInfoTests_Misc.test_addus=���j�l�l��!�.��0B�!�,�.�	6�	6�I����	��2�2�
6�
6��l�3�S��K�K�K���.�.��1�1��6��K�K��(�(�(�&6�6�6�	�!�\�\�I�\�>�>�6�6�'6�w��'K�'K�)�T�9J�'K�'K�H�!%�!7�!7�
�;D��"H�"H�6�6� #���H� 5� 5� 5�6�6�6�6�6�6�6�6�6�6�6����6�6�6�6�6�6�6�6�6�6�6�6�6�6�6����6�6�6�6��6��!���� �G�$8�8�8�����	����
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6����
6�
6�
6�
6��	6�	6s~�2E�D$�E�2,D	�D�4D	�D�D	�D�D	�E�D
�E�D
�E�$E�E�E�E�E	�E	c
�4�dhdhdhdhdhdhddhddhfD�]�}|�|���5tjtd�	��5}t	jt	j��d
d���}tjtd
|��5|�
��ddd��n#1swxYwY|���D]}|D]}t||d����t	jt	j��d
d���}tjtd
|��5|�
��ddd��n#1swxYwYt|���������|�����������D�]�\}}|dhkr,t#jd|��r|�|d���9|dhkr,t#jd|��r|�|d���l|dhkr,t#jd|��r|�|d����|dhkrs|�d��r^|�d��\}	}
|�d��\}}|�||
��|�|d����|dhkrs|�d��r^|�d��\}	}
|�d��\}}|�||	��|�|d�����|dhkrs|�d��r^|�d��\}	}
|�d��\}}|�||
��|�|d����
|dhkrs|�d��r^|�d��\}	}
|�d��\}}|�||	��|�|d�����|ddhkrs|�d��r^|�d��\}	}
|�d��\}}|�||
��|�|d����|ddhkrs|�d��r^|�d��\}	}
|�d��\}}|�||	��|�|d����}|�||�����	ddd��n#1swxYwYddd��n#1swxYwY���dS)Nrcrr�r�rer)r]rCrrr�r�r�r�s2003-01-\d\ds
????-??-??s\d\d:\d\d:\d\ds??:??:??s.([r-][w-][x-]){3}s
??????????)�tarfile/�lars/�foo/�/s[0-9]+)�/tarfile�/users�/bar�1000/sNone�/100)r�r�r�r�)r�r�r�r�)r�r&r%r"r#rhr�rr�r�ror�r\r�r�r�r��re�matchrTrdr��endswith)
rr]rG�tio_prevrrB�tio_newr��got�exp_user�	exp_group�got_user�	got_groups
             rr�zNoneInfoTests_Misc.test_list�s���
$�9�v�h���%��#�9�w�i�!�7�+�e�W�-=�?�<	8�<	8�J��,�,�*�,�5�5�9
8�9
8��,�w��=�=�=�9
8�AD��+�B�J�L�L�'�4�P�P�P���&�s�H�h�?�?����H�H�J�J�J�������������������!�n�n�.�.�9�9�F�%/�9�9�	���	�4�8�8�8�8�9��*�2�:�<�<��$�O�O�O���&�s�H�g�>�>����H�H�J�J�J�������������������%(����):�):�)C�)C�)E�)E�)K�)K�)M�)M�)0���)9�)9�)B�)B�)D�)D�)J�)J�)L�)L�&N�&N�.8�.8�M�H�c�!�g�Y�.�.�2�8�<L�h�3W�3W�.��(�(��m�<�<�<�<�#��y�0�0�R�X�>P�RZ�5[�5[�0��(�(��k�:�:�:�:�#��x�/�/�B�H�2�H�5>�5>�/��(�(��m�<�<�<�<�#��y�0�0�X�5H�5H�<�6>�6>�0�.6�n�n�T�.B�.B�+��)�.1�i�i��o�o�+��)��(�(��I�>�>�>��(�(��9�=�=�=�=�#��y�0�0�X�5F�5F�=�6?�6?�0�.6�n�n�T�.B�.B�+��)�.1�i�i��o�o�+��)��(�(��8�<�<�<��(�(��I�>�>�>�>�#��w�.�.�8�3F�3F�%�4(�4(�.�.6�n�n�T�.B�.B�+��)�.1�i�i��o�o�+��)��(�(��I�>�>�>��(�(��7�;�;�;�;�#��w�.�.�8�3D�3D�g�3O�3O�.�.6�n�n�T�.B�.B�+��)�.1�i�i��o�o�+��)��(�(��8�<�<�<��(�(��G�<�<�<�<�#��w�'7�7�7�H�<O�<O�F�=H�=H�7�.6�n�n�T�.B�.B�+��)�.1�i�i��o�o�+��)��(�(��I�>�>�>��(�(��7�;�;�;�;�#���'7�7�7�H�<M�<M�F�=H�=H�7�.6�n�n�T�.B�.B�+��)�.1�i�i��o�o�+��)��(�(��8�<�<�<��(�(��G�<�<�<�<��(�(��3�7�7�7�7�].8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8����9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8�9
8����9
8�9
8�9
8�9
8��<	8�<	8s��V�
AU4�B/	�#U4�/B3
�3U4�6B3
�7A3U4�*E	�?U4�E
�U4�E
�PU4�(V�4U8�8V�;U8�<V�V	�V	N)rr r!r�r�r*rrr�r�ts7������6�6�6�4A8�A8�A8�A8�A8rr�c���|dd�}tjdd�|dtjdd�|dztjdtjtjztjd�|dztjdd�|dztjdd�|d	ztjdtjtjztjd�|d
ztj	dd�|dztj
dd�|dztjdtjtjztjd
�|dz}|S)z�Inverse of `stat.filemode` (for permission bits)

    Using mode strings rather than numbers makes the later tests more readable.
    rsNr)r_�-)r�r�)r_r�r|�Srvr��r8�)r_r�r�Tr!)
r��S_IRUSR�S_IWUSR�S_IXUSR�S_ISUID�S_IRGRP�S_IWGRP�S_IXGRP�S_ISGID�S_IROTH�S_IWOTH�S_IXOTH�S_ISVTX)r�str_mode�results   r�_filemode_to_intr��s_��
�A�B�B�x�H���1�
%�
%�h�q�k�
2���1�
%�
%�h�q�k�
2�3���1���t�|�+�����&�q�k�+�+�
��1�
%�
%�h�q�k�
2�3���1�
%�
%�h�q�k�
2�
3���1���t�|�+�����&�q�k�+�	+���1�
%�
%�h�q�k�
2�
3���1�
%�
%�h�q�k�
2�3���1���t�|�+�����&�q�k�+�+��(�Mrc�>�eZdZdZd�Zd�Zd�Zdddddd�d�Zd�ZdS)	�ArchiveMakerz�Helper 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�6�tj��|_dSr)r#r�r�rs rr�zArchiveMaker.__init__�s���:�<�<����rc�F�tjd|j���|_|S)Nr�rS)r&r'r��tar_wrs r�	__enter__zArchiveMaker.__enter__�s���_�#�t�x�@�@�@��
��rc��|j���|j���|_d|_dSr)r�rJr�r�r)rr�s  r�__exit__zArchiveMaker.__exit__
s6���
��������)�)�+�+��
�����rN)rZ�
symlink_to�hardlink_torrVc�0�t|��}tj|��jdi|��}|�||_|rt|��|_|� tj}t|��|_|� tj	}t|��|_|�
d��r|�tj}|�||_|�
��r'tjt!|j����}	nd}	|j�||	��dS)z5Add a member to the test archive. Call within `with`.Nr�r*)r6r&rr�rVr�rr@rrr�r[rZr�r#r�rHr�r)
rr�rZr�r�rrVrrYr4s
          rr�zArchiveMaker.add
s���4�y�y��/�'�/�$�'�'�/�9�9�&�9�9�����G�L��	2�+�D�1�1�G�L��!��?�D�"�:���G���"��?�D�"�;�/�/�G���=�=����	#�$�,��?�D����G�L��=�=�?�?�	��j��w�|�!4�!4�5�5�G�G��G��
���7�G�,�,�,�,�,rc�Z�tj|j��}tjdd|i|��S)z9Open the resulting archive as TarFile. Call after `with`.r4r*)r#r�rr&r%)rrr�s   rr%zArchiveMaker.open
s.���j���'�'���|�2�2�C�2�6�2�2�2r)	rr r!r�r�r�r�r�r%r*rrr�r��s�������	�	� � � �������
!%��4��D�-�-�-�-�-�23�3�3�3�3rr�c�<�tjd��|��S)NzWASI: Skip symlink test for now)r��skip�rUs r�symlink_testr�)
s��?�x�}�>�?�?��B�B�Brc��|Srr*r�s rr�r�,
s���rc�n�eZdZeje��dzZedzZed���Z			d!d�Z
d"d�Zd�Zd	�Z
ed
���Zed���Zed���Zd
�Zed���Zed���Zed���Zed���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d �Z%dS)#�TestExtractionFilters�outerdirr�c#�K�tj|j��5	|�|j|���d|_t
|j�d����|_|j�	|j��n1#t$r$}||_t
��|_Yd}~nd}~wwxYw	dV�|���n#|���wxYw|jr|j�|�|jt
����ddd��dS#1swxYwYdS)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.
        r]NrO)
rr�r�rsr��raised_exceptionrQrR�expected_paths�discardr�rJrT)rrGr^r�s    r�
check_contextz#TestExtractionFilters.check_context:
s������
��
�
.�
.�	9�	9�
:����t�|�F��;�;�;�
)-��%�&)�$�-�*<�*<�V�*D�*D�&E�&E��#��#�+�+�D�L�9�9�9�9��
�
,�
,�
,�(+��%�&)�e�e��#�#�#�#�#�#�����
,����
������	�	�������	�	���������$�
,��+�+����T�0�#�%�%�8�8�8�!	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�	9�	9sR�D3�B
�AD3�
B;�B6�1D3�6B;�;D3�?C�D3�C.�.8D3�3D7�:D7Nc�8�|jr|j�tjtj�|j|z����}|�||j��|j�	|��|�vtj��rctjdkrStjtj|�
��j����}|�||��|�6t%|t&��r!|�d��rt*j}|�_|j|z���}tj|��}||kr(|�|�|����n�|t*jks|�(|�|�����n|t*jkr(|�|�����nG|t*jkr(|�|�����nt?|���|�-|�|�
��j |��|j!D]}	|j�"|	���dS)z'Check a single file. See check_context.N�ntr�)#r�r�r�rdre�normpathr�r�r��remover�	can_chmodr�r�rF�S_IMODEr�rTrr6r�r&r[�readlinkr��samefiler=rjrirE�is_fifo�NotImplementedErrorra�parentsr�)
rr�rZr�rrVrer�r��parents
          r�expect_filez!TestExtractionFilters.expect_fileW
s2��� �	(��'�'��|�B�G�,�,�T�\�D�-@�A�A�B�B���
�
�d�D�/�0�0�0���"�"�4�(�(�(���	� 3� 5� 5��"�'�T�/�/��-���T�Y�Y�[�[�-@� A� A�B�B�C����S�$�'�'�'��<�J�t�S�1�1�<�d�m�m�C�6H�6H�<��?�D��!��<�$�&�0�0�2�2�C��|�J�/�/�H��3���������X� 6� 6�7�7�7��
�W�_�
$�
$����O�O�D�L�L�N�N�+�+�+�+�
�W�_�
$�
$��O�O�D�K�K�M�M�*�*�*�*�
�W�%�
%�
%��O�O�D�L�L�N�N�+�+�+�+�%�d�+�+�+������T�Y�Y�[�[�0�$�7�7�7��l�	0�	0�F���'�'��/�/�/�/�	0�	0rr�c��|�||��5|j�|j�	ddd��n#1swxYwYd|_dSr)rr�)r�exc_type�
message_res   r�expect_exceptionz&TestExtractionFilters.expect_exceptionz
s���
�
#�
#�H�j�
9�
9�	,�	,��$�0��+�+�1�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�!%����s�3�7�7c�0�t��5}|�d��ddd��n#1swxYwYdD]W}|�|���|��5|�d��ddd��n#1swxYwY�XdS)Nz
benign.txt)r{rGr�r�r�r�r%r��r�arcr^s   r�test_benign_filez&TestExtractionFilters.test_benign_file�
s��
�^�^�	"�s��G�G�L�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�4�	/�	/�F��#�#�C�H�H�J�J��7�7�
/�
/�� � ��.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/��	/�	/s�1�5�5�(B
�
B	�B	c���t��5}|�|jdz��ddd��n#1swxYwY|�|���d��5|�d��ddd��n#1swxYwYdD]�}|�|���|��5t
|j���d��r@t
|j���d��}|�|�d���n |�	tjd��ddd��n#1swxYwY��dS)Nzescaped.evilr{z../escaped.evil�rGrr�z
/escaped.evilz+['"].*escaped.evil['"] has an absolute path)r�r�r�r�r%r�r6rd�lstripr�r&r\)rr�r^�outerdir_strippeds    r�
test_absolutez#TestExtractionFilters.test_absolute�
s/���^�^�	4�s��G�G�D�M�N�2�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4��
�
����
�
�O�
<�
<�	0�	0����.�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�$�	K�	K�F��#�#�C�H�H�J�J��7�7�

K�

K��t�}�%�%�0�0��5�5�K�),�D�M�(:�(:�(A�(A�#�(F�(F�%��$�$�(9�%H�%H�%H�I�I�I�I��)�)��1�I�K�K�K�

K�

K�

K�

K�

K�

K�

K�

K�

K�

K�

K����

K�

K�

K�

K��	K�	Ks2�9�=�=�,B�B�B�BE�E	� E	c���t��5}|�dd���|�dd���|�d��ddd��n#1swxYwYtj���rv|�|���d��5|j�(|�t��	ddd��dS|�	dd���|�	dd���|�	d��	ddd��n#1swxYwY|�|���d	��5|�tjd
��ddd��n#1swxYwY|�|���d��5|�tjd��ddd��dS#1swxYwYdS|�|���d��5|�	d��ddd��n#1swxYwY|�|���d	��5|�	d��ddd��n#1swxYwY|�|���d��5|�	d��ddd��dS#1swxYwYdS)
N�currentr��r�r�z
current/..�parent/evilr{r�rG�T'parent/evil' would be extracted to ['"].*evil['"], which is outside the destinationrzK'parent' would link to ['"].*outerdir['"], which is outside the destination)
r�r�r�can_symlinkr�r%r�r�r[r�r&rbrc�rr�s  r�test_parent_symlinkz)TestExtractionFilters.test_parent_symlink�
s����^�^�
	#�s�

�G�G�I�#�G�.�.�.�
�G�G�H��G�6�6�6��G�G�M�"�"�"�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#����
	#�
	#�
	#�
	#�� �"�"�!	0��#�#�C�H�H�J�J��@�@�
0�
0��(�4��)�)�/�:�:�:��
0�
0�
0�
0�
0�
0�
0�
0��$�$�Y�3�$�?�?�?��$�$�X�,�$�G�G�G��$�$�Y�/�/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0��#�#�C�H�H�J�J��6�6�
:�
:��%�%��3�9�:�:�:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:����
:�
:�
:�
:��#�#�C�H�H�J�J��7�7�
:�
:��%�%��7�9�:�:�:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:�
:����
:�
:�
:�
:�
:�
:��#�#�C�H�H�J�J��@�@�
0�
0�� � ��/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0��#�#�C�H�H�J�J��6�6�
0�
0�� � ��/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0��#�#�C�H�H�J�J��7�7�
0�
0�� � ��/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0�
0�
0s��AA�A#�&A#�&#D&�AD&�&D*�-D*�!F�F
�
F
�9!G'�'G+�.G+�H>�>I�I�1J�J�J�K)�)K-�0K-c���tj���rEtj�t
d��}tj|��tjdtj�|d����ttj�|ddd��d��5	ddd��n#1swxYwYtj�	tj�|d����rd}nPtj�	tj�|dd����rd}ntd	���t��5}|�dd�
��|�dd�
��|�d��ddd��n#1swxYwY|�
|���d
��5tj��rD|�dd�
��|�dd�
��|�d��n*|�d��|�d��ddd��n#1swxYwY|�
|���d��5tj��r!|�t jd��n*|�d��|�d��ddd��n#1swxYwY|�
|���d��5tj��rD|r!|�t jd��nK|�t jd��n*|�d��|�d��ddd��dS#1swxYwYdS)N�resolution_testr�r�r�r+r�TFz#Could not determine link resolutionr�zcurrent/parentr�r{r�r�zcurrent/rGr�rzS'current/parent' would link to ['"].*outerdir['"], which is outside the destination)rr�rdrerfrcr�r�r%r�r�r�r�r�r�r�r&rbrc)r�testpath�dotdot_resolves_earlyr�s    r�test_parent_symlink2z*TestExtractionFilters.test_parent_symlink2�
s���� �"�"�	L��w�|�|�G�->�?�?�H��H�X����
�J�s�B�G�L�L��9�=�=�>�>�>��b�g�l�l�8�Y��f�E�E�s�K�K�
�
��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��w�~�~�b�g�l�l�8�V�<�<�=�=�	
L�)-�%�%���������X�t�V� D� D�E�E�
L�).�%�%�$�%J�K�K�K�
�^�^�
	#�s�
�G�G�I�#�G�.�.�.�
�G�G�$��G�6�6�6��G�G�M�"�"�"�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#�
	#����
	#�
	#�
	#�
	#��
�
����
�
�O�
<�
<�	0�	0��$�&�&�
0�� � ��s� �;�;�;�� � ��d� �;�;�;�� � ��+�+�+�+�� � ��,�,�,�� � ��/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0��
�
����
�
�E�
2�
2�
	0�
	0��$�&�&�	
0��%�%��7�,�-�-�-�-�� � ��,�,�,�� � ��/�/�/�
	0�
	0�
	0�
	0�
	0�
	0�
	0�
	0�
	0�
	0�
	0����
	0�
	0�
	0�
	0��
�
����
�
�F�
3�
3�	0�	0��$�&�&�
0�(�
1��)�)�#�;�0�1�1�1�1��)�)�#�?�0�1�1�1�1�� � ��,�,�,�� � ��/�/�/�%	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s^�1B?�?C�C�(AF8�8F<�?F<�+BI9�9I=�I=�,AL�L�L�
BO�O� Oc��t��5}|�d|j���|�d��ddd��n#1swxYwY|�|���d��5tj��r2|�d|j���|�d��n|�d��ddd��n#1swxYwY|�|���d��5tj��r!|�tj
d��n|�d��ddd��n#1swxYwY|�|���d��5|�tjd	��ddd��dS#1swxYwYdS)
Nr�r�r�r{r�rGr�r�&'parent' is a link to an absolute path)r�r�r�r�r%rr�r�r�r&rbr[r�s  r�test_absolute_symlinkz+TestExtractionFilters.test_absolute_symlink*s����^�^�	#�s��G�G�H���G�7�7�7��G�G�M�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#��
�
����
�
�O�
<�
<�	0�	0��$�&�&�
0�� � ��d�m� �D�D�D�� � ��+�+�+�+�� � ��/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0��
�
����
�
�E�
2�
2�	0�	0��$�&�&�
0��%�%��7�,�-�-�-�-�� � ��/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0��
�
����
�
�F�
3�
3�	:�	:��!�!��)�8�
:�
:�
:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:�	:�	:sI�2A
�
A�A�AC'�'C+�.C+�A
E0�0E4�7E4�#!G�G�Gc��t��5}|�d|jdz���ddd��n#1swxYwY|�|���d��5|�td��ddd��n#1swxYwY|�|���d��5|�td��ddd��n#1swxYwY|�|���d��5|�tjd��ddd��dS#1swxYwYdS)	Nr�r�r�r{z.*foo. not foundrGrr�)	r�r�r�r�r%r�r_r&r[r�s  r�test_absolute_hardlinkz,TestExtractionFilters.test_absolute_hardlinkHsl���^�^�	A�s��G�G�H�$�-�%�*?�G�@�@�@�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A��
�
����
�
�O�
<�
<�	@�	@��!�!�(�,>�?�?�?�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@����	@�	@�	@�	@��
�
����
�
�E�
2�
2�	@�	@��!�!�(�,>�?�?�?�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@�	@����	@�	@�	@�	@��
�
����
�
�F�
3�
3�	:�	:��!�!��)�8�
:�
:�
:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:�	:�	:sC� ;�?�?�.B�B�B�	C1�1C5�8C5�$!E�E�Ec��t��5}|�dd���ddd��n#1swxYwY	|�|���d���5t	j��rMt
|jt��r|�	t��n|�
dd���n	ddd��n#1swxYwYn#t$rYnwxYwdD]b}|�|���|��5|�	tjd��ddd��n#1swxYwY�cdS)N�../mooz..//tmp/moor�r{r]r�zH'../moo' would be extracted to '.*moo', which is outside the destination)
r�r�r�r%rr�rr�r[r�r�r&rbr�s   r�test_sly_relative0z(TestExtractionFilters.test_sly_relative0Ys'���^�^�	8�s��G�G�H��G�7�7�7�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�	��#�#�C�H�H�J�J��#�G�G�
�
��(�*�*��!�$�"7��I�I�
M��-�-�o�>�>�>�>��(�(��m�(�L�L�L�L��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��� �	�	�	��D�	����$�	-�	-�F��#�#�C�H�H�J�J��7�7�
-�
-��%�%��7�,�-�-�-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-����
-�
-�
-�
-��	-�	-sT�3�7�7�)C"�(A"C�
C"�C�C"�C�C"�"
C/�.C/�!E�E	�E	c��t��5}|�d��|�dd���ddd��n#1swxYwY|�|���d��5|�dt
j���tj��r|�dd	���ddd��n#1swxYwYd
D]b}|�|���|��5|�	t
j
d��ddd��n#1swxYwY�cdS)Nztmp/z
tmp/../../mooztmp/../..//tmp/moor�r{�tmp�rZr�ztmp/../../tmp/moor�zU'tmp/../../moo' would be extracted to ['"].*moo['"], which is outside the destination)r�r�r�r%r�r&r[rr�r�rbr�s   r�test_sly_relative2z(TestExtractionFilters.test_sly_relative2|s���^�^�	F�s��G�G�F�O�O�O��G�G�O�0D�G�E�E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F��
�
����
�
�O�
<�
<�	K�	K����U����9�9�9��$�&�&�
K�� � ��6I� �J�J�J�	K�	K�	K�	K�	K�	K�	K�	K�	K�	K�	K����	K�	K�	K�	K�
$�	%�	%�F��#�#�C�H�H�J�J��7�7�
%�
%��%�%��3�$�%�%�%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%����
%�
%�
%�
%��	%�	%s6�-A�A�A�;AC�C�C�
!D7�7D;	�>D;	c	���t��5}|�dd���|�dtj�dd�����|�dtj�d	dd���
��ddd��n#1swxYwYdD]�}|�|���|��5|�dd���|�dd���tj	��r|�ddd�
��n|�dd���ddd��n#1swxYwY��dS)N�targetdir/targetrr�linkdir/hardlink�	targetdirr�r��linkdir/symlinkr�r��rGrr{z../targetdir/target�rVr��
r�r�rdrerfr�r%r�rr�r�s   r�test_deep_symlinkz'TestExtractionFilters.test_deep_symlink�s��
�^�^�	.�s��G�G�&�Q�G�/�/�/��G�G�&�B�G�L�L��X�5'�5'�G�
(�
(�
(�
�G�G�%�"�'�,�,��k�8�3-�3-�G�
.�
.�
.�
	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�5�	@�	@�F��#�#�C�H�H�J�J��7�7�
@�
@�� � �!3�!� �<�<�<�� � �!3�!� �<�<�<��(�*�*�@��$�$�%6�Q�0E�%�G�G�G�G��$�$�%6�Q�$�?�?�?�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@��	@�	@s%�BB�B"�%B"�A2E�E	�E	c�l�t��5}|�dd���|�dtj�dd�����|�dd�	��|�d
d���|�dd���ddd��n#1swxYwYd
D]�}|�|���|��5|�dd�	��|�d
d�	��|�dd�	��tj	��r1|�ddd���|�ddd���n.|�dd�	��|�dd�	��ddd��n#1swxYwY��dS)Nr�hardlinkr��symlink2�linkdir�	hardlink2rrrrr�zlinkdir/hardlink2rr	r
r�s   r�test_chainsz!TestExtractionFilters.test_chains�st���^�^�	H�s��G�G�%�*�G�=�=�=��G�G�J�2�7�<�<��;�,(�,(�G�
)�
)�
)��G�G�&�Q�G�/�/�/��G�G�&�4F�G�G�G�G��G�G�'�5F�G�G�G�G�
	H�	H�	H�	H�	H�	H�	H�	H�	H�	H�	H����	H�	H�	H�	H�5�	9�	9�F��#�#�C�H�H�J�J��7�7�
9�
9�� � �!3�!� �<�<�<�� � �!3�!� �<�<�<�� � �!4�1� �=�=�=��(�*�*�9��$�$�%6�Q�0:�%�<�<�<��$�$�Z�a�0C�%�E�E�E�E��$�$�%6�Q�$�?�?�?��$�$�Z�a�$�8�8�8�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9�
9����
9�
9�
9�
9��	9�	9s%�BB-�-B1�4B1�$B8F(�(F,	�/F,	c�t
�t��5}|�dd���|�dd���|�dd���|�dd	���|�d
d���|�dd
���ddd��n#1swxYwYtj�t
d��}t
|d��5	ddd��n#1swxYwY		tj|tj|��j	tj
z��nM#t$r@}|jttdd��kr|�d��n�Yd}~nd}~wwxYwtj|��j	tj
z}tj|��n#tj|��wxYwtj|��tj|tj|��j	tj
z��tj|��j	tj
z}tj|��|�|���d��5|r|�dd���n|�dd���|�dd���|�dd���|�dd	���|�d
d���|r|�dd
���n|�dd���ddd��n#1swxYwY|�|���d��5|�dd���|�dd���|�dd���|�dd	���|�d
d���|�dd���ddd��n#1swxYwY|�|���d��5tjtj|j���j	����}|�dd���|�dd���|�dd���|�dd���|�d
d���|�d|���ddd��dS#1swxYwYdS)N�all_bitsz
?rwsrwsrwtr��	perm_bitsz
?rwxrwxrwx�exec_group_otherz
?rw-rwxrwx�read_group_onlyz
?---r-----�no_bitsz
?---------zdir/z
?---rwsrwtztmp.filer��EFTYPErz?chmod() failed with EFTYPE: regular users cannot set sticky bitr{z
?rwsrwsrwxz
?---rwsrwxrGz
?rwxr-xr-xz
?rw-r-xr-xz
?---r-xr-xrz
?rw-r--r--z
?rw-r-----z
?rw-------)r�r�rdrerfrcr%�chmodr�r�r�r��errnor;r�ror�r�r�r�rFr�r�)rr��tmp_filenamer��have_sticky_files�have_sticky_dirs�normal_dir_modes       r�
test_modesz TestExtractionFilters.test_modes�s|���^�^�	/�s��G�G�J�\�G�2�2�2��G�G�K�l�G�3�3�3��G�G�&�\�G�:�:�:��G�G�%�L�G�9�9�9��G�G�I�L�G�1�1�1��G�G�F��G�.�.�.�
	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/��w�|�|�G�Z�8�8��
�,��
$�
$�	�	��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	$�

�������.�.�6���E�G�G�G�G���
�
�
��9���x�� ;� ;�;�;��M�M�#H�I�I�I�I��I�I�I�I�I�����	
����"$���!6�!6�!>���!M���I�l�#�#�#�#��B�I�l�#�#�#�#����
������
���r�w�|�4�4�<�t�|�K�L�L�L��G�L�1�1�9�D�L�H��
������
�
�
����
�
�O�
<�
<�	<�	<� �
@�� � ��,� �?�?�?�?�� � ��,� �?�?�?����[�|��<�<�<����/�l��C�C�C����.�\��B�B�B����Y�\��:�:�:��
<�� � ��l� �;�;�;�;�� � ��l� �;�;�;�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<��
�
����
�
�E�
2�
2�	8�	8����Z�l��;�;�;����[�|��<�<�<����/�l��C�C�C����.�\��B�B�B����Y�\��:�:�:����V�,��7�7�7�
	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8��
�
����
�
�F�
3�
3�	;�	;�"�m�D�L��
�"�"�$�$�,�-.�-.�/�/�O����Z�l��;�;�;����[�|��<�<�<����/�l��C�C�C����.�\��B�B�B����Y�\��:�:�:����V�/��:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s��BB&�&B*�-B*�&C4�4C8�;C8�9D;�:G�;
F�6F�;G�F�)G�G�B?M�M�M�	BP � P$�'P$�C
T-�-T1�4T1c�P�t��5}|�dtj���ddd��n#1swxYwYdD]z}|�|���|��5t
td��r"|�dtj���n	ddd��n#1swxYwY�{|�|���d��5|�	tj
d��ddd��dS#1swxYwYdS)Nrr)r{rG�mkfiforz'foo' is a special file)r�r�r&rEr�r%r�rdr�r�rZr�s   r�	test_pipezTestExtractionFilters.test_pipes���
�^�^�	2�s��G�G�E�� 0�G�1�1�1�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�-�	�	�F��#�#�C�H�H�J�J��7�7�
�
��2�x�(�(���$�$�U��1A�$�B�B�B�B��
�
�
�
�
�
�
�
�
�
�
����
�
�
�
���
�
����
�
�F�
3�
3�	+�	+��!�!��(�)�
+�
+�
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s3�"=�A�A�49B9�9B=	�B=	�-!D�D�"Dc�x�tjtjtjfD�]}tjd��}||_tj|d��}|�||��tj|d��}|�	|j|��|�
tj��5}tj|d��ddd��n#1swxYwY|�
|jjtj��|�	|jjjd����dS)Nrr)r&rEr?r<rrZr`r%rJrTrrZrNr5rkrYr�)r�special_typerY�trustedrG�cms      r�test_special_filesz(TestExtractionFilters.test_special_filessK��$�,�g�o�w��N�
	?�
	?�L��o�e�,�,�G�'�G�L��2�7�B�?�?�G��M�M�'�7�+�+�+��$�W�b�1�1�C����S�X�|�4�4�4��"�"�7�#;�<�<�
1���#�G�R�0�0�0�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1����
1�
1�
1�
1��!�!�"�,�"6���H�H�H����R�\�1�6��>�>�>�>�
	?�
	?s�<C�C"	�%C"	c��tj�t��5}|���D]-}tj|d��}|�||���.	ddd��dS#1swxYwYdS�Nr)r&r'r%r"r�r`r%�rrGrY�filtereds    r�test_fully_trusted_filterz/TestExtractionFilters.test_fully_trusted_filter(s���
�_�
!�
!�'�
*�
*�	1�c��>�>�+�+�
1�
1��"�7���D�D���
�
�h��0�0�0�0�
1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s�AA6�6A:�=A:c�Z�tj�t��5}|���D]W}tj|d��}|�|j|j��|�|j|j���X	ddd��dS#1swxYwYdSr))	r&r'r%r"r�rJr%r�rZr*s    r�test_tar_filterz%TestExtractionFilters.test_tar_filter/s����_�
!�
!�'�
*�
*�	;�c��>�>�+�+�
;�
;��"�-�g�r�:�:���
�
�h�m�W�\�:�:�:��
�
�h�m�W�\�:�:�:�:�
;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s�A-B � B$�'B$c��tj�t��5}|���D]n}	tj|d��}n#tj$rY�*wxYw|�|j|j��|�|j	|j	���o	ddd��dS#1swxYwYdSr))
r&r'r%r"r�rNrKr%r�rZr*s    r�test_data_filterz&TestExtractionFilters.test_data_filter9s���_�
!�
!�'�
*�
*�	;�c��>�>�+�+�
;�
;���&�2�7�B�?�?�H�H���*�����H������
�
�h�m�W�\�:�:�:��
�
�h�m�W�\�:�:�:�:�

;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�	;�	;s5�B7�A�B7�A%�"B7�$A%�%AB7�7B;�>B;c��t��5}|�d��ddd��n#1swxYwYtj|��5|�|���d��5|�d��ddd��n#1swxYwYddd��dS#1swxYwYdS)z6Ensure the default filter does not warn (like in 3.12)rN)r�r�r
�check_no_warningsr�r%r�r�s  r�test_default_filter_warns_notz3TestExtractionFilters.test_default_filter_warns_notEsi��
�^�^�	�s��G�G�E�N�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
.�t�
4�
4�	(�	(��#�#�C�H�H�J�J��5�5�
(�
(�� � ��'�'�'�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(����
(�
(�
(�
(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(sB�1�5�5�)B3�9B�B3�B	�B3�"B	�#B3�3B7�:B7c���tjtd��}d�}||_|�|d��5|�d��ddd��dS#1swxYwYdS)Nr_c� �|jdkr|SdS�NrOr:�rYres  r�
strict_filterzSTestExtractionFilters.test_change_default_filter_on_instance.<locals>.strict_filterO����|��.�.����trrO)r&r'r"rPr�r�)rrGr8s   r�&test_change_default_filter_on_instancez<TestExtractionFilters.test_change_default_filter_on_instanceMs����o�g�s�+�+��	�	�	�
!.���
�
�
��T�
*�
*�	.�	.����_�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�A�A"�%A"c�R�d�}tjtd��}tjtjdt|����5|�|d��5|�d��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nc� �|jdkr|SdSr6r:r7s  rr8zPTestExtractionFilters.test_change_default_filter_on_class.<locals>.strict_filterYr9rr_rPrO)r&r'r"rr�rrr�r�)rr8rGs   r�#test_change_default_filter_on_classz9TestExtractionFilters.test_change_default_filter_on_classXs,��	�	�	�
�o�g�s�+�+��
�
�w��0C�+�M�:�:�<�<�	2�	2��#�#�C��.�.�
2�
2�� � ��1�1�1�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2����	2�	2�	2�	2�	2�	2s6�B�"B�8B�B	�B�B	�B�B �#B c���Gd�dtj��}|td��}|�|d��5|�d��ddd��dS#1swxYwYdS)Nc��eZdZd�ZdS)�QTestExtractionFilters.test_change_default_filter_on_subclass.<locals>.TarSubclassc� �|jdkr|SdSr6r:�rrYres   rrPzcTestExtractionFilters.test_change_default_filter_on_subclass.<locals>.TarSubclass.extraction_filterfs���<�?�2�2�"�N��4rNr~r*rr�TarSubclassr@es#������
 �
 �
 �
 �
 rrCr_rO)r&r'r"r�r�)rrCrGs   r�&test_change_default_filter_on_subclassz<TestExtractionFilters.test_change_default_filter_on_subclassds���	 �	 �	 �	 �	 �'�/�	 �	 �	 ��k�'�3�'�'��
�
�
��T�
*�
*�	.�	.����_�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�A#�#A'�*A'c���tjtd��}d|_|�|d��5|�t��ddd��dS#1swxYwYdS)Nr_r)r&r'r"rPr�r�r�rs  r�$test_change_default_filter_to_stringz:TestExtractionFilters.test_change_default_filter_to_stringps����o�g�s�+�+�� &���
�
�
��T�
*�
*�	-�	-��!�!�)�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�A � A$�'A$c����fd�}t��5}|�d��|�d��|�d��ddd��n#1swxYwY��|���|��5��d����d��ddd��dS#1swxYwYdS)Nc�����|�j��|jdkr|�d���S|jdkrdS|S)N�	move_this�movedr:�ignore_this)r%r�r�r�)rYrers  �r�
custom_filterz?TestExtractionFilters.test_custom_filter.<locals>.custom_filterwsQ����M�M�$���-�-�-��|�{�*�*����G��4�4�4��|�}�,�,��t��NrrIrK�keeprJr�)rrLr�s`  r�test_custom_filterz(TestExtractionFilters.test_custom_filtervsY���	�	�	�	�	��^�^�	�s��G�G�K� � � ��G�G�M�"�"�"��G�G�F�O�O�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
�
����
�
�M�
:�
:�	%�	%����W�%�%�%����V�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s$�AA!�!A%�(A%�+C�C�Cc�2�t��5}|�d��ddd��n#1swxYwY|�|���d��5|�t
��ddd��dS#1swxYwYdS)Nrzbad filter name)r�r�r�r%r�rPr�s  r�test_bad_filter_namez*TestExtractionFilters.test_bad_filter_name�s��
�^�^�	�s��G�G�E�N�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
����
�
�,=�
>�
>�	.�	.��!�!�*�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�1�5�5�$B�B�Bc�H�Gd�d��}t��5}|�d��|�dd���|�d��ddd��n#1swxYwY|��5}|�|���|��5|�d��ddd��n#1swxYwYddd��n#1swxYwY|�|jd��|�|jd��dS)	Nc� �eZdZd�Zd�Zd�ZdS)�BTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilterc��d|_|Sr�)�num_files_processedrs rr�zLTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilter.__enter__�s��+,��(��rc��	tj||��}n#tj$rYdSwxYw|xjdz
c_|S)Nrs)r&rNrKrUrBs   r�__call__zKTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilter.__call__�sY�� �%�1�'�4�@�@�G�G���*� � � ��4�4� �����(�(�A�-�(�(��s��+�+c��d|_dS)NT)�done)r�exc_infos  rr�zKTestExtractionFilters.test_stateful_filter.<locals>.StatefulFilter.__exit__�s
�� ��	�	�	rN)rr r!r�rWr�r*rr�StatefulFilterrS�sA������
�
�
�
�
�
�
!�
!�
!�
!�
!rr[�good�badr�r�rvT)r�r�r�r%r�rTrUrY)rr[r�rLs    r�test_stateful_filterz*TestExtractionFilters.test_stateful_filter�s���	!�	!�	!�	!�	!�	!�	!�	!� �^�^�	�s��G�G�F�O�O�O��G�G�E�c�G�*�*�*��G�G�F�O�O�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��^�
�
�	)���#�#�C�H�H�J�J�
�>�>�
)�
)�� � ��(�(�(�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	
����:�A�>�>�>�����+�T�2�2�2�2�2sH�AA*�*A.�1A.�?)C!�(C
�>C!�
C	�C!�C	�C!�!C%�(C%c�0�d�}d�}d�}d�}d�}t��5}|�d��ddd��n#1swxYwY|�|�d���|��5|�d��ddd��n#1swxYwY|�|�d���|��5|�d��ddd��n#1swxYwY|�|�d���|��5|�d��ddd��n#1swxYwY|�|�d���|��5|�tj��ddd��n#1swxYwY|�|�d���|��5|�t��ddd��n#1swxYwY|�|�d	���|��5|�d��ddd��n#1swxYwY|�|�d	���|��5|�tj	��ddd��n#1swxYwY|�|�d	���|��5|�t��ddd��n#1swxYwY|�|�d	���|��5|�tj��ddd��n#1swxYwY|�|�d	���|��5|�t��ddd��n#1swxYwY|�|�d
���|��5|�tj��ddd��n#1swxYwY|�|�d
���|��5|�tj	��ddd��n#1swxYwY|�|�d
���|��5|�t��ddd��n#1swxYwY|�|�d
���|��5|�tj��ddd��n#1swxYwY|�|�d
���|��5|�t��ddd��n#1swxYwY|�|�d���|��5|�t��ddd��dS#1swxYwYdS)Nc�*�tjd���)Nzfailed with ExtractError)r&�ExtractErrorr7s  r�extracterror_filterzBTestExtractionFilters.test_errorlevel.<locals>.extracterror_filter�s���&�'A�B�B�Brc�*�tjd���)Nzfailed with FilterError)r&rKr7s  r�filtererror_filterzATestExtractionFilters.test_errorlevel.<locals>.filtererror_filter�s���%�&?�@�@�@rc� �td���)Nzfailed with OSError)r�r7s  r�oserror_filterz=TestExtractionFilters.test_errorlevel.<locals>.oserror_filter�s���/�0�0�0rc�*�tjd���)Nzfailed with base TarError)r&�TarErrorr7s  r�tarerror_filterz>TestExtractionFilters.test_errorlevel.<locals>.tarerror_filter�s���"�#>�?�?�?rc� �td���)Nzfailed with ValueError)rPr7s  r�valueerror_filterz@TestExtractionFilters.test_errorlevel.<locals>.valueerror_filter�s���5�6�6�6rr+rr�rsrvzboo!)
r�r�r�r%r�r�r&rhrPrKr�rar�)rrbrdrfrirkr�s       r�test_errorlevelz%TestExtractionFilters.test_errorlevel�s�	��	C�	C�	C�	A�	A�	A�	1�	1�	1�	@�	@�	@�	7�	7�	7��^�^�	�s��G�G�F�O�O�O�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
����A�� 6� 6�8K�
L�
L�	%�	%����V�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��
�
����A�� 6� 6�8J�
K�
K�	%�	%����V�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��
�
����A�� 6� 6��
G�
G�	%�	%����V�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��
�
����A�� 6� 6��
H�
H�	4�	4��!�!�'�"2�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4��
�
����A�� 6� 6�8I�
J�
J�	.�	.��!�!�*�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�
�
�
����A�� 6� 6�8K�
L�
L�	%�	%����V�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%��
�
����A�� 6� 6�8J�
K�
K�	7�	7��!�!�'�"5�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7��
�
����A�� 6� 6��
G�
G�	+�	+��!�!�'�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+��
�
����A�� 6� 6��
H�
H�	4�	4��!�!�'�"2�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4��
�
����A�� 6� 6�8I�
J�
J�	.�	.��!�!�*�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�
�
�
����A�� 6� 6�8K�
L�
L�	8�	8��!�!�'�"6�7�7�7�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8��
�
����A�� 6� 6�8J�
K�
K�	7�	7��!�!�'�"5�6�6�6�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7��
�
����A�� 6� 6��
G�
G�	+�	+��!�!�'�*�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+��
�
����A�� 6� 6��
H�
H�	4�	4��!�!�'�"2�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4��
�
����A�� 6� 6�8I�
J�
J�	.�	.��!�!�*�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�
�
�
����F�� ;� ;�=O�
P�
P�	-�	-��!�!�)�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s1�A�A�A�5B�B�B�C.�.C2�5C2�#E�E	�E	�: F&�&F*�-F*�H�H�	H�7I�I� I� J:�:J>�J>�/L�L�L� M7�7M;�>M;�,O�O�O� P4�4P8�;P8�) R�R�R�
S1�1S5�8S5�& U�U�U�V.�.V2�5V2�#X�X�X)NNNN)r�)&rr r!r�r�rcr�r�rr�r�r�r�r�r�r�r�r�r�r�rrrrr"r'r,r.r0r3r:r=rDrFrNrPr^rlr*rrr�r�0
sd������
�w�|�G�$�$�z�1�H����G��9�9��^�9�8BF��!0�!0�!0�!0�F%�%�%�%�/�/�/�K�K�K�2�00�00��\�00�d�T0�T0��\�T0�l�:�:��\�:�::�:�:�"� -� -��\� -�D�%�%��\�%�&�@�@��\�@�.�9�9��\�9�2C;�C;�C;�J+�+�+�$
?�
?�
?�1�1�1�;�;�;�
;�
;�
;�(�(�(�	.�	.�	.�
2�
2�
2�
.�
.�
.�-�-�-�%�%�%�".�.�.�3�3�3�<E-�E-�E-�E-�E-rr�c�f�eZdZej�ed��Zed���Z	d�Z
d�ZdS)�OverwriteTests�
testoverwritec�P�tj�td��x}|_|�tj|��tj	|d��5}tj
d��}d|_|�|tjd����ddd��n#1swxYwYtj�td��x}|_|�tj|��tj	|d��5}|�|�tjd����ddd��n#1swxYwYtj�td��}||_|�tj|��tj	|d��5}tj
d��}d|_|�|tjd����ddd��dS#1swxYwYdS)	Nztar-with-file.tarr�r�rus
newcontentztar-with-dir.tarztar-with-implicit-dir.tarz	test/file)rdrerfrc�ar_with_file�addClassCleanuprror&r%rrVrr#r��ar_with_dirr��curdir�ar_with_implicit_dir)rOrMrGrs    rrPzOverwriteTests.setUpClass�so��!�w�|�|�G�5H�I�I�I��C�����I�,�a�0�0�0�
�\�!�S�
!�
!�	6�S����'�'�A��A�F��K�K��2�:�m�4�4�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�
!�g�l�l�7�4F�G�G�G��C�O����I�,�a�0�0�0�
�\�!�S�
!�
!�	;�S��K�K����r�y�&�9�9�:�:�:�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;�
�G�L�L��"=�>�>��#$�� ����I�,�a�0�0�0�
�\�!�S�
!�
!�	6�S����,�,�A��A�F��K�K��2�:�m�4�4�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�	6�	6s8�"AB2�2B6�9B6�4E�E"�%E"�
AH�H�"Hc�,�tj|d��Sr�)r&r%)rres  rr%zOverwriteTests.opens���|�D�#�&�&�&rc�>�|�|jd���dS)Nr{r])rs�testdir)r�ars  rrszOverwriteTests.extractalls ��
�
�
�d�l�?�
�;�;�;�;�;rN)rr r!rdrerfrcrxrgrPr%rsr*rrrnrn�s`�������g�l�l�7�O�4�4�G��6�6��[�6�*'�'�'�<�<�<�<�<rrnc�8�tjt��tjt��t
gatt
d��5}|���}ddd��n#1swxYwYtttfD]�}|jr�tj|j��t�|j��|�|jd��5}|�
|��ddd��n#1swxYwY��dS)Nrrr�)rrorcrd�makedirsr"r�r%rSr,r3r9r�r)rZr�crGs    r�setUpModuler}sh��
��W�����K������9�L�	
�g�t�	�	����y�y�{�{���������������������w��
(� � ���6�	 ���Q�Y�'�'�'�����	�*�*�*�����	�4�(�(�
 �C��	�	�$����
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 ��	 � s$�A1�1A5�8A5�,D�D	�D	c��tj�t��rt	jt��dSdSr)rdrer�rcrr�r*rr�tearDownModuler$s9��	�w�~�~�g���"����!�!�!�!�!�"�"r�__main__)�rr�rdr#�hashlibr�
contextlibr�randomrr�rUr��warningsr�r��
unittest.mockr&r�rr�test.supportrr	r
r/rr�r4r<rrer7�TESTFNrcr�r!r"rfr.r5r;r�r�rWr,r�
requires_gzipr,�requires_bz2r3�
requires_lzmar9r@�TestCaserMr�r�r�r�r�r�r�r�r.r�r�r�r�r�r�r�r�r�r�r�r�r�r�rDr[rtr�r�r�r�r�r�rr
r
rr6rJrirrrvr{r�r�r}r�r�r�r�r�r�r�rrrrrrpr�r�r�r�rrr4rGr}r�r�r�r�r�r�rr�r�rnr}rrr>r*rr�<module>r�s�������
�
�
�
�	�	�	�	�	�	�	�	�������%�%�%�%�%�%�����������
�
�
�
�	�	�	�	���������������������������������"�"�"�"�"�"�&�&�&�&�&�&�(�(�(�(�(�(���K�K�K�K�������D�D�D�������K�K�K�K�������D�D�D�������J�J�J�J������
�C�C�C�������K�K�K�K�������D�D�D�����$�$�$�
�'�/�/�)�*�
+�
+�i�
7���o�%�	�
�'�
�=�
)�
)��
�7�<�<��!1�2�2��
�'�,�,�w� 1�
2�
2��	����g�/�	0�	0��
�'�,�,�w�	�
*�
*���g�l�l�7�I�.�.��G��G��
)�)�)�)�)�)�)�)������%�%�%�%�%�%�%���%������&�&�&�&�&�&�&���&������%�%�%�%�%�%�%���%�	�	�	�	�	�w�	�	�	�U�U�U�U�U�H�h�/�U�U�U�n	�	�	�	�	��-�	�	�	�	�	�	�	�	�w�
�	�	�	�	�	�	�	�	��-�	�	�	�M1�M1�M1�M1�M1�x��*�M1�M1�M1�`	�	�	�	�	�8�X�	�	�	�	�	�	�	�	�'�8�	�	�	�	�	�	�	�	�8�X�	�	�	�V1�V1�V1�V1�V1�X�V1�V1�V1�rR.�R.�R.�R.�R.�~�R.�R.�R.�h�����#�X�%6����	�	�	�	�	�x�!1�8�3D�	�	�	�8�8�8�8�8�g�/��1B�8�8�8�9�9�9�9�9�x�!1�8�3D�9�9�9�
<�<�<�<�<�^�X�%6�<�<�<�|	�	�	�	�	��>�	�	�	�	�	�	�	�	���	�	�	�	�	�	�	�	��>�	�	�	�&1�&1�&1�&1�&1�W�h�/�&1�&1�&1�P	�	�	�	�	��>�	�	�	�
,�
,�
,�
,�
,���
,�
,�
,�	�	�	�	�	��>�	�	�	�1�1�1�1�1�x��1B�1�1�1�"^E�^E�^E�^E�^E�X�x�0�^E�^E�^E�B6O�6O�6O�6O�6O�6O�6O�6O�p9�9�9�9�9�,��(�*;�9�9�9�xT@�T@�T@�T@�T@�,��(�*;�T@�T@�T@�nG�G�G�G�G�G�G�G�G�<u'�u'�u'�u'�u'�
�x�0�u'�u'�u'�p		�	�	�	�	�H�i�	�	�	�	�	�	�	�	�7�I�	�	�	�	�	�	�	�	�H�i�	�	�	�(%�(%�(%�(%�(%�m�X�%6�(%�(%�(%�V7�7�7�7�7�(�O�7�7�7�8�8�8�8�8��/�8�8�8�;�;�;�;�;�(�O�;�;�;�O5�O5�O5�O5�O5�8�$�O5�O5�O5�d+&�+&�+&�+&�+&�}�h�&7�+&�+&�+&�\W.�W.�W.�W.�W.��� 1�W.�W.�W.�t�����X�z���������G�Z����%�%�%�%�%�X�z�%�%�%�(�(�(�(�(�*�(�(�(����W�W�R��(�(�*K�L�L�'1�'1�'1�'1�'1�8�$�'1�'1�M�L�'1�TH8�H8�H8�H8�H8�<�H8�H8�H8�VN�N�N�N�N�N�N�N�bL�L�L�L�L�{�H�$5�L�L�L�^G�G�G�G�G�[�(�"3�G�G�G�$K�K�K�K�K�[�(�"3�K�K�K�(I�I�I�I�I�I�I�I�(>%�>%�>%�>%�>%���!2�>%�>%�>%�@	�	�	�	�	�X�~�x�/@�	�	�	�	�	�	�	�	�G�^�X�->�	�	�	�	�	�	�	�	�X�~�x�/@�	�	�	�8*�8*�8*�8*�8*��"�8*�8*�8*�v_
�_
�_
�_
�_
�x� �_
�_
�_
�Da �a �a �a �a �h�'�a �a �a �H7B�7B�7B�7B�7B��*�7B�7B�7B�t������V�$�$�&F�G�G�@�@�@�@�@��(�"3�@�@�H�G�@�B*�*�*�*�*��(�"3�*�*�*�>	�	�	����W�W�R��)�)�+=�>�>����W�W�R��+�+�-A�B�B�wO�wO�wO�wO�wO�x�(�wO�wO�C�B�?�>�wO�t%-�%-�%-�%-�%-�8�X�.�%-�%-�%-�P\�\�\�\�\�8�\�\�\�|����� 4�h�6G����(�(�(�(�(�(<�(0�(9�(�(�(������3�X�5F���������#7�#+�#4����\8�\8�\8�\8�\8��*�\8�\8�\8�|���833�33�33�33�33�33�33�33�t�?��C�C�C�C����@-�@-�@-�@-�@-�H�-�@-�@-�@-�F<�<�<�<�<�^�2�H�4E�<�<�<�@ � � �""�"�"��z����H�M�O�O�O�O�O��sH�"A'�'A1�0A1�5A:�:B�B�B
�
B�B�B � B*�)B*

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists