uawdijnntqw1x1x1
IP : 216.73.216.139
Hostname : altar28.supremepanel28.com
Kernel : Linux altar28.supremepanel28.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
.
/
..
/
lib64
/
sse2
/
..
/
python3.12
/
..
/
gems
/
..
/
python3.12
/
__pycache__
/
tarfile.cpython-312.pyc
/
/
� ͲiJ�����dZdZdZdZddlmZddlZddlZddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZ ddlZ ddlZeeefZgd�ZdZd Zd ZdZedzZd ZdZdZ dZ!dZ"dZ#d Z$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3d Z4e4Z5e#e$e%e&e)e*e+e'e(e,e-e.fZ6e#e$e+e.fZ7e,e-e.fZ8d!Z9hd"�Z:e;e;e;e<e<e<d#�Z=ej|d$k(rd%Z?nej��Z?d&�ZAd'�ZBd(�ZCd)e5fd*�ZDd+�ZEdedfd,�ZFd-�ZGGd.�d/eH�ZIGd0�d1eI�ZJGd2�d3eI�ZKGd4�d5eI�ZLGd6�d7eI�ZMGd8�d9eI�ZNGd:�d;eN�ZOGd<�d=eN�ZPGd>�d?eN�ZQGd@�dAeN�ZRGdB�dCeN�ZSGdD�dE�ZTGdF�dG�ZUGdH�dIeV�ZWGdJ�dKeV�ZXGdL�dMe j��ZZGdN�dOeI�Z[GdP�dQe[�Z\GdR�dSe[�Z]GdT�dUe[�Z^GdV�dWe[�Z_GdX�dYe[�Z`GdZ�d[e[�Zae[eeJfZbdid\�Zcd]�Zdd^�Zed_�Zfedeeefd`�ZgeV�Zhej�da�ZjGdb�dceV�ZkGdd�deeV�Zldf�Zmelj Zdg�Zneodhk(ren�yy#e$rdZY��(wxYw#e$rdZY��1wxYw)jz,Read from and write to tar format archives. z0.9.0u"Lars Gustäbel (lars@gustaebel.de)u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.�)�openN)�TarFile�TarInfo� is_tarfile�TarError� ReadError�CompressionError�StreamError�ExtractError�HeaderError�ENCODING�USTAR_FORMAT� GNU_FORMAT� PAX_FORMAT�DEFAULT_FORMATr�fully_trusted_filter�data_filter� tar_filter�FilterError�AbsoluteLinkError�OutsideDestinationError�SpecialFileError�AbsolutePathError�LinkOutsideDestinationErrorTz/etc/python/tarfile.cfg�i�sustar sustar00�d��0�1�2�3�4�5�6�7�L�K�S�x�g�X��)�path�linkpath�size�mtime�uid�gid�uname�gname>r/r6r5r0)�atime�ctimer2r3r4r1�nt�utf-8c�v�|�td��|j||�}|d||t|�z tzzS)z8Convert a string to a null-terminated bytes object. Nzmetadata cannot contain None)� ValueError�encode�len�NUL)�s�length�encoding�errorss � /usr/lib64/python3.12/tarfile.py�stnrE�sC�� �y��7�8�8� ����6�"�A��W�f�:��#�a�&��C�/�/�/�c�\�|jd�}|dk7r|d|}|j||�S)z8Convert a null-terminated bytes object to a string. r���N)�find�decode)r@rBrC�ps rD�ntsrL�s4�� ���u� �A��B�w� �b�q�E���8�8�H�f�%�%rFc�6�|ddvrMd}tt|�dz �D]}|dz}|||dzz }�|ddk(rdt|�dz z|z }|S t|dd�}t|j �xsd d�}|S#t $rt d ��wxYw)z/Convert a number field to a python number. r)��r-�rO��ascii�strict�0�invalid header)�ranger>rL�int�stripr<�InvalidHeaderError)r@�n�is rD�ntir\�s��� ��t�~�� ���s�1�v��z�"�A� �!�G�A� ��1�q�5��M�A�#� �Q�4�5�=��#�a�&�1�*�%��)�*�A� �H� 7��A�w��)�A��A�G�G�I�$��a�(�A� �H��� 7�$�%5�6�6� 7�s�+B�BrPc��|}t|�}d|cxkrd|dz zkr nntd|dz |fzd�tz}|S|tk(rzd|dz z|cxkrd|dz zkrbntd ��|dk\r t dg�}nt dg�}d|z|z}t|dz �D]}|j d|dz�|dz}�|Std ��) z/Convert a python number to a number field. rrPr-z%0*orRrQrNrOzoverflow in number field)rW�bytesr?r� bytearrayrV�insertr<)rZ�digits�format� original_nr@r[s rD�itnrd�s����J��A��A��A�!��f�q�j�!�!��&�F�Q�J��?�*�G�4�s�:�� �H� �:� �3�6�A�:�#6�"6�!�"Q�c�f�q�j�>Q�"Q��3�4�4� ��6��5�'�"�A��5�'�"�A��v� ��!�A��v��z�"�A� �H�H�Q��E� �"� �!�G�A�#� �H��3�4�4rFc��dttjd|��z}dttjd|��z}||fS)a�Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed. rQ� 148B8x356B� 148b8x356b)�sum�struct�unpack_from)�buf�unsigned_chksum� signed_chksums rD�calc_chksumsrn�sG���C�� 2� 2�<�� E�F�F�O��#�f�0�0��s�C�D�D�M��M�)�)rFc�x�|xsd}|dk(ry|�tj|||�yt||�\}}t|�D]:}|j |�}t|�|kr|d��|j |��<|dk7r8|j |�}t|�|kr|d��|j |�y)zjCopy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. i@rN�unexpected end of data)�shutil�copyfileobj�divmodrV�readr>�write) �src�dstrA� exception�bufsize�blocks� remainder�brks rDrrrr�s����"��G� ��{�� �~����3��W�-���v�w�/��F�I� �6�]���h�h�w����s�8�g���4�5�5�� � �#�� ��A�~��h�h�y�!���s�8�i���4�5�5�� � �#�� rFc��ttjdd�}|�!|j|d�j |�}t|d��y)NrB�backslashreplace� )�end)�getattr�sys�stdoutr=rJ�print)r@rBs rD�_safe_printr�s@���s�z�z�:�t�4�H��� �H�H�X�1�2�9�9�(�C�� �!��rFc��eZdZdZy)rzBase exception.N��__name__� __module__�__qualname__�__doc__�rFrDrrs���rFrc��eZdZdZy)rz%General exception for extract errors.Nr�r�rFrDrrs��/�rFrc��eZdZdZy)rz&Exception for unreadable tar archives.Nr�r�rFrDrrs��0�rFrc��eZdZdZy)r z.Exception for unavailable compression methods.Nr�r�rFrDr r s��8�rFr c��eZdZdZy)r z=Exception for unsupported operations on stream-like TarFiles.Nr�r�rFrDr r !s��G�rFr c��eZdZdZy)rz!Base exception for header errors.Nr�r�rFrDrr$s��+�rFrc��eZdZdZy)�EmptyHeaderErrorzException for empty headers.Nr�r�rFrDr�r�'s��&�rFr�c��eZdZdZy)�TruncatedHeaderErrorz Exception for truncated headers.Nr�r�rFrDr�r�*s��*�rFr�c��eZdZdZy)�EOFHeaderErrorz"Exception for end of file headers.Nr�r�rFrDr�r�-s��,�rFr�c��eZdZdZy)rYzException for invalid headers.Nr�r�rFrDrYrY0s��(�rFrYc��eZdZdZy)�SubsequentHeaderErrorz3Exception for missing and invalid extended headers.Nr�r�rFrDr�r�3s��=�rFr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)� _LowLevelFilez�Low-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. c��tjtjtjztjzd�|}ttd�r|tjz}tj||d�|_y)N��r�w�O_BINARYi�) �os�O_RDONLY�O_WRONLY�O_CREAT�O_TRUNC�hasattrr�r�fd)�self�name�modes rD�__init__z_LowLevelFile.__init__@sa��������r�z�z�)�B�J�J�6� �����2�z�"��B�K�K��D��'�'�$��e�,��rFc�B�tj|j�y�N)r��closer��r�s rDr�z_LowLevelFile.closeIs�� ������rFc�B�tj|j|�Sr�)r�rtr��r�r1s rDrtz_LowLevelFile.readLs���w�w�t�w�w��%�%rFc�D�tj|j|�yr�)r�rur��r�r@s rDruz_LowLevelFile.writeOs�� ������!�rFN)r�r�r�r�r�r�rtrur�rFrDr�r�:s��� -��&�rFr�c�Z�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Zdd �Zd�Z d�Zd �Zy)�_Streama�Class that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method that works with bytes, and the method is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin.buffer, sys.stdout.buffer, a socket, a tape device etc. _Stream is intended to be used only internally. c��d|_|�t||�}d|_|dk(rt|�}|j�}|xsd|_||_||_||_||_d|_ d|_ d|_ |dk(r[ ddl}||_|jd�|_|d k(r"|j"|_|j'�y|j)|�y|dk(rI ddl}|d k(r(d|_|j/�|_t2|_y|j5|�|_y|d k(rN ddl} |d k(r.d|_| j9�|_| j:|_y| j=�|_y|dk7rtd|z��y#t$r td �d�wxYw#t$r td�d�wxYw#t$r td�d�wxYw#|js|jj?�d|_�xYw)z$Construct a _Stream object. TNF�*�rFr�gzzzlib module is not availabler��bz2�bz2 module is not available�xz�lzma module is not available�tar�unknown compression type %r) �_extfileobjr��_StreamProxy�getcomptyper�r��comptype�fileobjryrk�pos�closed�zlib�ImportErrorr �crc32�crc�errorrx� _init_read_gz�_init_write_gzr��dbuf�BZ2Decompressor�cmp�OSError� BZ2Compressor�lzma�LZMADecompressor� LZMAError�LZMACompressorr�) r�r�r�r�r�ry� compresslevelr�r�r�s rDr�z_Stream.__init__^s�� ����?�#�D�$�/�G�$�D���s�?�#�7�+�G��*�*�,�H�� ��� ��� � �� ����������������- ��4��U��!�� ��:�:�c�?����3�;�%)�Z�Z�D�N��&�&�(��'�'� �6��U�"�T���3�;� #�D�I�"�2�2�4�D�H�%,�D�N�"�0�0��?�D�H��T�!�U���3�;� #�D�I�#�4�4�6�D�H�%)�^�^�D�N�#�2�2�4�D�H��U�"�&�'D�x�'O�P�P�#��E#�U�*�+I�J�PT�T�U��#�T�*�+H�I�t�S�T��#�U�*�+I�J�PT�T�U�� ��#�#����"�"�$��D�K��sy�:G�F�AG�G�G� F(�$,G�G�(G�.G�22G�%G�;G�F%�%G�(F>�>G�G�G�0H c�X�t|d�r|js|j�yyy)Nr�)r�r�r�r�s rD�__del__z_Stream.__del__�s#���4��"�4�;�;��J�J�L�,7�"rFc�t�|jj||jj|jj|jjd�|_t jdttj���}|jd|zdz�|jjd�r|jdd|_tjj|j�|_|j|jj!dd �t"z�y) z6Initialize for writing with gzip compression. r�<Ls�s��.gzN���z iso-8859-1�replace)r��compressobj�DEFLATED� MAX_WBITS� DEF_MEM_LEVELr�ri�packrW�time�_Stream__writer��endswithr�r/�basenamer=r?)r�r�� timestamps rDr�z_Stream._init_write_gz�s����9�9�(�(��)-���);�);�*.�)�)�*=�*=�)=�)-���)@�)@�)*� ,��� �K�K��c�$�)�)�+�&6�7� ����(�9�4�{�B�C��9�9���e�$�� � �#�2��D�I��G�G�$�$�T�Y�Y�/�� ����T�Y�Y�%�%�l�I�>��D�ErFc�*�|jdk(r+|jj||j�|_|xjt|�z c_|jdk7r|jj|�}|j|�y)z&Write string s to the stream. r�r�N) r�r�r�r�r�r>r��compressr�r�s rDruz _Stream.write�sg���=�=�D� ��y�y���q�$�(�(�3�D�H����C��F����=�=�E�!����!�!�!�$�A����Q�rFc�Z�|xj|z c_t|j�|jkDrt|jj |jd|j�|j|jd|_t|j�|jkDr�syy)z]Write string s to the stream if a whole new block is ready to be written. N)rkr>ryr�rur�s rD�__writez_Stream.__write�sr�� ���A� ���$�(�(�m�d�l�l�*��L�L���t�x�x� ����6�7��x�x���� �.�D�H��$�(�(�m�d�l�l�*rFc��|jryd|_ |jdk(r<|jdk7r-|xj|jj�z c_|jdk(r�|jr�|jj|j�d|_|jdk(ru|jjtjd|j��|jjtjd|jdz��|js|jj�yy#|js|jj�wwxYw) z[Close the _Stream object. No operation should be done on it afterwards. NTr�r�rFr�r�l��)r�r�r�rkr��flushr�rurir�r�r�r�r�r�s rDr�z _Stream.close�s ���;�;����� %��y�y�C��D�M�M�U�$:����D�H�H�N�N�,�,���y�y�C��D�H�H����"�"�4�8�8�,�����=�=�D�(��L�L�&�&�v�{�{�4����'B�C��L�L�&�&�v�{�{�4����J�9N�'O�P��#�#����"�"�$�$��4�#�#����"�"�$�$�s�DE�)E=c��|jj|jj�|_d|_|jd�dk7rt d��|jd�dk7rtd��t|jd��}|jd�|d zrIt|jd��d t|jd��zz}|j|�|dzr |jd�}|r |tk(rn�|dzr |jd�}|r |tk(rn�|dzr|jd�y y )z:Initialize for reading a gzip compressed fileobj. rFr.s��not a gzip filer-�zunsupported compression method��rQrP�N)r�� decompressobjr�r�r�� _Stream__readrr �ordrtr?)r��flag�xlenr@s rDr�z_Stream._init_read_gz�s+���9�9�*�*�D�I�I�,?�,?�+?�@����� ��;�;�q�>�[�(��-�.�.��;�;�q�>�W�$�"�#C�D�D��4�;�;�q�>�"�����A���!�8��t�{�{�1�~�&��s�4�;�;�q�>�/B�)B�B�D��I�I�d�O��!�8���K�K��N���A��H����"�9���K�K��N���A��H����!�8��K�K��N�rFc��|jS)z3Return the stream's file pointer position. )r�r�s rD�tellz_Stream.tells ���x�x�rFc��||jz dk\rnt||jz |j�\}}t|�D]}|j |j��|j |�|jStd��)zXSet the stream's file pointer to pos. Negative seeking is forbidden. rz seeking backwards is not allowed)r�rsryrVrtr )r�r�rzr{r[s rD�seekz_Stream.seekst������>�Q�� &�s�T�X�X�~�t�|�|� D��F�I��6�]��� � �$�,�,�'�#��I�I�i� ��x�x���@�A�ArFc�l�|�J�|j|�}|xjt|�z c_|S)z5Return the next size number of bytes from the stream.)�_readr�r>)r�r1rks rDrtz_Stream.reads3�������j�j�������C��H���� rFc�(�|jdk(r|j|�St|j�}|jg}||kr�|jr|j}d|_n(|j j |j�}|snA |jj|�}|j|�|t|�z }||kr��dj|�}||d|_|d|S#|j$r}td�|�d}~wwxYw)z+Return size bytes from the stream. r�rFzinvalid compressed dataN)r�r�r>r�rkr�rtryr�� decompressrxr�append�join)r�r1�c�trk�es rDrz _Stream._reads����=�=�E�!��;�;�t�$�$��� � �N�� �Y�Y�K���$�h��x�x��h�h������l�l�'�'����5���� B��h�h�)�)�#�.�� �H�H�S�M� ��S��M�A��$�h� �H�H�Q�K���d�e�H�� ���$�x��� �>�>� B�� 9�:��A�� B�s�C1�1D�D�Dc�*�t|j�}|jg}||krM|jj|j�}|sn%|j|�|t|�z }||kr�Mdj |�}||d|_|d|S)zsReturn size bytes from stream. If internal buffer is empty, read another block from the stream. rFN)r>rkr�rtryrr)r�r1rrrks rD�__readz_Stream.__read6s��� ����M�� �X�X�J���$�h��,�,�#�#�D�L�L�1�C��� �H�H�S�M� ��S��M�A��$�h� �H�H�Q�K���T�U�8�����$�x�rFN)r)r�r�r�r�r�r�r�rur�r�r�r�r�rtrr�r�rFrDr�r�RsF�� �E�N�F�"�/�%�,�>� ���6rFr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)r�zsSmall proxy class that enables transparent compression detection for the Stream interface (mode 'r|*'). c�Z�||_|jjt�|_yr�)r�rt� BLOCKSIZErk)r�r�s rDr�z_StreamProxy.__init__Ls������<�<�$�$�Y�/��rFc�P�|jj|_|jSr�)r�rtrkr�s rDrtz_StreamProxy.readPs���L�L�%�%�� ��x�x�rFc��|jjd�ry|jdddk(r|jdddk(ry |jjd �ryy) Ns�r�r�sBZhr�� s1AY&SYr�)s]�s�7zXZr�r�)rk� startswithr�s rDr�z_StreamProxy.getcomptypeTsV���8�8����/�� �X�X�a��]�f� $����!�B��9�)D�� �X�X� � �!C� D��rFc�8�|jj�yr�)r�r�r�s rDr�z_StreamProxy.close^s�������rFN)r�r�r�r�r�rtr�r�r�rFrDr�r�Gs���0���rFr�c�h�eZdZdZd d�Zd�Zd�Zd�Zd�Zd�Z e jfd �Zd d �Z d�Zd�Zy)�_FileInFilezA thin wrapper around an existing file object that provides a part of its data as an individual file object. Nc���||_||_||_d|_||_d|_|�d|fg}d|_g|_d}|j}|D]U\}}||kDr|jjd||df�|jjd|||z|f�||z }||z}�W||jkr*|jjd||jdf�yy)NrFT) r��offsetr1�positionr�r�� map_index�mapr)r�r�rr1r�� blockinfo�lastpos�realposs rDr�z_FileInFile.__init__ks����������� ��� ��� �������T���I����������+�+��%�L�F�D������������� >�?��H�H�O�O�T�6�6�D�=�'�B�C��t�O�G��t�m�G�&��T�Y�Y���H�H�O�O�U�G�T�Y�Y��=�>�rFc��yr�r�r�s rDr�z_FileInFile.flush�s��rFc��y�NTr�r�s rD�readablez_FileInFile.readable�s��rFc��y�NFr�r�s rD�writablez_FileInFile.writable�s��rFc�6�|jj�Sr�)r��seekabler�s rDr%z_FileInFile.seekable�s���|�|�$�$�&�&rFc��|jS)z*Return the current file position. )rr�s rDr�z_FileInFile.tell�����}�}�rFc�.�|tjk(r1tt|d�|j�|_|j S|tjk(rc|dkr*t|j |zd�|_|j St|j |z|j�|_|j S|tjk(r>tt|j|z|j�d�|_|j Std��)z(Seek to a position in the file. rzInvalid argument) �io�SEEK_SET�min�maxr1r�SEEK_CUR�SEEK_ENDr<)r�r�whences rDr�z_FileInFile.seek�s����R�[�[� ���H�a� 0�$�)�)�<�D�M��}�}���r�{�{� "��!�|� #�D�M�M�H�$<�a� @�� ��}�}��!$�D�M�M�H�$<�d�i�i� H�� � �}�}�� �r�{�{� "���D�I�I��$8�$�)�)� D�a�H�D�M��}�}���/�0�0rFc���|�|j|jz }n#t||j|jz �}d}|dkD�r$ |j|j\}}}}||jcxkr|krnnn?|xjdz c_|jt|j�k(rd|_�vt|||jz �}|re|jj||j|z z�|jj|�}t|�|k7rtd��||z }n|t|zz }||z}|xj|z c_|dkDr��$|S)z!Read data from the file. rFrr-rp)r1rr+rrr>r�r�rtrr?) r�r1rk�data�start�stoprrAr|s rDrtz_FileInFile.read�sD���<��9�9�t�}�}�,�D��t�T�Y�Y����6�7�D����Q�h��,0�H�H�T�^�^�,D�)��e�T�6��D�M�M�0�D�0���N�N�a�'�N��~�~��T�X�X��6�)*������t�d�m�m�3�4�F�����!�!�&�D�M�M�E�,A�"B�C��L�L�%�%�f�-���q�6�V�#�#�$<�=�=��q����s�V�|�#���F�N�D��M�M�V�#�M�'�Q�h�(� rFc�h�|jt|��}||dt|�t|�Sr�)rtr>)r�r|rks rD�readintoz_FileInFile.readinto�s,���i�i��A������)�3�s�8���3�x�rFc��d|_yr)r�r�s rDr�z_FileInFile.close�s ����rFr�)r�r�r�r�r�r�r r#r%r�r)r*r�rtr5r�r�rFrDrresB��� ?�2 ���'�� %'�K�K�� �>� rFrc���eZdZ�fd�Z�xZS)�ExFileObjectc���t|j|j|j|j|j �}t�|�|�yr�)rr��offset_datar1r��sparse�superr�)r��tarfile�tarinfor�� __class__s �rDr�zExFileObject.__init__�s;����g�o�o�w�/B�/B����g�l�l�G�N�N�<�� ����!rF�r�r�r�r�� __classcell__�r?s@rDr8r8�s ���"�"rFr8c��eZdZy)rN)r�r�r�r�rFrDrr�s��rFrc���eZdZ�fd�Z�xZS)rc�N��||_t�|� d|j�d��y)Nzmember z has an absolute path�r>r<r�r��r�r>r?s �rDr�zAbsolutePathError.__init__�s&������ ���7�7�<�<�"2�2G�H�IrFr@rBs@rDrr�s���J�JrFrc���eZdZ�fd�Z�xZS)rc�f��||_||_t�|� |j�d|�d�dz�y)Nz would be extracted to �, � which is outside the destination�r>�_pathr<r�r��r�r>r/r?s �rDr�z OutsideDestinationError.__init__�s;�������� � ���G�L�L�+�+B�4�(�"�M�=�>� ?rFr@rBs@rDrr�� ���?�?rFrc���eZdZ�fd�Z�xZS)rc�L��||_t�|� |j�d��y)Nz is a special filerFrGs �rDr�zSpecialFileError.__init__�s$������ ���G�L�L�+�+=�>�?rFr@rBs@rDrr�s���@�@rFrc���eZdZ�fd�Z�xZS)rc�L��||_t�|� |j�d��y)Nz is a link to an absolute pathrFrGs �rDr�zAbsoluteLinkError.__init__�s$������ ���G�L�L�+�+I�J�KrFr@rBs@rDrr�s���L�LrFrc���eZdZ�fd�Z�xZS)rc�f��||_||_t�|� |j�d|�d�dz�y)Nz would link to rJrKrLrNs �rDr�z$LinkOutsideDestinationError.__init__�s:�������� � ���G�L�L�+�?�4�(�"�E�=�>� ?rFr@rBs@rDrr�rOrFrc���eZdZ�fd�Z�xZS)�LinkFallbackErrorc�j��||_||_t�|� d|j�d�d|�d�z�y)Nzlink z would be extracted as a zcopy of z, which was rejectedrLrNs �rDr�zLinkFallbackError.__init__�sC�������� � ���5���� 0�0I�J�%�d�X�-A�B�C� DrFr@rBs@rDrWrW�s���D�DrFrWc�2�i}|j}tjj|tjj��}|jdtjf�r1|jjdtjz�x}|d<tjj|�rt|��tjjtjj||�tjj��}tjj||g�|k7rt||��|j}|�y|dz}|r^|j�s|j�r|dzs|dz}|dz}n.|j!�s|j#�rd}nt%|��||jk7r||d<|�r�|j&�d|d <|j(�d|d <|j*�d|d<|j,�d|d<|j�s|j#��r]tjj|j.�rt1|��tjj3|j.�}||j.k7r||d <|j#�rItjj|tjj5|�|j.�}n*tjj||j.�}tjj|tjj��}tjj||g�|k7rt7||��|S)N)rS�/r�i��@i�����r�r3r4r5r6�linkname)r�r�r/�realpath� ALLOW_MISSINGr�sep�lstrip�isabsrr� commonpathrr��isreg�islnk�isdir�issymrr3r4r5r6r]r�normpath�dirnamer)�member� dest_path�for_data� new_attrsr��target_pathr�� normalizeds rD�_get_filtered_attrsrps����I��;�;�D���� � ��2�7�7�3H�3H� �I�I�����R�V�V�}�%�#)�;�;�#5�#5�c�B�F�F�l�#C�C��y�� � �w�w�}�}�T�� ��'�'��'�'�"�"�2�7�7�<�<� �4�#@�*,�'�'�*?�*?�#�A�K� �w�w���;� �2�3�y�@�%�f�k�:�:��;�;�D����e�|����|�|�~������e�|��F�N�D��� ������6�<�<�>���'�v�.�.��6�;�;�� $�I�f����:�:�!�#�I�e���:�:�!�#�I�e���<�<�#�!%�I�g���<�<�#�!%�I�g���<�<�>�V�\�\�^��w�w�}�}�V�_�_�-�'��/�/����)�)�&�/�/�:�J��V�_�_�,�(2� �*�%��|�|�~� �g�g�l�l�9�+-�7�7�?�?�4�+@�+1�?�?�<��!�g�g�l�l�9�+1�?�?�<���'�'�*�*�;�24�'�'�2G�2G�+�I�K��w�w�!�!�;� �":�;�y�H�1�&�+�F�F��rFc��|Sr�r�)rjrks rDrrJs���MrFc�P�t||d�}|r|jdi|�ddi��S|S)NF�deepr��rpr��rjrkrms rDrrMs1��#�F�I�u�=�I���v�~�~�6� �6��6�6��MrFc�P�t||d�}|r|jdi|�ddi��S|S)NTrsFr�rtrus rDrrSs1��#�F�I�t�<�I���v�~�~�6� �6��6�6��MrF)� fully_trustedr�r1s([0-9]{1,20}) c�B�eZdZdZedTidd�dd�dd�dd �d d�dd �dd�dd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d%�d'd%��ZdUd(�Zed)��Zejd*��Zed+��Z e jd,��Z d-�Zeeeeeeeed.ed/� d0�Z d1�Zeed2fd3�Zd4�Zd5�Zd6�Zed7��Zd8�Zed9��Zed:��Zed;��Zed<��Zed=��Zed>��Zd?�Zd@�Z dA�Z!dB�Z"dC�Z#dD�Z$dE�Z%dF�Z&dG�Z'dH�Z(dI�Z)dJ�Z*dK�Z+dL�Z,dM�Z-dN�Z.dO�Z/dP�Z0dQ�Z1dR�Z2dS�Z3y%)VraInformational class which holds the details about an archive member given by a tar header block. TarInfo objects are returned by TarFile.getmember(), TarFile.getmembers() and TarFile.gettarinfo() and are usually created internally. r�zName of the archive member.r�zPermission bits.r3z6User ID of the user who originally stored this member.r4z7Group ID of the user who originally stored this member.r1zSize in bytes.r2zTime of last modification.�chksumzHeader checksum.�typez�File type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.r]zcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.r5z User name.r6zGroup name.�devmajorzDevice major number.�devminorzDevice minor number.rzThe tar header starts here.r:zThe file's data starts here.�pax_headerszMA dictionary containing key-value pairs of an associated pax extended header.r;zSparse member information.r=N�_sparse_structs�_link_targetc��||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_d|_d|_ d|_d|_d|_i|_y)zXConstruct a TarInfo object. name is the optional name of the member. i�rr�N)r�r�r3r4r1r2ry�REGTYPErzr]r5r6r{r|rr:r;r}�r�r�s rDr�zTarInfo.__init__�s}���� ��� ��������� ��� ������ ��� ��� ��� ��� ��� ������������rFc��|jS)z(In pax headers, "name" is called "path".�r�r�s rDr/zTarInfo.path�s���y�y�rFc��||_yr�r�r�s rDr/zTarInfo.path�s ���� rFc��|jS)z0In pax headers, "linkname" is called "linkpath".�r]r�s rDr0zTarInfo.linkpath�r'rFc��||_yr�r�)r�r]s rDr0zTarInfo.linkpath�s �� �� rFc�`�d|jj|jt|�fzS)Nz<%s %r at %#x>)r?r�r��idr�s rD�__repr__zTarInfo.__repr__�s&���4�>�>�#:�#:�4�9�9�R��X�"N�N�NrFT) r�r2r�r]r3r4r5r6rs�_KEEPc ��| rtj|�}ntj|�}|| ur||_|| ur||_|| ur||_|| ur||_|| ur||_|| ur||_|| ur||_|| ur||_ |S)zGReturn a deep copy of self with the given attributes replaced. ) �copy�deepcopyr�r2r�r]r3r4r5r6)r�r�r2r�r]r3r4r5r6rsr��results rDr�zTarInfo.replace�s�����]�]�4�(�F��Y�Y�t�_�F��u���F�K���� �F�L��u���F�K��5� �&�F�O��e���F�J��e���F�J���� �F�L���� �F�L�� rFc��|j�d}n|jdz}|j||j|j|j|j |j|j|j|j|j|j|jd� }|dtk(r!|djd�s |dxxdz cc<|S)z9Return the TarInfo's attributes as a dictionary. N�) r�r�r3r4r1r2ryrzr]r5r6r{r|rzr�rZ)r�r�r3r4r1r2ryrzr]r5r6r{r|�DIRTYPEr�)r�r��infos rD�get_infozTarInfo.get_info�s����9�9���D��9�9�v�%�D�� � ��������� � �� � ����� � �� � �� � �� � �� � �� � � �� ��<�7�"�4��<�+@�+@��+E���L�C��L��rF�surrogateescapec�.�|j�}|j�D]\}}|�� td|z��|tk(r|j |||�S|t k(r|j |||�S|tk(r|j||�Std��)z<Return a tar header as a string of 512 byte blocks. z%s may not be Nonezinvalid format) r��itemsr<r�create_ustar_headerr�create_gnu_headerr�create_pax_header)r�rbrBrCr�r��values rD�tobufz TarInfo.tobuf�s����}�}����:�:�<�K�D�%��}� �!5��!<�=�=�(��\�!��+�+�D�(�F�C�C� �z� !��)�)�$��&�A�A� �z� !��)�)�$��9�9��-�.�.rFc�,�t|d<t|dj||��tkDrt d��t|dj||��t kDr|j |d||�\|d<|d<|j|t||�S)z3Return the object as a ustar header block. �magicr]zlinkname is too longr��prefix) �POSIX_MAGICr>r=�LENGTH_LINKr<�LENGTH_NAME�_posix_split_name�_create_headerr)r�r�rBrCs rDr�zTarInfo.create_ustar_headers���$��W� ��t�J��&�&�x��8�9�K�G��3�4�4��t�F�|�"�"�8�V�4�5��C�+/�+A�+A�$�v�,�PX�Z`�+a�(�D��N�D��L��"�"�4��x��H�HrFc�Z�t|d<d}t|dj||��tkDr||j |dt ||�z }t|dj||��tkDr||j |dt||�z }||j|t||�zS)z:Return the object as a GNU header block sequence. r�rFr]r�) � GNU_MAGICr>r=r��_create_gnu_long_header�GNUTYPE_LONGLINKr��GNUTYPE_LONGNAMEr�r)r�r�rBrCrks rDr�zTarInfo.create_gnu_headers���"��W� ����t�J��&�&�x��8�9�K�G��4�/�/��Z�0@�BR�T\�^d�e�e�C��t�F�|�"�"�8�V�4�5��C��4�/�/��V��>N�PX�Z`�a�a�C��T�(�(��z�8�V�L�L�LrFc�\�t|d<|jj�}ddtfddtfddfD];\}}}||vr� ||jdd �t||�|kDs�4||||<�=d D]e\}}d}||} t| t�} | rt| �n| }d|cxkrd |dz zks nd||<d}n | r|||<d}|s�S||vs�Xt| �||<�g|r|j|t|�}nd}||j|tdd�zS#t$r||||<Y��wxYw)z�Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. r�r�r/r]r0)r5r5� )r6r6r�rRrS))r3rP)r4rP)r1�)r2r�FrrPr-TrFr�)r�r}r�r�r�r=�UnicodeEncodeErrorr>� isinstance�float�round�str�_create_pax_generic_header�XHDTYPEr�r) r�r�rBr}r��hnamerAra� needs_pax�val�val_is_float�val_intrks rDr�zTarInfo.create_pax_headers~�� $��W� ��&�&�+�+�-�� ���-� �J��/T�&�(>�$@��D�%����#�� ��T� �!�!�'�8�4� �4��:���'�%)�$�Z��E�"�!$@�(R�L�D�&��I��t�*�C�%�c�5�1�L�$0�e�C�j�c�G���3�!��� �"3�3���T� � � ��%��T� � � ��T��4�$'��H��D�!�%R�*��1�1�+�w��Q�C��C��T�(�(��|�W�i�P�P�P��G&� �%)�$�Z��E�"�� �s�D�D+�*D+c�0�|j|td�S)zAReturn the object as a pax global header block sequence. r:)r��XGLTYPE)�clsr}s rD�create_pax_global_headerz TarInfo.create_pax_global_headerWs���-�-�k�7�G�L�LrFc�R�|jd�}tdt|��D]t}dj|d|�}dj||d�}t|j ||��t ks�Nt|j ||��tks�q||fStd��)zUSplit a name longer than 100 chars into a prefix and a name part. rZr-Nzname is too long)�splitrVr>rr=� LENGTH_PREFIXr�r<)r�r�rBrC� componentsr[r�s rDr�zTarInfo._posix_split_name]s����Z�Z��_� ��q�#�j�/�*�A��X�X�j��!�n�-�F��8�8�J�q�r�N�+�D��6�=�=��6�2�3�}�D�����H�f�5�6�+�E���t�|��+��/�0�0rFc�h�|jd�ttfv}|r;t|jdd�d|�}t|jdd�d|�}nt dd||�}t dd||�}|jdt �}|�t d��t |jd d�d ||�t|jdd�dzd|�t|jd d�d|�t|jdd�d|�t|jdd�d|�t|jdd�d|�d|t |jdd�d ||�|jdt�t |jdd�d||�t |jdd�d||�||t |jdd�d||�g}tjdtzdj|��} t| td�d} | ddtd| zd�z| ddz} | S) z�Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. rzr{rrPr|r�NzTarInfo.type must not be Noner�rr�r�r3r4r1r�r2s r]r�r5r�r6r�rz%dsrFi����z%06orRi����)�get�CHRTYPE�BLKTYPErdrEr�r<r�rir�rrrnr^)r�rbrBrC�has_device_fieldsr{r|�filetype�partsrkrys rDr�zTarInfo._create_headerms�� !�H�H�V�,��'�0B�B����4�8�8�J��2�A�v�>�H��4�8�8�J��2�A�v�>�H��2�q�(�F�3�H��2�q�(�F�3�H��8�8�F�G�,�����<�=�=� ������$�c�8�V�<�������#�f�,�a��8�������"�A�v�.�������"�A�v�.�������#�R��0������!�$�b�&�1��������R�(�#�x��@��H�H�W�k�*������"�%�r�8�V�<������"�%�r�8�V�<��������2�&��X�v�>� ��$�k�k�%�)�+�S�X�X�e�_�=���c�9�*�+�.�/��2���%�4�j�5��F�!2�G�<�<�s�4�5�z�I��� rFc�n�tt|�t�\}}|dkDr|t|z tzz }|S)zdReturn the string payload filled with zero bytes up to the next 512 byte border. r)rsr>rr?)�payloadrzr{s rD�_create_payloadzTarInfo._create_payload�s9�� #�3�w�<��;��� ��q�=�� �I�-��4�4�G��rFc���|j||�tz}i}d|d<||d<t|�|d<t|d<|j |t ||�|j |�zS)zTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name. z ././@LongLinkr�rzr1r�)r=r?r>r�r�rr�)r�r�rzrBrCr�s rDr�zTarInfo._create_gnu_long_header�st�� �{�{�8�V�,�s�2����&��V����V���4�y��V��!��W� ��!�!�$��h��G��#�#�D�)�*� *rFc��d}|j�D]\}} |jdd��d}|r|dz }|j�D]�\}}|jd�}|r|j|d�}n|jd�}t|�t|�zdz}d x} } |tt | ��z} | | k(rn| } � |tt | �d �dz|zdz|zd zz }��i}d|d<||d<t|�|d<t|d<|j|td d�|j|�zS#t$rd}Y��wxYw)z�Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings. Fr:rSTrFs21 hdrcharset=BINARY r�rrrR� �=� z././@PaxHeaderr�rzr1r�r�) r�r=r�r>r�r^r�r�rr�)r�r}rzrB�binary�keywordr��records�lrZrKr�s rDr�z"TarInfo._create_pax_generic_header�s�����)�/�/�1�N�G�U� ����W�h�/�2�����0�0�G�)�/�/�1�N�G�U��n�n�W�-�G�����X�/@�A�����W�-���G��s�5�z�)�A�-�A��I�A�����C��F��O����6���� � �u�S��V�W�-��4�w�>��E��M�PU�U�U�G�!2�(��'��V����V���7�|��V��#��W� ��!�!�$��g�y�I��#�#�G�,�-� -��I&� ���� �s�D9�9E �E c�l�t|�dk(rtd��t|�tk7rtd��|j t �tk(rt d��t|dd�}|t|�vrtd��|�}t|dd||�|_t|dd �|_t|d d �|_ t|d d�|_t|dd�|_t|dd�|_||_|dd |_t|d d||�|_t|dd||�|_t|dd||�|_t|dd�|_t|dd�|_t|dd||�}|j$t0k(r&|jj3d�rt4|_|j$t6k(rxd}g}t9d�D]@} t|||dz�} t||dz|dz�}|j=| |f�|dz }�Bt?|d�}t|dd�} ||| f|_ |jC�r |jjEd�|_|r)|j$tFvr|dz|jz|_|S#t:$rY��wxYw)zAConstruct a TarInfo object from a 512 byte bytes object. rzempty headerztruncated headerzend of file header��zbad checksumr�l�t�|��ii i)iIiQiYi�rZi�r�r��i�i�i�)$r>r�rr��countr?r�r\rnrYrLr�r�r3r4r1r2ryrzr]r5r6r{r|�AREGTYPEr�r��GNUTYPE_SPARSErVr<r�boolr~rf�rstrip� GNU_TYPES)r�rkrBrCry�objr�r��structsr[r�numbytes� isextended�origsizes rD�frombufzTarInfo.frombuf�s����s�8�q�=�"�>�2�2��s�8�y� �&�'9�:�:��9�9�S�>�Y�&� �!5�6�6��S��S�\�"����c�*�*�$�^�4�4��e���s�1�S�z�8�V�4����s�3�s�|�$����c�#�c�l�#����c�#�c�l�#����s�3�s�|�$�����C���%�� ��� ��s�3�<����3�s�3�<��6�:�����C���h��7�� ���C���h��7�� ��3�s�3�<�(����3�s�3�<�(����S��S�\�8�V�4���8�8�x��C�H�H�$5�$5�c�$:��C�H� �8�8�~�%��C��G��1�X��� ��S��r��!2�3�F�"�3�s�R�x��b��#9�:�H������1�2��r� ����c�#�h��J��3�s�3�<�(�H�#*�J��"A�C���9�9�;��x�x���s�+�C�H��c�h�h�i�/���|�c�h�h�.�C�H�� ��"����s�$%J&�& J3�2J3c��|jjt�}|j||j|j �}|jj �tz |_|j|�S)zOReturn the next TarInfo object from TarFile object tarfile. ) r�rtrr�rBrCr�r�_proc_member)r�r=rkr�s rD�fromtarfilezTarInfo.fromtarfile$s^�� �o�o�"�"�9�-���k�k�#�w�/�/����@���_�_�)�)�+�i�7�� �����(�(rFc��|jttfvr|j|�S|jtk(r|j|�S|jtttfvr|j|�S|j|�S)zYChoose the right processing method depending on the type and call it. )rzr�r�� _proc_gnulongr��_proc_sparser�r��SOLARIS_XHDTYPE� _proc_pax� _proc_builtin)r�r=s rDr�zTarInfo._proc_member9sx���9�9�)�+;�<�<��%�%�g�.�.� �Y�Y�.� (��$�$�W�-�-� �Y�Y�7�G�_�=� =��>�>�'�*�*��%�%�g�.�.rFc��|jj�|_|j}|j�s|jt vr||j |j�z }||_|j|j|j|j�|j�r |jjd�|_|S)zfProcess a builtin type or an unknown type which will be treated as a regular file. rZ)r�r�r:rdrz�SUPPORTED_TYPES�_blockr1r�_apply_pax_infor}rBrCrfr�r�)r�r=rs rDr�zTarInfo._proc_builtinFs���#�?�?�/�/�1����!�!���:�:�<�4�9�9�O�;��d�k�k�$�)�)�,�,�F���� ���W�0�0�'�2B�2B�G�N�N�S��:�:�<�� � �(�(��-�D�I��rFc�F�|jj|j|j��} |j |�}|j|_|jtk(r't||j|j�|_n9|jtk(r&t||j|j�|_|j#�r |jj%d�|_|S#t $r}t t|��d�d}~wwxYw)zSProcess the blocks that hold a GNU longname or longlink member. NrZ)r�rtr�r1r�rr�r�rrzr�rLrBrCr�r�r]rf�removesuffix)r�r=rk�nextrs rDr�zTarInfo._proc_gnulong\s����o�o�"�"�4�;�;�t�y�y�#9�:�� :��#�#�G�,�D��k�k����9�9�(�(��C��!1�!1�7�>�>�B�D�I� �Y�Y�*� *���W�%5�%5�w�~�~�F�D�M��:�:�<�� � �.�.�s�3�D�I����!� :�'��A��/�T�9�� :�s�C=�= D �D�D c� �|j\}}}|`|r�|jjt�}d}t d�D]D} t|||dz�}t||dz|dz�} |r| r|j|| f�|dz }�Ft|d�}|r��||_ |jj�|_|j|j|j�z|_||_ |S#t$rY�ywxYw)z8Process a GNU sparse header plus extra headers. r�r�r�i�)r~r�rtrrVr\r<rr�r;r�r:r�r1r) r�r=r�r�r�rkr�r[rr�s rDr�zTarInfo._proc_sparsews ��)-�(<�(<�%���X�� ���/�/�&�&�y�1�C��C��2�Y��� ��S��r��!2�3�F�"�3�s�R�x��b��#9�:�H��h��N�N�F�H�#5�6��r� ����c�#�h��J�����"�?�?�/�/�1����)�)�D�K�K�� � �,B�B����� ����"����s�%C5�5 D�Dc��|jj|j|j��}|jt k(r |j}n|jj�}d}d}g}t|�|kD�r||dk7�rtj||�x}std�� t|jd��}|dkrtd��||zt|�kDrtd��|jd�|zdz } ||j!d�dz| } | j#d�\}}} |r |dk7s|| dk7rtd��|j%||| f�|dk(r|�| d k(r |j&}nd }||z }t|�|kDr ||dk7r��|�d }|D]x\}}} |j)|d d |j*�}|t,vr)|j)| ||j&|j*�}n|j)| d d |j*�}|||<�z |j/|�}d|vr|j7||�nRd|vr|j9||�n;|j;d �dk(r'|j;d�dk(r|j=|||�|jt>t@fvr�|jC||j&|j*�|jD|_"d|vrS|jF}|jI�s|jtJvr||j|j�z }||_"|S#t$rtd��wxYw#t0$r}t3t5|��d�d}~wwxYw)zVProcess an extended or global header as described in POSIX.1-2008. rNrUr-�r�rs hdrcharsetsBINARYr:�GNU.sparse.map�GNU.sparse.sizezGNU.sparse.major�1zGNU.sparse.minorrTr1)&r�rtr�r1rzr�r}r�r>�_header_length_prefix_re�matchrYrW�groupr<r2r�� partitionrrB�_decode_pax_fieldrC�PAX_NAME_FIELDSr�rr�r��_proc_gnusparse_01�_proc_gnusparse_00r��_proc_gnusparse_10r�r�r�rr:rdr�)r�r=rkr}r�rB�raw_headersrrA�header_value_end_offset�keyword_and_value�raw_keyword�equals� raw_valuer�r�r�rrs rDr�zTarInfo._proc_pax�s��� �o�o�"�"�4�;�;�t�y�y�#9�:�� �9�9���!�-�-�K�!�-�-�2�2�4�K��������#�h��n��S��T�!1�5�;�;�C��E�E�E�E�(�)9�:�:� ;��U�[�[��^�,�� ��z�(�)9�:�:��V�|�c�#�h�&�(�)9�:�:�&+�k�k�!�n�v�&=��&A�#� #�E�I�I�a�L�1�$4�5L� M��->�-H�-H��-N�*�K����&�D�.�C�8O�4P�TX�4X�(�)9�:�:������Y�?�@��m�+��0@�� �)�&�/�/�H�&�H��6�M�C�M�#�h��n��S��T�!1�R���H�/:�*�F�K���,�,�[�'�7��N�N�$�G��/�)��.�.�y�(�G�DT�DT����(���.�.�y�'�7����(��$)�K�� �#/:�( :��#�#�G�,�D� �{�*��#�#�D�+�6� �+� -��#�#�D�+�6� �_�_�/� 0�C� 7�K�O�O�L^�<_�cf�<f��#�#�D�+�w�?��9�9��/�2�2�� � ��g�.>�.>����O��+�+�D�K���$��)�)���:�:�<�4�9�9�O�#C��d�k�k�$�)�)�4�4�F�!'������y� ;�(�)9�:�:� ;��|� :�'��A��/�T�9�� :�s$�1M�"M�M� N�&M;�;Nc�r�g}g}|D]d\}}}|dk(r* |jt|j����6|dk(s�< |jt|j����ftt ||��|_y#t$rt d��wxYw#t$rt d��wxYw)z?Process a GNU tar extended sparse header, version 0.0. sGNU.sparse.offsetrUsGNU.sparse.numbytesN)rrWrJr<rY�list�zipr;)r�r�r �offsetsr��_r�r�s rDrzTarInfo._proc_gnusparse_00s�������!,��A�w���.�.�?��N�N�3�u�|�|�~�#6�7��2�2�?��O�O�C�����$7�8�"-��3�w��1�2����"�?�,�-=�>�>�?��"�?�,�-=�>�>�?�s�(B �(B!� B�!B6c ��|djd�D�cgc] }t|���}}tt|ddd�|ddd���|_ycc}w)z?Process a GNU tar extended sparse header, version 0.1. r��,Nr.r-)r�rWrrr;)r�r�r}�xr;s rDrzTarInfo._proc_gnusparse_01 sZ��#.�.>�"?�"E�"E�c�"J�K�"J�Q�#�a�&�"J��K��3�v�c��c�{�F�1�4�a�4�L�9�:����Ls�Ac ��d}g}|jjt�}|jdd�\}}t |�}t|�|dzkrgd|vr"||jjt�z }|jdd�\}}|j t |��t|�|dzkr�g|jj�|_tt|ddd�|ddd���|_y)z?Process a GNU tar extended sparse header, version 1.0. Nr�r-r.)r�rtrr�rWr>rr�r:rrr;)r�r�r}r=�fieldsr;rk�numbers rDr zTarInfo._proc_gnusparse_10&s��������o�o�"�"�9�-���i�i��q�)�����V����&�k�F�Q�J�&��C���w���+�+�I�6�6���)�)�E�1�-�K�F�C��M�M�#�f�+�&� �&�k�F�Q�J�&� #�?�?�/�/�1����3�v�c��c�{�F�1�4�a�4�L�9�:��rFc��|j�D]�\}}|dk(rt|d|��|dk(rt|dt|���5|dk(rt|dt|���Q|tvs�Z|tvr t ||�}|dk(r|j d�}t|||���|j�|_y#t $rd}Y�HwxYw) zoReplace fields with supplemental information from a previous pax extended or global header. zGNU.sparse.namer/r�r1zGNU.sparse.realsizerrZN) r��setattrrW� PAX_FIELDS�PAX_NUMBER_FIELDSr<r�r�r})r�r}rBrCr�r�s rDr�zTarInfo._apply_pax_info6s���*�/�/�1�N�G�U��+�+���f�e�,��-�-���f�c�%�j�1��1�1���f�c�%�j�1��J�&��/�/�"� 1�'� :�5� A���f�$�!�L�L��-�E���g�u�-�2�"'�+�+�-���� &�"� !��"�s�4B=�=C� Cc�j� |j|d�S#t$r|j||�cYSwxYw)z1Decode a single field from a pax record. rS)rJ�UnicodeDecodeError)r�r�rB�fallback_encoding�fallback_errorss rDrzTarInfo._decode_pax_fieldMs<�� D��<�<��(�3�3��!� D��<�<� 1�?�C�C� D�s��2�2c�h�|dkrtd��t|t�\}}|r|dz }|tzS)z_Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. rzinvalid offsetr-)rYrsr)r�r�rzr{s rDr�zTarInfo._blockUs?�� �1�9�$�%5�6�6�"�5�)�4��� ���a�K�F�� �!�!rFc�&�|jtvS�z4Return True if the Tarinfo object is a regular file.)rz� REGULAR_TYPESr�s rDrdz TarInfo.isregas���y�y�M�)�)rFc�"�|j�Sr%)rdr�s rD�isfilezTarInfo.isfilees���z�z�|�rFc�(�|jtk(S)z!Return True if it is a directory.)rzr�r�s rDrfz TarInfo.isdiri����y�y�G�#�#rFc�(�|jtk(S)z%Return True if it is a symbolic link.)rz�SYMTYPEr�s rDrgz TarInfo.issymmr*rFc�(�|jtk(S)z!Return True if it is a hard link.)rz�LNKTYPEr�s rDrez TarInfo.islnkqr*rFc�(�|jtk(S)z(Return True if it is a character device.)rzr�r�s rD�ischrz TarInfo.ischrur*rFc�(�|jtk(S)z$Return True if it is a block device.)rzr�r�s rD�isblkz TarInfo.isblkyr*rFc�(�|jtk(S)zReturn True if it is a FIFO.)rz�FIFOTYPEr�s rD�isfifozTarInfo.isfifo}s���y�y�H�$�$rFc��|jduSr�)r;r�s rD�issparsezTarInfo.issparse�s���{�{�$�&�&rFc�<�|jtttfvS)zCReturn True if it is one of character device, block device or FIFO.)rzr�r�r4r�s rD�isdevz TarInfo.isdev�s���y�y�W�g�x�8�8�8rFr�)r�)4r�r�r�r��dict� __slots__r��propertyr/�setterr0r�r�r�r�rr r�r�r�r��classmethodr�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�rrr r�rr�rdr(rfrgrer0r2r5r7r9r�rFrDrris����� �,� �!� �G� �H� � � �-� �$� �>� �F� �� �� �*� � *�! �"/�# �$5�% �&9�' �*.�+ �,�- �.�/ �0�1 �I�6�0���� �[�[���������_�_�!��!�O��%�e�e��u�E�����8�8*�H�EV�/�"I�M�8Q�t�M��M� � �'��'�R�����*��*� �0-��0-�d�<��<�|�)��)�(/��,�6�8w�r3�(;�;� .�.D� "�*��$�$�$�$�$�%�'�9rFrc���eZdZdZdZdZdZdZeZ e ZdZe ZeZdZ d;d�Zedddefd��Zed<d ��Zed=d ��Zed=d��Zed>d��Zd dddd�Zd�Zd�Zd�Zd�Zd?d�Zd@dd�d�Z dAdd�d�Z!dBd�Z"d�Z#dCddd�d�Z$d�Z%dDddd�d �Z&d!�Z' dBd"�Z(d#�Z)d$�Z*d%�Z+ dEddd&�d'�Z,d(�Z-d)�Z.d*�Z/d+�Z0d,�Z1d-�Z2d.�Z3d/�Z4d0�Z5d1�Z6d2�Z7dFd3�Z8d4�Z9dBd5�Z:d6�Z;d7�Z<d8�Z=d9�Z>d:�Z?y)Grz=The TarFile Class provides an interface to tar archives. rFr-Nr�c���ddddd�}||vrtd��||_|||_|sZ|jdk(r-tjj|�sd|_d|_t ||j�}d |_n^|�8t|d�r,t|jttf�r|j}t|d�r|j|_d |_|rtjj|�nd |_ ||_|�||_|�||_|�||_|�||_|�||_| |_| �|jt*k(r| |_ni|_|�||_|�||_| |_d |_g|_d |_|jj;�|_i|_ |jdk(rd |_ |jC�|_ |jdk(r^ |jjE|j<� |j jG|�}|j6jI|��]|jdvr�d |_|j,rm|j jQ|j,jS��}|jjU|�|xj<tW|�z c_y y y #tJ$r(|jjE|j<�Y��tL$r}tOt|��d �d }~wwxYw#|js|jjY�d |_�xYw)a�Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. �rbzr+b�wb�xb�r��ar�r�!mode must be 'r', 'a', 'w' or 'x'rFr�FNr�r�Tr��rFr�r)-r<r��_moder�r/�exists� bltn_openr�r�r�r�r�r^�abspathr�rbr>�dereference�ignore_zerosrBrCrr}�debug� errorlevel�copybufsizer��members�_loadedr�r�inodes�firstmemberr�r�r�rr�rrr�r�rur>r�)r�r�r�r�rbr>rMrNrBrCr}rOrPrQ�modesrrks rDr�zTarFile.__init__�s�����T��=���u���@�A�A��� ��4�[�� ���y�y�C�������t�(<��� �!�� ���d�j�j�1�G�$�D������&�!9��7�<�<�#�u��6��|�|���w��'�$�\�\�� �#�D��-1�B�G�G�O�O�D�)�t�� ������ �D�K���"�D�L��"�*�D���#� ,�D����$�D�M�����"�t�{�{�j�'@�*�D��!�D�����D�J��!�(�D�O�'�������������l�l�'�'�)������ ��y�y�C��#'�� �#'�9�9�;�� ��y�y�C����L�L�%�%�d�k�k�2�:�"&�,�,�":�":�4�"@�����+�+�G�4� ��y�y�O�+�#����#�#��,�,�?�?��@P�@P�@U�@U�@W�X�C��L�L�&�&�s�+��K�K�3�s�8�+�K�$�,�� *�����)�)�$�+�+�6��&�:�'��A��/�T�9��:�� ��#�#����"�"�$��D�K��s>�>A L;�6K&�BL;�&.L8�L;�L8�L3�3L8�8L;�;0M+c����|s |std��|dvrz�fd�}g}t�j|��D]:}t��j|�} |�|j �} | |d|fi|��cSd j|�}td |����d|vrb|jdd�\} }| xsd} |xsd }|�jvrt��j|�} nt d|z��| || |fi|��Sd|vrg|jdd�\} }| xsd} |xsd }| dvrtd��|jdd�}t|| ||||�} �|| |fi|��}d|_|S|dvr�j|||fi|��Std��#t tf$r5}|jd|�d|���|�|j �Yd}~���d}~wwxYw#|j��xYw)a�Open a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'r:xz' open for reading with lzma compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'w:xz' open for writing with lzma compression 'x' or 'x:' create a tarfile exclusively without compression, raise an exception if the file is already created 'x:gz' create a gzip compressed tarfile, raise an exception if the file is already created 'x:bz2' create a bzip2 compressed tarfile, raise an exception if the file is already created 'x:xz' create an lzma compressed tarfile, raise an exception if the file is already created 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'r|xz' open an lzma compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing 'w|xz' open an lzma compressed stream for writing znothing to open)r��r:*c�(���j|dk(S)N�taropen)� OPEN_METH)r�r�s �rD�not_compressedz$TarFile.open.<locals>.not_compressed>s����}�}�X�.�)�;�;rF)�keyNr�z - method z: � z'file could not be opened successfully: �:r-r�r��|r�zmode must be 'r' or 'w'r�� FrHzundiscernible mode)r<�sortedr[r�r�rr rr�rr��popr�r�r�rZ)r�r�r�r�ry�kwargsr\� error_msgsr��func� saved_posr�error_msgs_summary�filemoder��streamrs` rDrzTarFile.opens5���J�G��.�/�/��<�� <��J�"�3�=�=�n�E���s�C�M�M�(�$;�<���&� '����I����c�7�=�f�=�=�F�"&���:�!6���F�GY�FZ�[�\�\� �D�[�!%���C��!3��H�h���3�H��(�5�H��3�=�=�(��s�C�M�M�(�$;�<��&�'D�x�'O�P�P���h��:�6�:�:� �D�[�!%���C��!3��H�h���3�H��(�5�H��z�)� �!:�;�;�"�J�J���:�M��T�8�X�w��*�,�F� ���h��9�&�9��"�A�M��H� �_� $��3�;�;�t�T�7�=�f�=�=��-�.�.��W"�#3�4���%�%� �(��2�a�U�&C�D��*����Y�/��� ��D ������s$�" F�G�G�*G�G�Gc�6�|dvrtd��||||fi|��S)zCOpen uncompressed tar archive name for reading or writing. rErG)r<)r�r�r�r�rds rDrZzTarFile.taropents-���+�+��@�A�A��4��w�1�&�1�1rFc��|dvrtd�� ddlm} |||dz||�} |j|||fi|��}d |_ |S#t$r t d�d�wxYw#t $r}|�|dk(rt d �|��d}~wwxYw#t $r'}|j�|dk(rt d �|��d}~w|j��xYw)zkOpen gzip compressed tar archive name for reading or writing. Appending is not allowed. �r�r�r�mode must be 'r', 'w' or 'x'r)�GzipFilezgzip module is not availableNr|r�r�F) r<�gzipror�r r�rrZr�r�) r�r�r�r�r�rdrorrs rD�gzopenzTarFile.gzopen|s��� ��&��;�<�<� M�%� ��t�T�C�Z���H�G� �����D�$��:�6�:�A��� ����+� M�"�#A�B��L� M�� � ��"�t�s�{�� 1�2��9��� ��� ��M�M�O��s�{�� 1�2��9��� ��M�M�O��s9�A�A�B�A� B�'A;�;B� C�"B.�.Cc�P�|dvrtd�� ddlm}||xs|||��} |j |||fi|��}d |_ |S#t$r t d�d�wxYw#ttf$r'}|j�|dk(rtd �|��d}~w|j��xYw)zlOpen bzip2 compressed tar archive name for reading or writing. Appending is not allowed. rmrnr)�BZ2Filer�N)r�r�znot a bzip2 fileF)r<r�rsr�r rZr��EOFErrorr�rr�) r�r�r�r�r�rdrsrrs rD�bz2openzTarFile.bz2open�s��� ��&��;�<�<� L�#��'�/�T�4�}�M�� �����D�$��:�6�:�A��� ����!� L�"�#@�A�t�K� L����"� ��M�M�O��s�{�� 2�3��:��� ��M�M�O��s"�A�A�A�B%�-"B�B%c�L�|dvrtd�� ddlm}m}||xs|||��} |j|||fi|��}d |_ |S#t$r td�d�wxYw#|tf$r'} |j�|dk(rtd �| ��d} ~ w|j��xYw)zkOpen lzma compressed tar archive name for reading or writing. Appending is not allowed. rmrnr)�LZMAFiler�r�N)�presetr�znot an lzma fileF)r<r�rwr�r�r rZrtr�rr�) r�r�r�r�rxrdrwr�rrs rD�xzopenzTarFile.xzopen�s��� ��&��;�<�<� M�0��7�?�d�D��@�� �����D�$��:�6�:�A��� ����!� M�"�#A�B��L� M���8�$� ��M�M�O��s�{�� 2�3��:��� ��M�M�O��s"�A�A �A� B#�+"B � B#rZrqrury)r�r�r�r�c��|jryd|_ |jdvr�|jjtt dzz�|xjt dzz c_t|jt�\}}|dkDr)|jjtt|z z�|js|jj�yy#|js|jj�wwxYw)zlClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NTrHr.r)r�r�r�rur?rrrs� RECORDSIZEr�r�)r�rzr{s rDr�z TarFile.close�s����;�;����� %��y�y�O�+����"�"�3�)�a�-�#8�9���� �A� �.��%+�4�;�;� �$C�!�� ��q�=��L�L�&�&�s�j�9�.D�'E�F��#�#����"�"�$�$��4�#�#����"�"�$�$�s�BC�)Dc�f�|j|jd��}|�td|z��|S)aReturn a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. rZzfilename %r not found)� _getmemberr��KeyError)r�r�r>s rD� getmemberzTarFile.getmember�s6���/�/�$�+�+�c�"2�3���?��2�T�9�:�:��rFc�r�|j�|js|j�|jS)z�Return the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. )�_checkrS�_loadrRr�s rD� getmemberszTarFile.getmemberss'�� ��� ��|�|��J�J�L��|�|�rFc�\�|j�D�cgc]}|j��c}Scc}w)z�Return the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). )r�r�)r�r>s rD�getnameszTarFile.getnames s)��-1�O�O�,=�>�,=�����,=�>�>��>s�)c�.�|jd�|�|j}|�|}tjj |�\}}|jtjd�}|jd�}|j�}||_ |�8|jstj|�}n9tj|�}n#tj|j��}d}|j}tj |�r�|j"|j$f} |jsE|j&dkDr6| |j(vr(||j(| k7rt*} |j(| }n�t,} | dr�||j(| <n�tj.|�rt0} n�tj2|�rt4} njtj6|�rt8} tj:|�}n9tj<|�rt>} ntj@|�rtB} ny||_||_"|jF|_$|jJ|_&| t,k(r|jN|_(nd|_(|jR|_*| |_+||_,tZr( t[j\|jH�d|_/tbr( tcjd|jL�d|_3| t>tBfvrhtitd�rXtitd�rHtjj|jl�|_7tjp|jl�|_9|S#t`$rY��wxYw#t`$rY��wxYw) a�Create a TarInfo object from the result of os.stat or equivalent on an existing file. The file is either named by `name', or specified as a file object `fileobj' with a file descriptor. If given, `arcname' specifies an alternative name for the file in the archive, otherwise, the name is taken from the 'name' attribute of 'fileobj', or the 'name' argument. The name should be a text string. �awxNrZr�r-r�major�minor):r�r�r�r/� splitdriver�r`rar>r=rM�lstat�stat�fstat�fileno�st_mode�S_ISREG�st_ino�st_dev�st_nlinkrTr.r��S_ISDIRr��S_ISFIFOr4�S_ISLNKr,�readlink�S_ISCHRr��S_ISBLKr�r��st_uidr3�st_gidr4�st_sizer1�st_mtimer2rzr]�pwd�getpwuidr5r~�grp�getgrgidr6r�r��st_rdevr{r�r|)r�r��arcnamer��drvr>�statresr]�stmd�inoderzs rD� gettarinfozTarFile.gettarinfos��� ���E�����<�<�D� �?��G��w�w�)�)�'�2���W��/�/�"�&�&�#�.���.�.��%���,�,�.������?��#�#��(�(�4�.���'�'�$�-���h�h�w�~�~�/�0�G��������<�<����^�^�W�^�^�4�E��#�#��(8�(8�1�(<��T�[�[�(�W����E�8J�-J����;�;�u�-������8�)0�D�K�K��&� �\�\�$� ��D� �]�]�4� ��D� �\�\�$� ��D��{�{�4�(�H� �\�\�$� ��D� �\�\�$� ��D���������n�n����n�n����7�?�"�?�?�G�L��G�L��(�(�� ����#���� � #���W�[�[� 9�!� <�� �� � #���W�[�[� 9�!� <�� ��G�W�%�%��r�7�#���G�(<�#%�8�8�G�O�O�#<�� �#%�8�8�G�O�O�#<�� ����� �� �� � �� �s$�,'M9�'N�9 N�N� N�N)rRc��|j�|�|}|D�]�}|�r&|j�td�n(ttj|j��t|j xs|j�d|jxs|j���|j�s|j�r(tdd|j|jfzz�ntd|jz�|j�td�n.tdtj |j�dd z�t|j"|j%�rdnd z�|rP|j'�rtd|j(z�|j+�rtd|j(z�t-����y) aPrint a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. `members' is optional and must be a subset of the list returned by getmembers(). Nz ??????????rZz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02dr�r�z-> zlink to )r�r�r�r�rir5r3r6r4r0r2r{r|r1r2r�� localtimer�rfrgr]rer�)r��verboserRr>s rDrzTarFile.listssf�� ��� ��?��G��G���<�<�'���-��� � �g�l�l� ;�<��w�}�}�'C����'C�'.�}�}�'C����'C�E�F��=�=�?�g�m�m�o���$��(8�(8�'�:J�:J�'K�K�!M�N� ����� 5�6��=�=�(�� 5�6�� =�"&�.�.����"?���"C�!D�E� ����w�}�}���B�G�H���=�=�?����(8�(8� 8�9��=�=�?�� �W�-=�-=� =�>��G�5rF��filterc�b�|jd�|�|}|j�Btjj |�|jk(r|jdd|z�y|jd|�|j ||�}|�|jdd|z�y|� ||�}|�|jdd|z�y|j�r(t|d�5}|j||�ddd�y|j�r�|j|�|ruttj|��D]S}|jtjj||�tjj||�||� ��Uyy|j|�y#1swYyxYw) a!Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. r�Nr.ztarfile: Skipped %rr-ztarfile: Unsupported type %r�tarfile: Excluded %rrBr�)r�r�r�r/rL�_dbgr�rdrK�addfilerfrb�listdir�addr)r�r�r�� recursiver�r>�fs rDr�zTarFile.add�sq�� ���E���?��G��9�9� �R�W�W�_�_�T�%:�d�i�i�%G��I�I�a�.��5�6��� � �!�T���/�/�$��0���?��I�I�a�7�$�>�?�����W�o�G���� � �!�3�d�:�;���=�=�?��4��&�!����W�a�(�'�&��]�]�_��L�L��!���� � �4� 0�1�A��H�H�R�W�W�\�\�$��2�B�G�G�L�L��!�4L�%�f��6�2�� �L�L��!�'�&�s�F%�%F.c��|jd�tj|�}|j|j|j|j �}|jj|�|xjt|�z c_|j}|��t||j|j|��t|jt�\}}|dkDr.|jjtt|z z�|dz }|xj|tzz c_|j j#|�y)aAdd the TarInfo object `tarinfo' to the archive. If `fileobj' is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo(). r�N)ryrr-)r�r�r�rbrBrCr�rurr>rQrrr1rsrr?rRr)r�r>r�rkryrzr{s rDr�zTarFile.addfile�s��� ���E���)�)�G�$���m�m�D�K�K�������D�������3�����s�3�x���� � ���������w�|�|�W�M� &�w�|�|�Y� ?��F�I��1�}����"�"�3�)�i�*?�#@�A��!����K�K�6�I�-�-�K������G�$rFc��|��|j}|��tjjd�}|�W t t �}ddl}|jdd��}|5|j|�ddd�|jddd��}|r t|}||_|Str"tjd t d��t"St$St'|t(�rt+d ��|St-|�r|S t|S#1swY��xYw#t$rY��wxYw#t$rtd|�d ��d�wxYw#t$rtd|�d ��d�wxYw)N� PYTHON_TARFILE_EXTRACTION_FILTERr)�#)� interpolation�comment_prefixesr=r�)�fallbackzfilter z not foundaThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.r)� stacklevelzrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.)�extraction_filterr��environr�rK�_CONFIG_FILENAME�configparser�ConfigParser� read_file�FileNotFoundError�_NAMED_FILTERSr~r<�_RH_SAFER_DEFAULT�warnings�warn�RuntimeWarningrrr�r�� TypeError�callable)r�r�r��filer��confs rD�_get_filter_functionzTarFile._get_filter_function�s����>��+�+�F��~��z�z�~�~�&H�I���<�5�(�)9�:��,�+�8�8�*.�-4� 9� ��"� �N�N�4�0�"�#�x�x� �(J�13� (� 5���S�!/��!5��.4�D�*�!�M�$��M�M�.�'�1�6�&�%�+�+��&�#�&��6�7�7��M��F���M� G�!�&�)�)�C"�T��-����� $�S�(�7�6�*�J�)G�H�d�R�S��4� G��w�v�j� �;�<�$�F� G�s5�D�D� D�7D8�D � D�D�D5�8E)� numeric_ownerr�c��g}|j|�}|�|}|D]a}|j|||�\}} |��|j�r|j| �|j |||j�||���c|jd�d��|D]�} || |�}|�|j| d��#tjj||j�} tj|�}tj |j"�s|j|d���|j%|||� �|j'||�|j)||���y#t$r%} |j| t| ��Yd} ~ ��d} ~ wwxYw#t$r|j|d�Y��wxYw#t*$r} |j-| �Yd} ~ ��Cd} ~ wwxYw) a�Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). If `numeric_owner` is True, only the numbers for user/group names are used and not the names. The `filter` function will be called on each member just before extraction. It can return a changed TarInfo or None to skip the member. String names of common filters are accepted. N)� set_attrsr��filter_functionc��|jSr�r�)rFs rD�<lambda>z$TarFile.extractall.<locals>.<lambda>= s��q�v�vrFT)r]�reversezexcluded by filter�missingznot a directory)r�)r��_get_extract_tarinforfr�_extract_one�sort�_FILTER_ERRORS�_log_no_directory_fixup�reprr�r/rr�r�r�r�r�r��chown�utime�chmodr�_handle_nonfatal_error)r�r/rRr�r��directoriesr�rjr>� unfiltered�exc�dirpathr�rs rD� extractallzTarFile.extractall s������3�3�F�;���?��G��F�"&�";�";����#/��G�Z�����}�}���"�"�:�.����g�t�7�=�=�?�7J�,9�.=� � ?�� ���-�t��<�&�J� /��-�j�$�?�G��?��0�0��1E�G���'�'�,�,�t�W�\�\�:����H�H�W�-�E��|�|�E�M�M�2��0�0��:K�L��� � �7�G�=� �I�� � �7�G�,�� � �7�G�,�5&��&���0�0��T�#�Y�G�����)���0�0��)�D���� � /��+�+�A�.�.�� /�sl� E$�"F7�7*F7�"F�71F7�)8F7�$ F�-F �F7� F�F7�F4�0F7�3F4�4F7�7 G�G�Gc�J�|jdd|j�d|�d��y)Nr.z!tarfile: Not fixing up directory z (�))r�r�)r�rj�reasons rDr�zTarFile._log_no_directory_fixup_ s��� � �!��;�;��(� )rFc��|j|�}|j|||�\}}|�|j||||�yy)a�Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mtime, mode) are set unless `set_attrs' is False. If `numeric_owner` is True, only the numbers for user/group names are used and not the names. The `filter` function will be called before extraction. It can return a changed TarInfo or None to skip the member. String names of common filters are accepted. N)r�r�r�) r�rjr/r�r�r�r�r>r�s rD�extractzTarFile.extractc sO���3�3�F�;��"�7�7��O�T�+���������g�t�Y� �F�rFc���t|t�r|j|�}n|}d} |||�}|� |jdd|jz�y|j�rDtj|�}tjj||j�|_||fS#ttf$r}|j|�Yd}~��d}~wt$r}|j|�Yd}~��d}~wwxYw)z�Get (filtered, unfiltered) TarInfos from *member* *member* might be a string. Return (None, None) if not found. Nr.r�)NN)r�r�rr�r�_handle_fatal_errorrr�r�r�rer�r�r/rr]r)r�rjr�r/r��filteredrs rDr�zTarFile._get_extract_tarinfow s����f�c�"�����/�J��J��� +�&�z�4�8�H� ���I�I�a�/�*�/�/�A�B���>�>���y�y��*�H�$&�G�G�L�L��x�7H�7H�$I�H�!���#�#����%� (��$�$�Q�'�'��� +��'�'��*�*�� +�s#� B+�+C7�:C�C7�C2�2C7c�8�|jd� |j|tjj ||j �||||��y#t$r}|j|�Yd}~yd}~wt$r}|j|�Yd}~yd}~wwxYw)z�Extract from filtered tarinfo to disk. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) r�)r�r�r��extraction_rootN) r��_extract_memberr�r/rr�r�r�rr�)r�r>r/r�r�r�rs rDr�zTarFile._extract_one� s��� ���C�� +�� � ��"�'�'�,�,�t�W�\�\�*J�+4�/<�1@�15� !� 7�� � (��$�$�Q�'�'��� +��'�'��*�*�� +�s#�?A� B�A2�2B�>B�Bc�N�|jdkDr�|jdd|z�y)z=Handle non-fatal error (ExtractError) according to errorlevelr-�tarfile: %sN)rPr��r�rs rDr�zTarFile._handle_nonfatal_error� s$���?�?�Q����I�I�a���*�+rFc�L�|jdkDr�t|t�rY|j� |j dd|j z�y|j dd|j �d|j���y|j ddt |�j�d|���y)z1Handle "fatal" error according to self.errorlevelrNr-r�z tarfile: r)rPr�r��filenamer��strerrorrzr�r�s rDr�zTarFile._handle_fatal_error� st���?�?�Q��� ��7� #��z�z�!�� � �!�]�Q�Z�Z�7�8�� � �!����Q�Z�Z�H�I��I�I�a�T�!�W�-=�-=�q�A�BrFc��|jd�t|t�r|j|�}n|}|j �s|j tvr|j||�S|j�s|j�rEt|jt�rtd��|j|j|��Sy)a\Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file or a link, an io.BufferedReader object is returned. For all other existing members, None is returned. If `member' does not appear in the archive, KeyError is raised. r�z'cannot extract (sym)link as file objectN)r�r�r�rrdrzr�� fileobjectrergr�r�r �extractfile�_find_link_target)r�rjr>s rDr�zTarFile.extractfile� s��� ���C���f�c�"��n�n�V�,�G��G��=�=�?�g�l�l�/�A��?�?�4��1�1� �]�]�_�� � ���$�,�,��0�"�"K�L�L��'�'��(>�(>�w�(G�H�H�rF�r�r�c��|jd�}|jdtj�}tjj|�}|r4tjj |�stj|�|j�s|j�r,|jd|j�d|j���n|jd|j�|j�r|j||�n�|j�r|j!||�n�|j#�r|j%||�n�|j'�s|j)�r|j+||�nm|j�s|j�r|j-||||��n7|j.t0vr|j3||�n|j||�|rI|j5|||�|j�s%|j7||�|j9||�yyy)z�Extract the filtered TarInfo object tarinfo to a physical file called targetpath. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) rZr-z -> r�N)r�r�r�r`r/rirJ�makedirsrergr�r�r]rd�makefilerf�makedirr5�makefifor0r2�makedev�makelink_with_filterrzr��makeunknownr�r�r�)r�r>� targetpathr�r�r�r�� upperdirss rDr�zTarFile._extract_member� s��� �&�&�s�+� ��'�'��R�V�V�4� ��G�G�O�O�J�/� ��R�W�W�^�^�I�6� �K�K� �"��=�=�?�g�m�m�o��I�I�a�w�|�|�W�5E�5E�F�G��I�I�a����&��=�=�?��M�M�'�:�.� �]�]�_��L�L��*�-� �^�^� ��M�M�'�:�.� �]�]�_�� � ���L�L��*�-� �]�]�_�� � ���%�%��� /� /� &� 1��\�\�� 0����W�j�1��M�M�'�:�.���J�J�w� �M�:��=�=�?�� � �7�J�/�� � �7�J�/�#�rFc��� |j�tj|�ytj|d�y#t$r#tjj|�s�YywxYw)z,Make a directory called targetpath. Ni�)r�r��mkdir�FileExistsErrorr/rf�r�r>rs rDr�zTarFile.makedir sT�� ��|�|�#�����$�����U�+��� ��7�7�=�=��,��-� �s�!;�;�)A'�&A'c ���|j}|j|j�|j}t |d�5}|j �d|j D])\}}|j|�t |||t|��+|j|j�|j�nt |||jt|�ddd�y#1swYyxYw)z'Make a file called targetpath. rCN) r�r�r:rQrKr;rrrr1�truncate)r�r>r�sourcery�targetrr1s rDr�zTarFile.makefile# s����������G�'�'�(��"�"�� �z�4� (�F��~�~�)�$+�N�N�L�F�D��K�K��'�����i��I�%3����G�L�L�)����!��F�F�G�L�L�)�W�M�)� (� (�s �BC�C c�f�|j||�|jdd|jz�y)zYMake a file from a TarInfo object with an unknown type at targetpath. r-z9tarfile: Unknown file type %r, extracted as regular file.N)r�r�rzr s rDrzTarFile.makeunknown3 s3�� � � �g�z�*�� � �!�2�4;�L�L�A� BrFc�d�ttd�rtj|�ytd��)z'Make a fifo called targetpath. �mkfifozfifo not supported by systemN)r�r�rrr s rDrzTarFile.makefifo; s&���2�x� ��I�I�j�!��=�>�>rFc�f�ttd�rttd�std��|j}|�d}|j �r|t jz}n|t jz}tj||tj|j|j��y)z<Make a character or block device called targetpath. �mknodrz'special devices not supported by systemNr\)r�r�rr�r2r��S_IFBLK�S_IFCHRrrr{r|)r�r>rr�s rDrzTarFile.makedevC s����r�7�#�7�2�y�+A��H�I�I��|�|���<��D��=�=�?��D�L�L� �D��D�L�L� �D� ����T����G�,�,�g�.>�.>�?� ArFc�*�|j||dd�Sr�)rr s rD�makelinkzTarFile.makelinkU s���(�(��*�d�D�I�IrFc��d} |j�rUtjj|�rtj|�tj |j|�ytjj|j�r!tj|j|�y |j|�}|�|}n|�td�� |||�}|�|j#||||��yy#t$rd}Y�TwxYw#t$r|rtd�d��wxYw#t$r}t||j �|�d}~wwxYw)a3Make a (symbolic) link called targetpath. If it cannot be created (platform limitation), we try to make a copy of the referenced file instead of a link. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a link). FNTz%unable to resolve link inside archivez[makelink_with_filter: if filter_function is not None, extraction_root must also not be Noner�)rgr�r/�lexists�unlink�symlinkr]rJr�link�symlink_exceptionr�r~rr�rWr�r�) r�r>rr�r��keyerror_to_extracterrorr�r��causes rDrzTarFile.makelink_with_filterX s]��$)� � ,��}�}���7�7�?�?�:�.��I�I�j�)�� � �7�+�+�Z�8���7�7�>�>�'�"6�"6�7��G�G�G�0�0�*�=��8� ��/�/��8�J��"�!�H��&�"�>�?�?� M�*�:��G����� � ��:�1@�1@� !� B� ��/!� ,�'+�$� ,�� � �'�"�;�=�BF�G�� �� "� M�'�����A�u�L�� M�s=�A$C;�)A C;�5D� D(�;D �D �D%�( E �1E�E c��ttd�r�tj�dk(r�|j}|j}|sj t r.|jr"tj|j�d} tr.|jr"tj|j�d}|�d}|�d} |j�r(ttd�rtj|||�ytj|||�yyy#t$rY��wxYw#t$rY�uwxYw#t$r}t!d�|�d}~wwxYw)z�Set owner of targetpath according to tarinfo. If numeric_owner is True, use .gid/.uid instead of .gname/.uname. If numeric_owner is False, fall back to .gid/.uid when the search based on name fails. �geteuidrr.NrH�lchownzcould not change owner)r�r�r r4r3r�r6�getgrnamr~r�r5�getpwnamrgr!r�r�r)r�r>rr��g�urs rDr�z TarFile.chown� s���2�y�!�b�j�j�l�a�&7����A����A� ���w�}�}��L�L����7��:����w�}�}��L�L����7��:���y����y��� D��=�=�?�w�r�8�'<��I�I�j�!�Q�/��H�H�Z��A�.�/'8�!�� ����� ������ D�"�#;�<�!�C�� D�sB�4D�84D�57D%�-D%� D�D� D"�!D"�% D?�.D:�:D?c��|j�y tj||j�y#t$r}t d�|�d}~wwxYw)zASet file permissions of targetpath according to tarinfo. Nzcould not change mode)r�r�r�r�r)r�r>rrs rDr�z TarFile.chmod� sF���<�<��� ?��H�H�Z����.��� ?��6�7�Q�>�� ?�s� 0� A �A�A c��|j}|�yttd�sy tj|||f�y#t$r}td�|�d}~wwxYw)zBSet modification time of targetpath according to tarinfo. Nr�z"could not change modification time)r2r�r�r�r�r)r�r>rr2rs rDr�z TarFile.utime� sZ��� � ���=���r�7�#�� L��H�H�Z�%���0��� L��C�D�!�K�� L�s�;� A�A�Ac�L�|jd�|j�|j}d|_|S|j|jj �k7r^|jdk(ry|jj|jdz �|jj d�std��d} |jj|�} |�|j0j3|�|Sd|_|S#t$rU}|jr?|jdd|j|fz�|xjtz c_Yd}~��Yd}~��d}~wt$rz}|jr?|jdd|j|fz�|xjtz c_Yd}~��|jdk(rtt|��d�Yd}~��d}~wt $r|jdk(rtd �d�Y��-t"$r/}|jdk(rtt|��d�Yd}~��_d}~wt$$r}tt|��d�d}~wt&$r@} ddl}t+||j,�rtd |���d�|�#t.$r|�wxYwd}~wwxYw)z�Return the next member of the archive as a TarInfo object, when TarFile is opened for reading. Return None if there is no more available. �raNrr-rpTr.z0x%X: %sz empty filezzlib error: )r�rUrr�r�r�rtrr>r�r�rNr�rrYr�r�r�r�� Exceptionr�r�r�r�rRrrS)r��mr>rr�s rDr�zTarFile.next� sR�� ���D�����'�� � �A�#�D���H��;�;�$�,�,�+�+�-�-��{�{�a����L�L���d�k�k�A�o�.��<�<�$�$�Q�'�� 8�9�9���� ��,�,�2�2�4�8��< ����L�L����(��� �D�L����I"� ��$�$��I�I�a��t�{�{�A�.>�!>�?��K�K�9�,�K��%��&� 6��$�$��I�I�a��t�{�{�A�.>�!>�?��K�K�9�,�K���[�[�A�%�#�C��F�+��5�&��#� <��;�;�!�#�#�L�1�t�;�$�'� 6��;�;�!�#�#�C��F�+��5�$��(� 2���A��'�T�1��� ���!�!�T�Z�Z�0�'�,�q�c�(:�;��E����"���G��� �sb�<D� J#� AE�J#�%AG�0$G�'J#�J#�$H6�6J#�I�J#�$+J�J�J�J#c��|j�}d}|� |j|�}|d|}|rtjj|�}t |�D]a}|r|j|jk(rd}�!|r*tjj|j�}n|j}||k(s�_|cS|rt|��y#t$rd}Y��wxYw)z}Find an archive member by name from bottom to top. If tarinfo is given, it is used as the starting point. FNT) r��indexr<r�r/rh�reversedrr�) r�r�r>� normalizerR�skippingr-rj�member_names rDr}zTarFile._getmembers��� �/�/�#������ *�� � �g�.��"�&�5�/����7�7�#�#�D�)�D��w�'�F���>�>�V�]�]�2�$�H��� �g�g�.�.�v�{�{�;��$�k�k���{�"�� �(���W�%�%���1� � �� �s�C � C�Cc�V�|j�� |j���d|_y)zWRead through the entire archive file and look for readable members. NT)r�rSr�s rDr�z TarFile._load,s(���i�i�k�%���i�i�k�%���rFc��|jr"td|jjz��|�'|j|vrtd|jz��yy)znCheck if TarFile is still open, and if the operation's mode corresponds to TarFile's mode. z%s is closedNzbad operation for mode %r)r�r�r?r�r�)r�r�s rDr�zTarFile._check4sS���;�;��.�4�>�>�+B�+B�B�C�C���� � �� 5��5�� � �A�B�B�!6�rFc�,�|j�rQdjtdtjj|j�|jf��}d}n|j}|}|j||d��}|�td|z��|S)zZFind the target member of a symlink or hardlink member in the archive. rZNT)r>r/zlinkname %r not found) rgrr�r�r/rir�r]r}r~)r�r>r]�limitrjs rDr�zTarFile._find_link_target=s����=�=�?��x�x��t�b�g�g�o�o�g�l�l�.K�W�M]�M]�-^� _�`�H��E��'�'�H��E�����5�D��I���>��2�X�=�>�>�� rFc#�RK�|jr|jEd{���yd}|j�|j�}|dz }|�� |t |j�kr|j|}n'|js|j�}|s d|_yy|dz }|���Y7���w)z$Provide an iterator object. Nrr-T)rSrRrUr�r>)r�r-r>s rD�__iter__zTarFile.__iter__Ps������<�<��|�|�#�#�������'��i�i�k�G��Q�J�E��M���s�4�<�<�(�(��,�,�u�-���\�\��)�)�+���#'�D�L����Q�J�E��M�� $�s�B'�B%�BB'c�Z�||jkrt|tj��yy)z.Write debugging output to sys.stderr. �r�N)rOr�r��stderr)r��level�msgs rDr�zTarFile._dbgos#���D�J�J���#�C�J�J�'�rFc�&�|j�|Sr�)r�r�s rD� __enter__zTarFile.__enter__us����� ��rFc��|�|j�y|js|jj�d|_yr)r�r�r�r�)r�rzr�� tracebacks rD�__exit__zTarFile.__exit__ys2���<��J�J�L��#�#����"�"�$��D�KrF) Nr�NNNNNNr�NNNN)r�N)r�Nra)r�NN)NNN�Trr�)�.N)r�T)TFr")@r�r�r�r�rOrMrNrPrrbr rBrCrr>r8r�r�r�r>r{rrZrqruryr[r�rr�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr�r�r�r�r}r�r�r�r7r�r>rAr�rFrDrr�s���� �E��K��L��J��F��H� �F��G��J���AE�HL�>B�)-�b�^��#�t�Z�]/��]/�~�2��2�����@����6����:���� �I�%�* ��?�a�F$�D�$�L1"��1"�f%�23G�jC/�%��C/�J)�G���G�($�>&*�+�(,� C��@>B�&+�10�@D�(,�10�p �N� B�?�A�$J�0B�dD�B?�L�<�B&&�P�C��&�>(��rFrc��� t|d�r.|j�}t|��}|j|�nt|�}|j �y#t $rYywxYw)z�Return True if name points to a tar archive that we are able to handle, else return False. 'name' should be a string, file, or file-like object. rt)r�TF)r�r�rr�r�r)r�r�rs rDrr�sX�� ��4�� ��)�)�+�C��T�"�A��I�I�c�N��T� �A� ��� �������s�AA� A$�#A$c ��ddl}d}|j|��}|jddddd� �|jd dtd� �|j d��}|jdddd��|jddddd��|jddddd��|jdd dd!��|j�}|jr|j�|jd"d#�|j��|j}t|�rut|d$�5}|j�t|j�tj�%�ddd�|j r=td&j#|��y|jd"d'j#|��yy|j$�u|j$}t|�r<t&j|d(�5}|j%|j �)�ddd�y|jd"d'j#|��y|j��+t)|j�d"k(r |jd}t*j,}nHt)|j�d*k(r|j\}}n |jd"|j/��t�r}t&j|d(�5}|j1|j�+�ddd�|j rWd,k(rd-j#|�} nd.j#||�} t| �y|jd"d'j#|��yy|j2��|j2j5d�} t*j6j9| �\}}d/d/d0d0d1d1d1d1d2�} || vrd3| |znd4}|j2}t&j| |�5}|D]}|j;|�� ddd�|j rtd5j#| ��yyy#1swY���xYw#1swYyxYw#1swY��VxYw#1swY�XxYw)6Nrz3A simple command-line interface for tarfile module.)�descriptionz-vz --verbose� store_trueFzVerbose output)�action�default�helpz--filterz<filtername>zFilter for extraction)�metavar�choicesrJT)�requiredz-lz--list� <tarfile>zShow listing of a tarfile)rKrJz-ez --extract�+)rNz<output_dir>zExtract tarfile into target dir)�nargsrKrJz-cz--create)z<name>z<file>zCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr-z&--filter is only valid for extraction r�r9z{!r} is a tar archive.z{!r} is not a tar archive. rX)r�r.)r/r�rCz{!r} file is extracted.z+{!r} file is extracted into {!r} directory.r�r�r�)r�z.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:r�z{!r} file created.)�argparse�ArgumentParser�add_argumentr��add_mutually_exclusive_group� parse_argsr�r��exit�testrrr�r�r�r:r�rbrrr>r��curdir�format_helpr��creatercr/�splitextr�)rQrF�parserr�argsrvr��tfrXr<�tar_namer�ext�compressions�tar_mode� tar_files� file_names rD�mainre�s����G�K� � $� $�� $� =�F� ����k�,��-��/� ��� �N� .�4��6� �/�/��/�>�E� ���t�X�{�7��9� ���t�[��<�=��?� ���t�Z�s�3�9��;� ���t�X�{�8��:�����D��{�{�t�|�|�+����A�@�A��y�y���i�i���c�?��c�3��3���� ��c�n�n�&�S�Z�Z�8� ��|�|��.�5�5�c�:�;��K�K��9�@�@��E�F�� ��� ��i�i���c�?����c�5�)�R��������-�*�)� �K�K��9�@�@��E�F� ��� !��t�|�|���!��,�,�q�/�C��Y�Y�F� ���� �!� #��,�,�K�C���K�K��6�-�-�/�0��c�?����c�5�)�R�� � �6�$�+�+� �>�*��|�|��S�=�3�:�:�3�?�C�2�39�6�#�v�3F���c� ��K�K��9�@�@��E�F�� ��� ��;�;�?�?�1�%�����!�!�(�+���3��������� ��03�l�/B�4�,�s�+�+����K�K� � �\�\�(�H� -��&� ����y�!�'�.��<�<��&�-�-�h�7�8��/ !�M ���*�)��*�)��>.� -�s0�:P-�P:�Q�"Q�-P7�:Q�Q�Q�__main__rB)pr��version� __author__�__credits__�builtinsrrKr�r�r)rqr�r�rir��rer�r�r�r��AttributeError�NotImplementedErrorr�r�__all__r�r�r?rr{r�r�r�r�r�r�r�r.r,r�r�r�r4�CONTTYPEr�r�r�r�r�r�rrrrr�r&r�rrr�rWrr�r �getfilesystemencodingrErLr\rdrnrrr�r*rrrr r rr�r�r�rYr�r�r��objectr�r�BufferedReaderr8rrrrrrrWr�rprrrr�r��compilerrrrrer�r�rFrD�<module>rts���:���6� �H�� '� � � � ��� �� ������$�%8�'�B��*����-�� ��� � ��^� �� �������� � ���� �� �� �� �� ������������ �� ������ � � � ����H�g��G�X��W�g�#�%5�!� #���(��>�+� ��/� � � �.� �9�� � � ���� ���7�7�d�?��H�(�s�(�(�*�H�0�&� �(�N� �<*�"&��$��2� �y� � �8� � �� � �x� � �(� � �(� � �{� � �;� � �[� � �� � �K� ���0r�r�j�6��<e�&�e�P"�2�$�$�"� �(� �J��J� ?�k�?�@�{�@� L��L� ?�+�?�D��D��w��5��B�H���*����� ���&�2�:�:�&8�9��]9�f�]9�@x�f�x�|'�$�|�|��]9�~�z���F���M^�� �C����� �C��s"�I�I(�I%�$I%�(I3�2I3
/home/./../lib64/sse2/../python3.12/../gems/../python3.12/__pycache__/tarfile.cpython-312.pyc