%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/apport/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/apport/__pycache__/hookutils.cpython-312.pyc

�

�s�f�����dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZej*d�Zdad�ZdBd	�ZdCd
�ZdBd�ZdDd�Zd
�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$de
jJddfd�Z&d�Z'd�Z(d�Z)de
jJdfd�Z*d�Z+d�Z,dEdd�d�Z-dEd�Z.dZ/d Z0d!Z1d"Z2d#Z3d$Z4d%Z5d&Z6d'Z7d(Z8d)Z9d*Z:d+�Z;d,�Z<dEd-�Z=d.�Z>d/�Z?d0�Z@dFd1ed2eAd3dfd4�ZBd5�ZCd6�ZDd7�ZEdEd8�ZFd9�ZGd:�ZHd;�ZIdGd<�ZJd=�ZKd>�ZLd?�ZMdEd@�ZNdA�ZOej�j�ZQej�j�ZRy)Hz/Convenience functions for use in package hooks.�N)�impl)�
ProblemReportz[^0-9a-zA-Z_.-]c��t|t�r|jd�}tj	d|jdd��S)z{Generate a valid report key name from a file path.

    This will replace invalid punctuation symbols with valid ones.
    �UTF-8�.� �_)�
isinstance�bytes�decode�_invalid_key_chars_re�sub�replace)�paths �2/usr/lib/python3/dist-packages/apport/hookutils.py�path_to_keyr)s:��
�$����{�{�7�#�� �$�$�S�$�,�,�s�C�*@�A�A�TFc��d|vry|st|�}tjj|�rt	|||||�yy)a�Attach file contents if file exists.

    If key is not specified, the key name will be derived from the file
    name with path_to_key().

    If overwrite is True, an existing key will be updated. If it is False, a
    new key with '_' appended will be added instead.

    If the contents is valid UTF-8, or force_unicode is True, then the value
    will be a string, otherwise it will be bytes.
    �../N)r�osr�exists�attach_file��reportr�key�	overwrite�
force_unicodes     r�attach_file_if_existsr3s@��
��}����$���	�w�w�~�~�d���F�D�#�y�-�@�rc�F�	d|vrytj|tjtjztjz�}tj
|�}tjj|�}|jtj|�jk7s||k7rtj|�ytj|j�r>tj|d�5}|j�j�}ddd�ntj|�y|rj!dd�	�S	j!d�S#1swY�0xYw#t"$rcYSwxYw#t$$r}d
t'|���cYd}~Sd}~wwxYw)aReturn the contents of the specified path.

    If the contents is valid UTF-8, or force_unicode is True, then the value
    will a string, otherwise it will be bytes.

    Upon error, this will deliver a text representation of the error,
    instead of failing.
    rzError: invalid path.zError: path contained symlinks.�rbNz#Error: path was not a regular file.rr��errors�Error: )r�open�
O_NOFOLLOW�O_RDONLY�
O_NONBLOCK�fstatr�realpath�st_ino�stat�close�S_ISREG�st_mode�fdopen�read�stripr�UnicodeDecodeError�OSError�str)rr�fd�st�	real_path�f�contents�errors        r�	read_filer;KsC��&��D�=�)�
�W�W�T�2�=�=�2�;�;�6����F�
G��
�X�X�b�\���G�G�$�$�T�*�	�
�9�9����	�*�1�1�1�T�Y�5F��H�H�R�L�4��<�<��
�
�#����2�t�$�
,���6�6�8�>�>�+��
,�
,�
�H�H�R�L�8���?�?�7�9�?�=�=�	��?�?�7�+�+�
,�
,��"�	��O�	���&���U���%�%��&�se�E?�CE?�5E?�=E"�E?�;E?�E.�"E+�'E?�.E<�9E?�;E<�<E?�?	F �
F�F �F c�^�|st|�}|s||vr
|dz
}||vr�
t||��||<y)a�Attach a file to the report.

    If key is not specified, the key name will be derived from the file
    name with path_to_key().

    If overwrite is True, an existing key will be updated. If it is False, a
    new key with '_' appended will be added instead.

    If the contents is valid UTF-8, or force_unicode is True, then the value
    will a string, otherwise it will be bytes.
    r	)rN)rr;rs     rrrrs?����$�����V�m��3�J�C��V�m��D�
�>�F�3�Krc���tj|�}|j�D]�\}}|r||vr�
dt|���}t	|t
�r|dk(s|j
d�r|||<�G|r#|jd|�d��}|r|||<nd||<nd||<tjjtj|�j�}	|	j�|dt|���<��y)	a(Attach information about any modified or deleted conffiles.

    If conffiles is given, only this subset will be attached. If ui is given,
    ask whether the contents of the file may be added to the report; if this is
    denied, or there is no UI, just mark it as "modified" in the report.
    zmodified.conffile.z	[deleted]z
[inaccessiblez,It seems you have modified the contents of "z@".  Would you like to add the contents of it to your bug report?z
[modified]zmtime.conffile.N)�	packaging�get_modified_conffiles�itemsrr
r4�
startswith�yesno�datetime�
fromtimestamprr+�st_mtime�	isoformat)
r�package�	conffiles�ui�modifiedrr9r�response�mtimes
          r�attach_conffilesrM�s���/�/��8�H�"�.�.�*�J���h���Y�.��"�;�t�#4�"5�6���h��$���#�x�':�':�?�'K�"�F�3�K��
