HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //lib64/python3.9/site-packages/borg/__pycache__/xattr.cpython-39.pyc
a

HZ�hd�@sdZddlZddlZddlZddlZddlZddlZddlmZ	ddl
mZddlm
Z
e
�ZddlmZmZmZmZdZej�d	�r�ej�d
d�Ze�de�ZeD]TZe�d
�r�edd�Zejddged�Ze	e�d���d�Zee	d�kr�dZq�q�ddd�Z ddd�Z!ddd�Z"dS)zPA basic extended attributes (xattr) implementation for Linux, FreeBSD and macOS.�N)�parse�)�prepare_subprocess_env)�
create_logger)�	listxattr�getxattr�setxattr�ENOATTRFZlinux�
LD_PRELOAD�z[ :]ZlibfakerootT)�systemZfakerootz-v)�env�ascii���z1.20.2c	Cs�tj|dd���}|��}d\}}zt|||�Wn tyPYWd�dS0zt|�}Wn ty~YWd�dS0||vr�Wd�dSt||�|kWd�S1s�0YdS)z4Determine if xattr is enabled on the filesystem
    zborg-tmp)�dir�prefix)s	user.namesvalueNF)�tempfileZNamedTemporaryFile�filenor�OSErrorrr)�path�f�fd�name�value�names�r�0/usr/lib64/python3.9/site-packages/borg/xattr.py�
is_enabled)srcCs�t|t�rt�|�}i}z�t||d�}|D]l}zt|||d�p@d||<Wq*ty�}z4|jtfvrfnt	�
d|jdd�t|��WYd}~q*d}~00q*Wn:ty�}z"|jtjtj
fvr�n�WYd}~n
d}~00|S)a�
    Return all extended attributes on *path* as a mapping.

    *path* can either be a path (str or bytes) or an open file descriptor (int).
    *follow_symlinks* indicates whether symlinks should be followed
    and only applies when *path* is not an open file descriptor.

    The returned mapping maps xattr names (bytes) to values (bytes or None).
    None indicates, as a xattr value, an empty value, i.e. a value of length zero.
    ��follow_symlinksNz&when getting extended attribute %s: %s�replace��errors)�
isinstance�str�os�fsencoderrr�errnor	�logger�warning�decode�ENOTSUP�EPERM)rr�resultrr�errr�get_all<s"

6r/cCs�t|t�rt�|�}d}|��D]�\}}zt|||p6d|d�Wq ty�}zjd}|jtjkrndt|�}n*|jtj	kr�dt
|�t|�f}nt|�}t�d|j
dd	�|�WYd
}~q d
}~00q |S)a
    Set all extended attributes on *path* from a mapping.

    *path* can either be a path (str or bytes) or an open file descriptor (int).
    *follow_symlinks* indicates whether symlinks should be followed
    and only applies when *path* is not an open file descriptor.
    *xattrs* is mapping maps xattr names (bytes) to values (bytes or None).
    None indicates, as a xattr value, an empty value, i.e. a value of length zero.

    Return warning status (True means a non-fatal exception has happened and was dealt with).
    F�rTz too big for this filesystem (%s)z/fs full or xattr too big? [xattr len = %d] (%s)z&when setting extended attribute %s: %sr r!N)r#r$r%r&�itemsrrr'ZE2BIG�ENOSPC�lenr(r)r*)rZxattrsrr)�k�vr.Zerr_strrrr�set_alles

.r6)N)F)F)#�__doc__r'r%�re�
subprocess�sysrZpackaging.versionrZ
parse_versionZhelpersrr(r�platformrrrr	ZXATTR_FAKEROOT�
startswith�environ�getr
�splitZpreloadsZpreloadr
Zcheck_outputZfakeroot_outputr*Zfakeroot_versionrr/r6rrrr�<module>s4



)