��x�x�>�t�f�EO�P��H��&��s��*��s��&�F�3�K��!�!�/�/�����
�0F�0F�G��8=���8I����T�!2� 3�4�5�1Jrc�<�tjdtd��y)z4Attach information about any Upstart override files.z`apport.hookutils.attach_upstart_overrides() is obsolete. Upstart is dead. Please drop this call.���
stacklevelN��warnings�warn�PendingDeprecationWarning�rrGs  r�attach_upstart_overridesrW�����M�M�	3�!��	rc�<�tjdtd��y)z:Attach information about a package's session upstart logs.z[apport.hookutils.attach_upstart_logs() is obsolete. Upstart is dead. Please drop this call.rOrPNrRrVs  r�attach_upstart_logsrZ�rXrc�d�|jdd�j�stdg�|d<yy)zwAttach information from the kernel ring buffer (dmesg).

    This will not overwrite already existing information.
    �CurrentDmesg��dmesgN)�getr1�root_command_output�rs r�attach_dmesgrb�s1��
�:�:�n�b�)�/�/�1�!4�g�Y�!?��~��2rc��d}tjj|�r�tj|�D]�}|dvr�tjj	|�d|���}tj
|�}tj|j�r|jdzdk(r�s	t|�}|s��||d|jdd���<��d	|vrd
|vr|d	�d|d
��|d<y
y
y
#t$rY��wxYw)zDAttach Desktop Management Interface (DMI) information to the report.z/sys/class/dmi/id>�uevent�	subsystem�/�rzdmi.r	rzdmi.sys.vendorzdmi.product.namer�MachineTypeN)rr�isdir�listdirr)r+r-r.r;r3r)r�dmi_dirr8�pr6�values      r�
attach_dmirn�s��!�G�	�w�w�}�}�W�����G�$�	=�A��+�+����� � �G�9�A�a�S�!1�2�A������B��<�<��
�
�+��
�
�Q��!�0C��
�!�!����7<���a�i�i��S�1�2�3�4�	=�"�6�!�&8�F�&B��&�'�(��&�1C�*D�)E�F�	�}��'C�!��
�
��
�s�+C.�.	C:�9C:c��t|�t|dd�t|dd�t|dd�tjj	d�r tdd	g�|d
<tddg�|d<td
g�|d<td
dg�|d<td
dg�|d<tddg�|d<tgd��|d<t
dg�|d<|d}tjdd|�}tjdd|�}tjdd|�}tjdd|�}tjdd|�}tjdd|�}||d<t|�td �rtd g�|d!<td"�rFtd"d#g�j�}|r||d$<td"d%g�j�}|r||d&<y'y'y')(a~Attach a standard set of hardware-related data to the report, including:

    - kernel dmesg (boot and current)
    - /proc/interrupts
    - /proc/cpuinfo
    - /proc/cmdline
    - /proc/modules
    - lspci -vvnn
    - lscpi -vt
    - lsusb
    - lsusb -v
    - lsusb -t
    - devices from udev
    - DMI information from /sys
    - prtconf (sparc)
    - pccardctl status/ident
    z/proc/interrupts�ProcInterrupts�
/proc/cpuinfo�ProcCpuinfo�
/proc/cmdline�ProcKernelCmdLinez/sys/bus/pci�lspci�-vvnn�Lspciz-vtzLspci-vt�lsusb�Lsusb�-vzLsusb-vz-tzLsusb-t�sort�
/proc/modules�ProcModules)�udevadm�infoz--export-db�UdevDbz%/usr/share/apport/dump_acpi_tables.py�acpidumpzID_FS_LABEL=(.*)zID_FS_LABEL=<hidden>zID_FS_LABEL_ENC=(.*)zID_FS_LABEL_ENC=<hidden>z
by-label/(.*)zby-label/<hidden>�prtconf�Prtconf�	pccardctl�status�PccardctlStatus�ident�PccardctlIdentN)rbrrrr�command_outputr`�rerrn�command_availabler1)r�labels�outs   r�attach_hardwarer��s���$�����*�,<�=�����7����)<�=�	�w�w�~�~�n�%�(�'�7�);�<��w��+�W�e�,<�=��z��$�g�Y�/�F�7�O�&����7�F�9��&����7�F�9��*�F�O�+D�E�F�=��%�&H�I�F�8��,�.U�-V�W�F�:���H�
�F�
�V�V�&�(>��
G�F�
�V�V�*�,F��
O�F�
�V�V�O�%8�&�
A�F�
�V�V�&�(>��
G�F�
�V�V�*�,F��
O�F�
�V�V�O�%8�&�
A�F��F�8���v����#�*�I�;�7��y����%��k�8�4�5�;�;�=���(+�F�$�%��k�7�3�4�:�:�<���'*�F�#�$��&rc�j�t|tjjd�d�t|tjjd�d�t|d�t|dd�t	|dd	�tgd
��|d<tdd
g�|d<tdd
g�|d<t
t�|d<g}tjjd�r^tdd��5}|D]B}d|vs�|j�j�}|jt|d���D	ddd�|D�]e}d|�d�}tddt|�dg�||<d|�d�}tddt|�g�||<tjd|�d��D�]}tjj!|�r?tjj#|�}d|�d t%|���}t	|||�!��btjj'|�s��tjj#|�}tj(|�D]L}	tjj+||	�}
d|�d t%|��d"t%|	���}t	||
|��N����hy#1swY��vxYw)#z�(loosely based on http://www.alsa-project.org/alsa-info.sh)
    for systems where alsa-info is not installed
    (i e, *buntu 12.04 and earlier)
    z~/.asoundrc�UserAsoundrcz~/.asoundrc.asoundconf�UserAsoundrcAsoundconfz/etc/asound.confz/proc/asound/version�AlsaVersionrqrr)�ls�-lz	/dev/snd/�AlsaDevices�aplayr��AplayDevices�arecord�ArecordDevices�
PciMultimediaz/proc/asound/cards�utf-8��encodingz]:rN�Cardz.Amixer.info�amixerz-crz.Amixer.valuesz/proc/asound/cardz/codec*z.Codecs.�rr)rrr�
expanduserrr��pci_devices�PCI_MULTIMEDIArr$�lstrip�split�append�intr4�glob�isfile�basenamerrirj�join)r�cardsr5�line�fields�cardr�	codecpath�codec�namers           r�attach_alsa_oldr� sy��
�&�"�'�'�"4�"4�]�"C�^�T������"�"�#;�<�>V���&�"4�5��&�"8�-�H�����7�*�+D�E�F�=��+�W�d�O�<�F�>��-�y�$�.?�@�F���)�.�9�F�?���E�	�w�w�~�~�*�+�
�&��
9�	1�R��
1���4�<�!�[�[�]�0�0�2�F��L�L��V�A�Y��0�
1�	1��3���T�F�,�'��$�h��c�$�i��%H�I��s���T�F�.�)��$�h��c�$�i�%@�A��s�����%6�t�f�G�#D�E�
	3�I��w�w�~�~�i�(����(�(��3���T�F�(�;�u�+=�*>�?���F�I�3�7������y�)����(�(��3���J�J�y�1�3�D��7�7�<�<�	�4�8�D��t�f�%�'��.�/�q��T�1B�0C�E�� ���c�2�
3�
	3�
3�
	1�	1�s�+
J(�6=J(�(J2c�d�tjjd�rtgd��|d<n;tjjd�rtgd��|d<nt	|�tddgtj
d�ztj
d	�ztj
d
�z�|d<tjjd�rtd
dg�|d<tjjd�rtdg�|d<t
|�t|�y)z0Attach ALSA subsystem information to the report.�/usr/sbin/alsa-info)r��--stdout�--no-upload�AlsaInfo�!/usr/share/alsa-base/alsa-info.sh)r�r�r��fuserrzz	/dev/dsp*z
/dev/snd/*z	/dev/seq*�AudioDevicesInUsez/usr/bin/pacmd�pacmd�list�	PulseListz/usr/bin/pa-info�PaInfoN)rrrr�r�r�rnrbras r�attach_alsar�Qs���	�w�w�~�~�+�,�+�>�
��z��
�����;�	<�+�L�
��z��	���"0�	�$��
�)�)�K�
 �	!�
�)�)�L�
!�	"��)�)�K�
 �	!�#�F���
�w�w�~�~�&�'�,�g�v�->�?��{��	�w�w�~�~�(�)�)�+=�*>�?��x���v����rc�j�dtjvrytjd}|jtj�D]k}|s�tjj||�}tjj
|�s�Ftj|tj�s�kyy)z/Is given command on the executable search path?�PATHFT)	r�environr��pathseprr�r��access�X_OK)�commandr�element�filenames    rr�r�os~��
�R�Z�Z���
�:�:�f��D��:�:�b�j�j�)������7�7�<�<���1��
�7�7�>�>�(�#��	�	�(�B�G�G�(D���rc��tjj�}|sd|d<	tj|d|tj
||��}|jdk(r|jj�}nSdt|�j�zd	zt|j�j�zd
z|jz}|r|jdd�
�}|S#t$r}dt|���cYd}~Sd}~wwxYw)a;Try to execute given command (list) and return its stdout.

    In case of failure, a textual error gets returned. This function forces
    LC_MESSAGES to C, to avoid translated output in bug reports.

    If decode_utf8 is True (default), the output will be converted to a string,
    otherwise left as bytes.
    �C�LC_MESSAGESF)�check�input�stdout�stderr�envr#NrsError: command s failed with exit code s: rrr!)
rr��copy�
subprocess�run�PIPEr3r4�
returncoder�r1�encoder)	r�r�r��keep_locale�decode_utf8r��spr:�ress	         rr�r�}s��
�*�*�/�/�
�C�� ��M��
&�
�^�^�����?�?���

��
�}�}����i�i�o�o���
��'�l�!�!�#�
$�(�
)��"�-�-� �'�'�)�
*��	
�
�i�i�
�	���j�j���j�3���J��#�&���U���%�%��&�s�)C$�$	D�-
D�:D�Dc���t�ytj�dk(rytjj�sytjjd�sy	tjd�\}}tjddt|�dgdtjtj��atj|�tj �5}	|j#|tj$�|j'�}|D]7\}}|tj(zs�tj|�ddd�y�m#t$rYywxYw#1swYyxYw)Nrz/usr/bin/pkttyagent�
pkttyagentz--notify-fdz
--fallbackF)�	close_fds�stdinr�)�_AGENTr�geteuid�sysr��isattyrr�pipe2r3r��Popenr4r�r,�select�epoll�register�EPOLLIN�poll�EPOLLHUP)�r�wr��eventsr	�
event_types      r�_spawn_pkttyagentr��s&�����	�z�z�|�q����9�9�����
�7�7�>�>�/�0������!����A�
�
�
�	�}�c�!�f�l�;���o�o����	�F��H�H�Q�K�	�����5���N�N�1�f�n�n�-��Z�Z�\�F�!'�
�
��:�����/��H�H�Q�K����
����������s+� E�#A
E!�1E!�E!�	E�E�!E*c�f�t�ytj�tj�day)z=Kill pkttyagent (from PolicyKit) if it was started by Apport.N)r��	terminate�wait�rr�kill_pkttyagentr��s&���~��
����
�K�K�M�
�Frc��tj�dk(rgStjjd�r
t	�dgSgS)Nrz/usr/bin/pkexec�pkexec)r�getuidrrr�r�rr�_root_command_prefixr��s9��	�y�y�{�a���	�	�w�w�~�~�'�(����z��
�Irc�j�t|t�sJd��tt�|z||d|��}|S)a=Try to execute given command (list) as root and return its stdout.

    This passes the command through pkexec, unless the caller is already root.

    In case of failure, a textual error gets returned.

    If decode_utf8 is True (default), the output will be converted to a string,
    otherwise left as bytes.
    zcommand must be a listT)r�r�)r
r�r�r�)r�r�r�r��outputs     rr`r`�sB���g�t�$�>�&>�>�$�
����(�
�����F��Mrc
�,�tjjtjjtjjdd��d�}t
j�}	tjj|d�}t|dd��5}|j�D]M\}}t|d�sJd	��|j|�d
tjj||��d���O	ddd�tjt�||gzd
��|D]}}	ttjj||�d�5}|j�j!�}	ddd�		j%d�}		r|	||<j)��	t+j,|�y#1swY��xYw#1swY�WxYw#t"$rY��wxYw#t&$rY�bwxYw#t+j,|�wxYw)a)Execute multiple commands as root and put their outputs into report.

    command_map is a keyname -> 'shell command' dictionary with the commands to
    run. They are all run through /bin/sh, so you need to take care of shell
    escaping yourself. To include stderr output of a command, end it with
    "2>&1".

    Just like root_command_output, this passes the command through pkexec,
    unless the caller is already root.

    This is preferable to using root_command_output() multiple times, as that
    will ask for the password every time.
    �APPORT_DATA_DIRz/usr/share/apport�root_info_wrapperz:script:r�r�r�r1z(command must be a string (shell command)z	 | cat > �
NF)r�r r)rrr��abspathr�r_�tempfile�mkdtempr$r@�hasattr�writer�r�r�r0r1r3rr2r,�shutil�rmtree)
r�command_map�wrapper_path�workdir�script_path�script�keynamer�r8�bufs
          r�attach_root_command_outputsr�s����7�7�<�<�
������
�
���'8�:M�N�O���L���� �G�#��g�g�l�l�7�J�7��
�+�s�W�
5�	V��$/�$5�$5�$7�
V� �����W��>�=�>��
����y�	�"�'�'�,�,�w��2P�1Q�QS�T�U�

V�	V�	��� �"�l�K�%@�@��	
�
#�	�G�
��"�'�'�,�,�w��8�$�?�+�1��&�&�(�.�.�*�C�+�
��j�j��)���"%��w��
�G�G�I�	�"	�
�
�g��A	V�	V��"+�+���
��
��&�
��
��	�
�
�g��s�1.G<�A!G�1G<�3*G�G�<G�G-�G<�G�G<�G	�G�	G*�'G<�)G*�*G<�-	G9�6G<�8G9�9G<�<Hc�6�d}|j��L|jD],}|jdd��}|j|�s�(||z
}�.|j���L|jj	�|j�|jdk(r|Sy)Nr]rrr!r)r�r�r�searchr,r�r�)�pattern�process�linesr�s    r�__filter_re_processr7s����E�
�,�,�.�
 ��N�N�	�D��;�;�w�y�;�9�D��~�~�d�#���
��	��,�,�.�
 �
�N�N�����L�L�N����Q����
r)�journald_only_systemc�d�|rddd|g}natjjd�rgd�}|r<|jd�n*tjdtj
�rgd�}ny	t
j|tj�
�5}t||�cddd�S#1swYyxYw)aExtract recent system messages which match a regex.

    pattern should be a "re" object. By default, messages are read from
    the systemd journal, or /var/log/syslog; but when giving "path", messages
    are read from there instead.
    The journald_only_system parameter controls the scope of messages that are
    extracted when reading from the systemd journal. If set to True (the
    default), only messages from the system services are extracted. If set to
    False, all messages that the current user can see are extracted.
    �tail�-n�10000�/run/systemd/system)�
journalctlz--quiet�-bz-az--system�/var/log/syslog)rrrrr]�r�N)
rrrr�r��R_OKr�r�r�r)rrrr�rs     r�
recent_syslogr Es�����4��$�/��	�����-�	.�7����N�N�:�&�	���$�b�g�g�	.�<���	�	�	�'�*�/�/�	:�5�g�"�7�G�4�5�5�5�s�B&�&B/c��tjjd�}tjj|�r$tj|tj
�sy|st
jd�}d}t|d�5}|D],}|jdd��}|j|�s�(||z
}�.	ddd�|S#1swY|SxYw)	alExtract messages from ~/.xsession-errors.

    By default this parses out glib-style warnings, errors, criticals etc. and
    X window errors.  You can specify a "re" object as pattern to customize the
    filtering.

    Please note that you should avoid attaching the whole file to reports, as
    it can, and often does, contain sensitive and private data.
    z~/.xsession-errorsr]z�^(\(.*:\d+\): \w+-(WARNING|CRITICAL|ERROR))|(Error: .*No Symbols named)|([^ ]+\[\d+\]: ([A-Z]+):)|([^ ]-[A-Z]+ \*\*:)|(received an X Window System error)|(^The error was \')|(^  \(Details: serial \d+ error_code)r rrr!N)rrr�rr�rr��compiler$rr)rrrr8r�s     r�xsession_errorsr#^s����7�7���2�3�D�
�7�7�>�>�$��r�y�y��r�w�w�'?����*�*�
6�
��
�E�	
�d�D�	��Q��	�D��;�;�w�y�;�9�D��~�~�d�#���
��	��
�L��
�L�s�	*C�4C�C�rO�rg�����	�
��c���|s
tddg�Sd}tddg�}|jd�D]�}d}d}|jd�D]]}	|jdd	�\}}|j�}|j�}|d
k(rt	|ddd
�}	|	dzdz	}�V|dk(s�\|}�_|s�{|s�~||vs��|r|dz
}|tdd|g�j�z
}��|S#t$rY��wxYw)z9Return a text dump of PCI devices attached to the system.rurvr]z-vvmmnnz

Nr��:r$�Class�������i�r)�Slotz-vvnns)r�r��
ValueErrorr1r�)
�pci_classes�resultr��	paragraph�	pci_class�slotr�rrm�ns
          rr�r��s����w��0�1�1�
�F�
�W�i�0�
1�F��\�\�&�)�H�	��	����O�O�D�)�	�D�
�!�Z�Z��Q�/�
��U��K�K�M�E��)�)�+�C��g�~���b���b�)����Z�A�-�	������	���)�{�":���&� ���n�g�x��%>�?�E�E�G�G�F�)H�,�M���
��
�s�C�	C)�(C)c��tddg�S)z9Return a text dump of USB devices attached to the system.rxrz)r�r�rr�usb_devicesr=�s���7�D�/�*�*rc��tj|�}|r2|D�cgc]%}tjj||�s�$|��'}}|S|}|Scc}w)zKRetrieve a list of files owned by package, optionally matching
    globpat.)r>�	get_filesr��fnmatch)rG�globpat�filesr8r7s     r�files_in_packagerC�sV��
����(�E��"�G��d�l�l�&:�&:�1�g�&F�!�G��G��M����M��Hs�%A�Ac��y)z	Obsolete.Nr�rVs  r�attach_gconfrE�s�rc	�<�|jdd�}i}tjj�}d|d<t	j
dd|g|tj��5}|jD]>}	|jdd	�\}}}	|	j�}	|	|j|i�|<�@	ddd�t	j
dd|gtj�
�5}|jD]h}	|jdd	�\}}}	|	j�}	|	|j|i�j|d�k7s�P|dk(r|dvrd
}	||�d|�d|	�d�z
}�j	ddd�||d<y#t$rY��wxYw#1swY��xYw#t$rY��wxYw#1swY�:xYw)z0Attach user-modified gsettings keys of a schema.�GsettingsChangesr]z/nonexisting�XDG_CONFIG_HOME�	gsettingszlist-recursively)r�r�NrOrsorg.gnome.shell>�
favorite-apps�command-historyzredacted by apportrr�)r_rr�r�r�r�r�r�r��rstripr5�
setdefault)
r�schema�	cur_value�defaultsr�rIr��schema_namerrms
          r�attach_gsettings_schemarR�s����
�
�-�r�2�I��H�
�*�*�/�/�
�C�+�C���	�	�	�	�(�&�1�s�:�?�?�
�	>�	��$�$�	>�D�
�,0�J�J�t�Q�,?�)��c�5������9>�H����R�0��5�
	>�	>�
�	�	�	�(�&�1�*�/�/�
�>�	��$�$�
	>�D�
�,0�J�J�t�Q�,?�)��c�5����������[�"�5�9�9�#�r�B�B��"4�4��A�:�1�E���}�A�c�U�!�E�7�"�=�=�	�
	>�>�$"+�F����-�
��
��	>�	>��$�
��
��>�>�sf�!E7�2&E'�E7� F�1&F�%F�=F�'	E4�0E7�3E4�4E7�7F�	F�F�F�F�Fc��t|d�D]0}tjj|�dd}t	||��2y)z@Attach user-modified gsettings keys of all schemas in a package.z)/usr/share/glib-2.0/schemas/*.gschema.xmlNi�)rCrrr�rR)rrG�schema_filerNs    r�attach_gsettings_packagerU�sC��'��<��0�����!�!�+�.�t��4�����/�	0rr�time_window�returnc��tjjd�sy|j�}|r||z
}||z}d|��d|��g}nddg}t	ddg|z�|d	<y)
z�Attach journal warnings and errors.

    If the report contains a date, get the journal logs around that
    date (plus/minus the time_window in seconds). Otherwise attach the
    latest 1000 journal logs since the last boot.
    rNz	--since=@z	--until=@rz--lines=1000rz--priority=warning�
JournalErrors)rrr�
get_timestampr�)rrV�crash_timestamp�before_crash�after_crash�argss      r�attach_journal_errorsr_�s|���7�7�>�>�/�0���*�*�,�O��&��4��%��3���L�>�*�i��}�,E�F���n�%��,�	�+�,�t�3��F�?�rc���tddg�|d<tddg�|d<tt�|d<t|dd�	�d
D]+}|tj
vs�tj
|||<�-y)z5Attach generic network-related information to report.�ip�route�IpRoute�addr�IpAddr�
PciNetworkz/etc/network/interfaces�IfupdownConfigr�)�
http_proxy�	ftp_proxy�no_proxyN)r�r��PCI_NETWORKrrr�)r�vars  r�attach_networkrm
sq��&��g��7�F�9��%�t�V�n�5�F�8��&�{�3�F�<���&�";�AQ�R�6�*���"�*�*���*�*�S�/�F�3�K�*rc��ttjd��|d<tjddtjddtjddt	d	g����|d
<t	ddg�|d
<t
jjd�rt	gd��}nd}||d<t|dd��y)z5Attach wireless (WiFi) network information to report.zH(NetworkManager|modem-manager|dhclient|kernel|wpa_supplicant)(\[\d+\])?:�
WifiSyslogz
ESSID:(.*)zESSID:<hidden>zEncryption key:(.*)zEncryption key: <hidden>zAccess Point: (.*)zAccess Point: <hidden>�iwconfig�IwConfig�rfkillr��RfKillz/sbin/iw)�iw�regr_�N/A�CRDAz/var/log/wpa_supplicant.log�WpaSupplicantLogr�N)	r r�r"rr�rrrr)r�	iw_outputs  r�attach_wifirzs���(�
�
�
�
�	
��F�<�������
���!�&��F�F�$�(��
�|�,�
�	
��F�:��&�x��&8�9�F�8��	�w�w�~�~�j�!�"�#7�8�	��	��F�6�N��&�"?�EW�Xrc��t|dd�t|dd�tdg�|d<tddg�|d	<tjd
�}|r*tgd�|z�}tjdd
|�|d<td�|d<y)zkAttach printing information to the report.

    Based on http://wiki.ubuntu.com/PrintingBugInfoScript.
    z/etc/papersize�	Papersizez/var/log/cups/error_log�CupsErrorLog�locale�Locale�lpstatrz�Lpstatz/etc/cups/ppd/*.ppd)�fgrepz-Hz	*NickNamez*/etc/cups/ppd/(.*).ppd:\*NickName: *"(.*)"z\g<1>: \g<2>�PpdFiles) �foo2zjszfoomatic-dbzfoomatic-db-engine�foomatic-db-gutenprintzfoomatic-db-hpijszfoomatic-filterszfoomatic-gui�hpijs�hplip�m2300w�min12xxw�c2050�hpoj�pxljr�pnm2ppa�splixzhp-ppdz
hpijs-ppdszlinuxprinting.org-ppdszopenprinting-ppdszopenprinting-ppds-extra�ghostscript�cupszcups-driver-gutenprintr��
ijsgutenprintzcupsys-driver-gutenprintzgimp-gutenprintzgutenprint-doczgutenprint-localeszsystem-config-printer-common�kdeprint�PrintingPackagesN)rr�r�r�r�package_versions)r�ppds�	nicknamess   r�attach_printingr�5s���
�&�"2�K�@��&�";�^�L�%�x�j�1�F�8��%�x��&6�7�F�8���9�9�*�+�D��"�#?�$�#F�G�	��V�V�9�?�I�
��z��"2�!"�F��rc�r�t|t�r|g}d}tj|tj�}d}tj|tj�}d|vr2djtj|tdg���|d<d|vr1tjjd�rt|dd|�d	�i�t|d
d�t|dd
�tj||jdd�|jdd�z�D]�}|s|jdg�y	|ddk(r|dd}n&t j#|�j%dd��}|D]0}tj*d|�d�|�s�|jdg�����y#t&t(f$rY��wxYw)z0Attach MAC information and events to the report.z!audit\(|apparmor|selinux|securityz'apparmor="DENIED".+?profile=([^ ]+?)[ ]�KernLogr�r^�AuditLogz/var/run/auditd.pidzegrep "z" /var/log/audit/audit.logz/proc/version_signature�ProcVersionSignaturers�ProcCmdliner]�apparmorr�"r$r2rrr!�^�$N)r
r4r�r"�
IGNORECASEr��findallr`rrrrrrr_�add_tagsr�fromhexr�
IndexErrorr5�match)	r�profiles�	mac_regex�mac_re�aa_regex�aa_rer��profile�search_profiles	         r�attach_mac_eventsr�js����(�C� ��:��4�I�
�Z�Z�	�2�=�=�
1�F�8�H��J�J�x����/�E���� �I�I��J�J�v�2�G�9�=�>�
��y�����B�G�G�N�N�3H�$I�#��Z�7�9�+�5O�!P�Q�	
��&�";�=S�T�����7����
�v�z�z�)�R�(�6�:�:�j�"�+E�E������O�O�Z�L�)��	��Q�x�3����"�+���-�-��.�5�5�g�i�5�P��'�	�N��x�x�!�N�+�1�-�w�7������-��	����J�'�	��	�s�84F$�$F6�5F6c��t|�|d<y)zjAttach version information for related packages.

    In the future, this might also run their hooks.
    �RelatedPackageVersionsN)r�)r�packagess  r�attach_related_packagesr��s��
(8��'B�F�#�$rc
��|syg}|D]l}|s�tj|�}|s|j|df�t|�D]/}	tj|�}|�d}|j||f��1�nt
d�|D��}dj|D��cgc]\}}|d|�d��d|����c}}�S#t
$rd}Y�hwxYwcc}}w)ztReturn a text listing of package names and versions.

    Arguments may be package names or globs, e. g. "foo*"
    r]rvc3�8K�|]}t|d����y�w)rN)�len)�.0�versions  r�	<genexpr>z#package_versions.<locals>.<genexpr>�s����@�G��G�A�J��@�s�r��<�sr)r>�package_name_globr��sorted�get_versionr5�maxr�)	r��versions�package_pattern�matching_packagesrGr��
package_widthrl�vs	         rr�r��s���
���H�#�0����%�7�7��H�� ��O�O�_�e�4�5��/�0�	0�G�
 �#�/�/��8�������O�O�W�g�.�/�	0�0�$�@�x�@�@�M��9�9��J�v��1��1�]�O�1�,�-�Q�q�c�2�J�K�K���
 ���
 ��Ks�B7�C
�7C�Cc��	tjd|gdtjtj��}|jdk7ry	|j
j
d�j�D]@}|jdd	�}t|�d
kr�$|ddk(s�-|d	j�cSy#t$rYywxYw)z-Return the license for a given kernel module.z
/sbin/modinfoF)r�r�r�r�invalidNrr/r$rO�license)r�r�r�r�r3r�r�
splitlinesr�r�r1)�module�modinfor�r�s    r�_get_module_licenser��s���
��.�.�
�f�%���?�?��?�?�	
������"��#����%�%�g�.�9�9�;�%�����C��#���v�;��?���!�9�	�!��!�9�?�?�$�$�%�������s�AB7�7	C�Cc�0�	t|d��5}|D�cgc]}|j�d��}}ddd�g}D]5}t|�}|s�d|vr�d|vr�d|vr� d|vr�%|j	|��7|Scc}w#1swY�LxYw#t$rgcYSwxYw)	zCCheck loaded modules and return a list of those which are not free.r�r�rN�GPL�BSD�MPL�MIT)r$r�r3r�r�)�module_listr8r��mods�nonfree�mr�s       r�nonfree_kernel_modulesr��s����
�+��
0�	3�A�01�2��D�J�J�L��O�2�D�2�	3�
�G�
�����"���e�q�j�E�Q�J�%�1�*���
��N�N�1���
�N��3�	3�	3�����	��s7�
B�A;�A6�A;�B�6A;�;B�B�B�Bc���d}tj|�D]�}tjj||�}|dk(stjj	|�s�Ht|d�5}|j
�j�}ddd�|dk(rjdd�}|dk(rtj�}|dz
}||�d	jd
d���d
�z
}��|S#1swY�_xYw)Nr]rdr �modes�
� �edidz-base64z: rrr!r�)rrjrr�r�r$r0r1r�base64�	b64encoder)�conrr8r�
con_info_file�vals      r�__drm_con_infor��s���
�D�
�Z�Z��_�B���w�w�|�|�C��#����=������t� 4��
�$��
�	/���$�$�&�,�,�.�C�	/�
��<��+�+�e�T�*�C���;��"�"�3�'�C�
��N�A��1�#�R��
�
�7�9�
�=�>�b�A�A��B��K�	/�	/�s�,C)�)C2	c�l�d}tjj|�sytj|�D]z}tjj	||�}tjjtjj	|d��s�at
|�|dt|���<�|y)zWAdd information about DRM hardware.

    Collect information from /sys/class/drm/.
    z/sys/class/drmN�enabledzDRM.)rrrirjr�rr�r)r�drm_dirr8r�s    r�attach_drm_infor��s���
�G�
�7�7�=�=��!��
�Z�Z��
 �B���g�g�l�l�7�A�&��
�7�7�>�>�"�'�'�,�,�s�I�6�7�.<�S�.A�F�T�+�a�.�)�*�+�	Brc���tjjd�}|smtdd��5}|D]G}|j	�}d|vs�|jd�s�*d|vs�/|j
dd�dd	d
}n	d	d	d	�y		d	d	d	�	|j�}|�y		tjd|���j}||kS#1swY�ExYw#t$rYy	wxYw#t$rYy	wxYw)z�Check if the problem happened in the currently running XDG session.

    This can be used to determine if e. g. ~/.xsession-errors is relevant and
    should be attached.

    Return None if this cannot be determined.
    �XDG_SESSION_IDz/proc/self/cgroupr�r�z
name=systemd:z.scopez	/session-r$Ni����z/run/systemd/sessions/)rr�r_r$r1�endswithr�rZ�AttributeErrorr+rEr3)r�
session_idr8r��report_time�session_start_times      r�in_session_of_problemr�s������� 0�1�J��
�%��
8�	�A��

���z�z�|��#�t�+��
�
�h�/�#�t�+�!%���K��!;�A�!>�s��!C�J��

��	�	��	���*�*�,�������W�W�'=�j�\�%J�K�T�T����,�,�5	�	�����������sA�C�
C�C�!C�C�$"C&�C�	C#�"C#�&	C2�1C2c�:�d}|st|�}tjj|�r\t	|dd��5}|j�D�cgc]}|j
d�s|nd��}}dj|�||<ddd�yycc}w#1swYyxYw)	z<Attach /etc/default/grub after filtering out password lines.z/etc/default/grubr�r�r��passwordz### PASSWORD LINE REMOVED ###r]N)rrrrr$�	readlinesrAr�)rrrr8r��filtereds      r�attach_default_grubr�.s����D���$���	�w�w�~�~�d��
�$��g�
.�		,�!��K�K�M�
�� �?�?�:�6��8�9��H���'�'�(�+�F�3�K�		,�		,����		,�		,�s�B�B�,B�B�Bc��d}g}tjj|�r8t|dd|�d�i�d|vr"t	j
|d�}|d}|d}||d<|rdj
|�|d	<|jdd
�y
)z;Attach the results of the casper md5check of install media.�unknown�
CasperMD5jsonzcat '�'r7�checksum_missmatch�CasperMD5CheckResultr�CasperMD5CheckMismatchesN)rrrr�json�loadsr��pop)r�locationr7�
mismatchesr�s     r�attach_casper_md5checkr�As���
�F��J�	�w�w�~�~�h��#�F�_��h�Z�q�>Q�,R�S��f�$��J�J�v�o�6�7�E��8�_�F��3�4�J�%+�F�!�"��-0�X�X�j�-A��)�*�
�J�J���%r)NTF)F)NN)N)r+)r|)S�__doc__r�rCr�r�rr�r�rr+r�r�rrS�apport.fileutils�apport�apport.packaging_implrr>�problem_reportrr"r
r�rrr;rrMrWrZrbrnr�r�r�r��STDOUTr�r�r�r�r`rrr r#�PCI_MASS_STORAGErk�PCI_DISPLAYr��
PCI_MEMORY�
PCI_BRIDGE�PCI_SIMPLE_COMMUNICATIONS�PCI_BASE_SYSTEM_PERIPHERALS�PCI_INPUT_DEVICES�PCI_DOCKING_STATIONS�PCI_PROCESSORS�PCI_SERIAL_BUSr�r=rCrErRrUr�r_rmrzr�r�r�r�r�r�r�r�r�r�r��	fileutils�shared_libraries�links_with_shared_libraryr�rr�<module>rs���5�$����	�	�
�
���
����3�(�"��
�
�#5�6��	
��B�A�0$&�N?�,!J�J��@�
�67+�t.3�b�<� ������,�^"�J	���
� 1� 1�t��.6�r�5�d�5�2�D��������
�
�
�
� ��"�����������@+���
$+�N0��-��c��4��,	*�Y�>2�j*�ZC�L�<�.�"�$B�%-�P,�&
&�"�#�#�4�4��"�,�,�F�F�r

Zerion Mini Shell 1.0