%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__/ui.cpython-312.pyc

�

�!f(7�	�l�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddl!Z"ddl#Z"ddl$Z"ddl%Z"ddl&m'Z(ddl)m*Z*dZ+ejXj[d	d
�Z.dZ/d�Z0d%d
e1de2dzde2dzfd�Z3de1de2de2dzfd�Z4de2de5e1e1ffd�Z6dd�de7e1de8de ddfd�Z9d�Z:	d&d�Z;ejxGd�d��Z=Gd�d �Z>Gd!�d"�Z?Gd#�d$e?�Z@y)'z�Abstract Apport user interface.

This encapsulates the workflow and common code for any user interface
implementation (like GTK, Qt, or CLI).
�N)�Sequence)�gettext)�Any)�impl)�get_process_user_and_groupz2.28.1�APPORT_SYMPTOMS_DIRz/usr/share/apport/symptomsi c��	tjd|jdd��jd�}t	|�S#t
tf$rYywxYw)zExtract process ID from report.z
Pid:	(.*)
�
ProcStatus��N)�re�search�get�group�int�
IndexError�AttributeError)�report�pids  �+/usr/lib/python3/dist-packages/apport/ui.py�get_pidr?sM����i�i���
�
�<��(D�E�K�K�A�N���3�x�����'����s�?A�A�A�key�default�returnc�j�	ttj|�S#ttf$r|cYSwxYw)z�Get an environment variable as integer.

    Return None if it doesn't exist or failed to convert to integer.
    The optional second argument can specify an alternate default.
    )r�os�environ�KeyError�
ValueError)rrs  r�_get_env_intr Hs3����2�:�:�c�?�#�#���j�!�����s��2�2�name�uidc	���tjddddt|�|gddd��}|jdk7s|jsyt|jj
��S)	N�pgrepz-nz-x�-uTF)�capture_output�check�textr)�
subprocess�run�str�
returncode�stdoutr�strip)r!r"�processs   r�_get_newest_process_for_userr0Ts^���n�n�	�$��d�C��H�d�3���
�	�G����Q��g�n�n���w�~�~�#�#�%�&�&�c���td|�}|�iStjd|��tjtjztj
z�}	tjj|�}	tj|�dD�cic]}||vr|||��c}S#t$ricYtj|�SwxYw#tj|�wxYwcc}w)z�Find D-BUS address and XDG_DATA_DIRS for the given user.

    The D-BUS address and XDG_DATA_DIRS is needed for xdg-open. It is
    incredibly hard, or alternatively, unsafe to funnel it through
    pkexec/env/sudo, so grab it from gvfsd.
    �gvfsd�/proc/)�DBUS_SESSION_BUS_ADDRESS�
XDG_DATA_DIRS)r0r�open�O_RDONLY�O_PATH�O_DIRECTORY�apport�	fileutils�get_process_environ�OSError�close)r"�	gvfsd_pid�gvfsd_pid_fd�	gvfsd_envrs     r�_get_users_environrC`s���-�W�c�:�I����	��7�7�
����b�k�k�B�I�I�5����F��L���$�$�8�8��F�	�	�����A����)��	�Y�s�^��������	�
�������	������s*�B(�C(�(C�3C�
C�C�C%F��get_user_env�argsrE�kwargsc�<�tdtd��}|�t�j�stj|fddi|��ytj|�}td�}|�|j}tjj�D��cic]\}}|jd�s|dk7r||�� }}}|r|t|�z}|j|d<tj|fd|||tj|j|�d	�|��ycc}}w)
a`Call subprocess.run as real user if called via sudo/pkexec.

    If we are called through pkexec/sudo, determine the real user ID and
    run the command with it to get the user's web browser settings.
    If get_user_env is set to True, the D-BUS address and XDG_DATA_DIRS
    is grabbed from a running gvfsd and added to the process environment.
    �SUDO_UID�
PKEXEC_UIDNr'F�SUDO_GID�SUDO_�HOME)r'�env�userr�extra_groups)r r�is_rootr)r*�pwd�getpwuid�pw_gidrr�items�
startswithrC�pw_dir�getgrouplist�pw_name)	rFrErGr"�pwuid�gid�k�vrNs	         r�run_as_real_userr^|s���z�<��#=�
>�C�
�{�4�6�>�>�@����t�3�5�3�F�3���L�L���E�
�z�
"�C�
�{��l�l���J�J�$�$�&���A�q��|�|�G�$��l�):�	
�1���C��
��!�#�&�&���,�,�C��K��N�N�����
���_�_�U�]�]�C�8�
����s�#Dc��	tjt|�d�y#t$r,}|jtj
k(rYd}~yYd}~yd}~wwxYw)z8Check if the process with the given ID is still running.rNFT)r�killrr>�errno�ESRCH�r�errors  r�
still_runningre�sK���
����C��!�������;�;�%�+�+�%��&����s�"�	A�A�Ac��t|t�sJ�	|j�|j	�|r�i}	t|d��5}t
t|j�|d�|�ddd�|d||�}|s!tjjd|�ytjjtjj|��d|d<|s2d
|vr#tj,j/|d
�}nt1d��tj,j3|�}|r|j5|�	|j7|�d
|vr�|j?|�rt#j$d�	d|vr�dtj@vr�d|vrd|vrtCd�|d
<nwtEjF|djI�d�sNtEjJ|djI�d�s%tCd�|djI�dz|d
<d|vr|jM�}
|
r|
|d<|jOd�dk(rDdtj@vr2|jQ�}|r tCd�djS|�z|d
<|ru	t|d�5}tjT|d�|jW|d��ddd�tj,jY|�tjT|d�yy#t$rY���wxYw#1swY���xYw#t $rt#j$d�Y��pt&$rMtjjd	|�t)j*�t#j$d�Y���wxYw#t8$r|sd|vr�Y��ct:$r}	t=|	�|d
<Yd}	~	��d}	~	wwxYw#t8$r|sd|vr�Y���wxYw#1swY��%xYw#t$r,}	tjjd||	�Yd}	~	��Xd}	~	wwxYw)ayCollect information about report.

    Encapsulate calls to add_*_info() and update given report, so that this
    function is suitable for threading.

    ui must be a HookUI instance, it gets passed to add_hooks_info().

    If reportfile is not None, the file is written back with the new data.

    If symptom_script is given, it will be run first (for run_symptom()).
    �utf-8��encoding�execNr*z8symptom script %s did not determine the affected packager�Symptomzsymptom script %s crashed:�ExecutablePathzAcalled without a package, and report does not have ExecutablePath�Snap�UnreportableReason�CrashDB�APPORT_DISABLE_DISTRO_CHECK�Packagez4This package does not seem to be installed correctlyz�This does not seem to be an official %s package. Please retry after updating the indexes of available packages, if that does not work then remove related third party packages and try again.�
DistroRelease�Title�ProblemType�Crash�APPORT_IGNORE_OBSOLETE_PACKAGESz�You have some obsolete package versions installed. Please upgrade the following packages and check if the problem still occurs:

%sz, �abT)�only_newzCannot update %s: %si�)-�
isinstance�HookUI�add_gdb_infor>�add_os_infor7rj�compile�readr;�loggingrdr�path�splitext�basename�
StopIteration�sys�exit�	Exception�	traceback�	print_excr<�find_file_packager�	find_snap�
add_snap_info�add_package_infor�SystemErrorr+�add_hooks_infor�_�	packaging�is_distro_package�split�is_native_origin_package�standard_titler�obsolete_packages�join�chmod�write�mark_report_seen)r�
reportfile�package�ui�symptom_script�ignore_uninstalled�symb�f�snaprd�title�old_pkgss            r�thread_collect_infor��s�� �b�&�!�!�!�
�����
�������	��n�w�7�
F�1��W�Q�V�V�X�~�v�>��E�
F�"�d�5�k�&�"�-�G�����$�$�N�"��� "��� 0� 0����1A�1A�.�1Q� R�ST� U�F�9����v�%��&�&�8�8��@P�9Q�R�G��S��
�
���%�%�g�.�D�����T�"�
2�����(��6�)�� � ��$��H�H�Q�K�	���'�1����C��F�*�v�V�/C�34�N�4�F�/�0�#�4�4��9�%�+�+�-�a�0��#�<�<��9�%�+�+�-�a�0��
�.��!��1�7�7�9�!�<�=��/�0�&�f���%�%�'���#�F�7�O�	�
�
�=�!�W�,�-�R�Z�Z�?��+�+�-���+,�@�,��	�	�(�#�	,$�F�'�(��		L��j�$�'�
/�1�����Q�'����Q���.�
/�	���)�)�*�5�
����U�#���]�
�	
�
��
F�
F���	��H�H�Q�K��	��N�N� � �!=�~�N����!��H�H�Q�K�	��(��
"�f�F�&:����2�'*�5�z��#�$��2��D�	�
&�&��*>���
	��:
/�
/���	L�

�N�N� � �!7��U�K�K��	L�s��L�
L4�&L'�,6L4�#AL4�N-�B$O$�"P�.*O;�P�	L$�#L$�'L1�,L4�4N*�AN*�)N*�-O!�O!�O�O!�$O8�7O8�;P�P�	P=�!P8�8P=c�X�eZdZUdZdZeed<dZeed<dZeed<dZ	eed<dZ
eed<y)	�Actionz�Action to take on a problem report.

    Possible actions: examine the crash ('examine'), report the crash
    ('report'), restart the crashed application ('restart'), or ignore further
    crashes ('ignore').
    F�examine�ignore�rememberr�restartN)�__name__�
__module__�__qualname__�__doc__r��bool�__annotations__r�r�rr��r1rr�r�@s;����G�T���F�D���H�d���F�D���G�T�r1r�c��eZdZdZdeefd�Zd�Zd�Ze	d��Z
d�Ze	d��Ze	d	��Z
d8ded
zdefd
�Zdefd�Zd�Zd�Zd�Ze	deedej,fd��Zdeedej,fd�Ze	d��Zd�Zd�Zd�Zd�Zd�Zdedd
fd�Zd�Z 	d9d�Z!d�Z"d�Z#d �Z$d!�Z%d"�Z&d#�Z'd$�Z(d%�Z)	d:d&ed'e*d
zde+fd(�Z,d)�Z-d*�Z.d+�Z/d,�Z0d-�Z1d.�Z2d/e3d
zdd
fd0�Z4d1�Z5d2�Z6d3�Z7d4�Z8d5�Z9d6�Z:d7�Z;y
);�
UserInterfaceaApport user interface API.

    This provides an abstract base class for encapsulating the workflow and
    common code for any user interface implementation (like GTK, Qt, or CLI).

    A concrete subclass must implement all the abstract ui_* methods.
    �argvc���d|_d|_d|_d|_d|_d|_d|_	tjjd�|_tj |j�|j#|�|_y#t$r3}tjjdt|��Yd}~�md}~wt$r"tjjd�Y��wxYw)z8Initialize program state and parse command line options.r;NFzDCould not import module, is a package upgrade in progress? Error: %sz8/etc/apport/crashdb.conf is damaged: No default database)�gettext_domainr�report_file�cur_package�
offer_restart�specified_a_pkg�upload_progressr;�crashdb�get_crashdb�ImportErrorr�fatalr+rr�
textdomain�
parse_argvrF)�selfr�rds   r�__init__zUserInterface.__init__[s���&���37���'+������"���$���#���	�!�>�>�5�5�d�;�D�L�	���4�.�.�/��O�O�D�)��	���	��N�N� � ���E�
�
�
��
�	��N�N� � �J�
�	�s�$B
�
	C2�)C�+C2�1C2c�|�d}d|_tj�dk(rtjj�}ntjj
�}|D]Y}|j|�s�|jsJ�|jddk(r|j|�n|j|�d}�[|S)a�Present all currently pending crash reports.

        Ask the user what to do about them, and offer to file bugs for them.

        Crashes that occurred in a different desktop (logind) session than the
        one that is currently running are not processed. This skips crashes
        that happened during logout, which are uninteresting and confusing to
        see at the next login.

        Return True if at least one crash report was processed, False
        otherwise.
        FTrrt�Hang)r�r�geteuidr;r<�get_new_system_reports�get_new_reports�load_reportr�finish_hang�	run_crash)r��result�reportsr�s    r�run_crasheszUserInterface.run_crasheszs�����"���
�:�:�<�1���&�&�=�=�?�G��&�&�6�6�8�G��		�A��#�#�A�&���;�;��;��{�{�=�)�V�3�� � ��#����q�!��F�		��
r1c�P�||_		tjj|�|j
s|j
|�sy|j
sJ�d|j
vry|j
jd�dk(r�d|j
vr�d|j
vr�d|j
vrtjj|j
jdtd	���}td
�|z}td�}|jtd�|z|�d
|���ytjj�}|j|�}|j
s|jrd|j
vr|j!�|j
�y|jr|j�y|j"r|j#�|j$r|j
j'�	|j(r|j+|j
�|j
syd|j
vr1|j
ddk7rtjj/|�|j0j3|j
�r3|j5�ry|j7�ry|j9�yy#t$rY���wxYw#t,$rY��wxYw#t:$r<|jtd�td��t=j>d�Yyt$r�}|j@t@jBk(r tjDjGd��|j@t@jHk(r:|jtd�td��t=j>d��|j@t@jJk(r:|jtd�|jL�t=j>d��d}~wwxYw)z�Present and report a particular crash.

        If confirm is True, ask the user what to do about it, and offer to file
        a bug for it.

        If confirm is False, the user will not be asked, and the crash is
        reported right away.
        N�Ignorertru�Signal�CoreDump�
Stacktracerlzunknown programz+Sorry, the program "%s" closed unexpectedlyzxYour computer does not have enough free memory to automatically analyze the problem and send a report to the developers.�
Problem in %s�

�_MarkForUpload�False�Invalid problem reportz2You are not allowed to access this problem report.rzOut of memory, aborting�Errorz@There is not enough disk space available to process this report.)'r�r;r<r�r>rr�rrr�r�r��ui_error_message�allowed_to_report�ui_present_report_detailsr��collect_infor�r��mark_ignorer��remember_send_reportr�mark_report_uploadr��accepts�handle_duplicate�check_unreportable�file_report�PermissionErrorr�r�ra�ENOMEMrr��ENOSPC�EIO�strerror)r�r��subject�heading�footerr��responserds        rr�zUserInterface.run_crash�sq��'���j	�
�� � �1�1�+�>�
�;�;�t�'7�'7��'D���;�;��;��4�;�;�&�������
�.�'�9�����+��d�k�k�1� ����3��'�'�*�*��K�K�O�O�$4�a�8I�6J�K����I�J�W�T���;���
�%�%��o�&��0�W�I�T�&��2J��� &� 0� 0� B� B� D���5�5�6G�H�H����(�"2�"2�#�4�;�;�6��%�%�'��{�{�"�����������������������'�'�)�
��$�$��-�-�h�o�o�>��?�?��!�D�K�K�/��K�K� 0�1�W�<�� � �3�3�K�@��|�|�#�#�D�K�K�0��(�(�*���*�*�,��� � �"�1��O�
��
��n�
��
��6�	��!�!��*�+��F�G�
�
�H�H�Q�K��	��{�{�e�l�l�*����$�$�%>�?�
�������,��%�%��g�J��=��������
�����	�	�)��%�%�a�(@�&A�5�>�>�R��������	�s��K	�K(�K(�$CK(�+A1K(�K(�:AK(�='K�$K(�1A4K(�&K(�7K(�		K�K(�K�K(�	K%�"K(�$K%�%K(�(AP%�,P%�4C,P � P%c��tjj|�tjj|�y)z�Finish processing a hanging application after the core pipe handler
        has handed the report back.

        This will signal to whoopsie that the report needs to be uploaded.
        N)r;r<r�r�)r�s rr�zUserInterface.finish_hangs,��	���+�+�A�.����)�)�!�,r1c�
�tjd�|_|jjs%|jt
d�t
d��y	|jj|�|jj�|jjd
d�}tjj|�|_|jj#�tjj%�}|j'|t)|���}|jrXtjj+|j|�t-j.t)|�t0j2�n-t-j.t)|�t0j4�|j6r!|j9|�|j7�y#t$r�}t|�dk(r:|jt
d�t
d��tjd�nGt|�d	k(r9|jt
d
�t
d��tjd�Yd}~��d}~wwxYw)a�Report an application hanging.

        This will first present a dialog containing the information it can
        collect from the running application (everything but the trace) with
        the option of terminating or restarting the application, optionally
        reporting that this error occurred.

        A SIGABRT will then be sent to the process and a series of
        noninteractive processes will collect the remaining information and
        mark the report for uploading.
        r�zNo PID specifiedz;You need to specify a PID. See --help for more information.Fzinvalid process�Invalid PIDz(The specified process ID does not exist.rznot accessiblezNot your PIDz0The specified process ID does not belong to you.Nrlr)�	modal_forT)r;�ReportrrFrr�r��
add_proc_inforr+r�r�r�rr<r�r�r|r�r�r�mark_hanging_processrr`�signal�SIGABRT�SIGKILLr��wait_for_pid)r�rrdr�r�r�s      r�run_hangzUserInterface.run_hang"s����m�m�F�+����y�y�}�}��!�!��$�%��O�P�
��
	��K�K�%�%�c�*�	
���$�$�&��{�{���/��4��!�+�+�=�=�d�C��������!�"�,�,�>�>�@���1�1�2C�s�SV�x�1�X���?�?����1�1�$�+�+�s�C��G�G�C��H�f�n�n�-��G�G�C��H�f�n�n�-�������c�"��L�L�N���7�	��5�z�.�.��%�%��m�$�a�(R�&S��������U��/�/��%�%��n�%��H�I���������	�s�G�	J�(BI=�=Jc���		tjt|�d�t
jd��6#t$r(}|jtj
k(rYd}~y�d}~wwxYw)z�waitpid() does not work for non-child processes. Query the process
        state in a loop, waiting for "no such process."
        rNr)rr`rr>rarb�time�sleeprcs  rr�zUserInterface.wait_for_pidVsX��
�
�����C��!�$�

�J�J�q�M����
��;�;�%�+�+�-����
�s�8�	A)�A$�#A$�$A)c�^�tjt|�tj�y)z!Kill process with signal SIGSEGV.N)rr`rr��SIGSEGV)rs r�	kill_segvzUserInterface.kill_segvds��	����C��&�.�.�)r1Nr�rc��
�|jjsN|jjs8|s6|j�ry|j	td�td��yt
jd�|_|jj�r	tjd|jj��tjtjztjz�}tjdtj|��}tj|d	�
�5}|j�j!�}ddd�t#d�}|t$zrd
|j_n1|jj'|jj|��n|jj5�|jjr3|jjj7�|j_|jjd
k(rt9j:�|_n|jj|_	|j?|�|jC�ry|jE�|jG�ry	|jd=|jjJr�	tjLjO|jjJ�}|jQd�r;tSj|d�5}|jjU|�ddd�nattjLjO|jjJ�d�5}|jjU|�ddd�yd}	|jW|	�}
|
jr|jY�y#1swY���xYw#t($r'|j	td�td��Yyt*t,f$rQ}t/|dd�t0j2k(rYd}~y|j	td�td��Yd}~yd}~wwxYw#t*$r�}dtA|�vrwdtA|�vrj|j<s(|j	td�td�|z�n1|j	td�td�|j<z�Yd}~y�d}~wwxYw#tH$rY��hwxYw#1swY��xYw#1swY���xYw#t,$r.}|j	td�tA|��Yd}~yd}~wwxYw)a@Report a bug.

        If a pid is given on the command line, the report will contain runtime
        debug information. Either a package or a pid must be specified; if none
        is given, show a list of symptoms.

        If a symptom script is given, this will be run first (used by
        run_symptom()).
        TzNo package specifiedzHYou need to specify a package or a PID. See --help for more information.F�Bugr4�stat)�dir_fdrgrhN��linux)r�proc_pid_fdzPermission deniedzfThe specified process does not belong to you. Please run this program as the process owner or as root.rar�z6The specified process ID does not belong to a program.r�zdoes not existr�z7Symptom script %s did not determine an affected packagezPackage %s does not exist�ProcCmdlinez.gz�wb�Cannot create report)-rFr�r�run_symptomsr�r�r;r�rrr7r8r9r:�ior~r�r�
PF_KTHREADr�r�rr>�getattrra�ENOENT�add_proc_environr.r��get_kernel_packager�r�r+r��add_extra_tagsr�r�saver��
expanduser�endswith�gzipr�r�r�)r�r�r�	stat_filer�r�flagsrd�savefiler�r�s           r�run_report_bugzUserInterface.run_report_bugis\���y�y� � ������~�� � �"���!�!��(�)��8��
���m�m�E�*����9�9�=�=�!
� �g�g��T�Y�Y�]�]�O�,�b�k�k�B�I�I�.E����.V����G�G�F�B�K�K��L�	��W�W�Y��9�,�Q��6�6�8�>�>�+�D�,��D��G����:�%�(/�D�I�I�%��K�K�-�-� �I�I�M�M�{�.���.
�K�K�(�(�*��9�9��� $�	�	� 1� 1� 7� 7� 9�D�I�I���9�9����'�(�;�;�=�D��#�y�y�0�0�D��	����n�-�"�"�"�$������� � �"��	����M�*��9�9�>�>�	
M��7�7�-�-�d�i�i�n�n�=���$�$�U�+����8�T�2�-�a����)�)�!�,�-�-��b�g�g�0�0������@�$�G�-�1����)�)�!�,�-��!%���5�5�6G�H�H����� � �"��u,�,��#�
��%�%��)�*��M������(�	
��5�'�4�0�E�L�L�@�!��%�%��m�$��N�O����	
��.�	��C��J�&�+;�s�5�z�+I��'�'��)�)��2�3��S�T�(�)���)�)��2�3��5�6��9I�9I�I�����	��6�	��	��-�-��-�-���
M��%�%�a�(>�&?��U��L�L���
M�s��BO+�1O�A"O+�%Q<�)
T�
AT<�'T"�AT<�	T/�%T<�O(�#O+�+-Q9�Q9�(Q4�$Q4�4Q9�<	T�A?T
�	T
�
T�	T�T�"T,�'T<�/T9�4T<�<	U3�$U.�.U3c
�Z�|jj|jj�s%|j	td�td��y|jj
|jj�}|s|jtd��}|sytjd�|_
|jjr&|jjj�g}n/|jj|jj�}d}|D]Q}||_||jd<||jd<	tj |�|j1d�
�d}�S|s%|j3td�td��y|jj5�|jj7�|j9�|jd=	|jd=t=|j�dk(r%|j3td�td��yd}|j?|�}|jr?|jjA|jj|jd|d��yy#t"$rot$j&j)t$j&j+tjj,d|�d	���st/d
|�d��Y���Y���wxYw#t:$rY��#wxYw)z:Update an existing bug with locally collected information.zUpdating problem reportz�You are not the reporter or subscriber of this problem report, or the report is a duplicate or already closed.

Please create a new report using "apport-bug".FaHYou are not the reporter of this problem report. It is much easier to mark a bug as a duplicate of another than to move your comments and attachments to a new bug.

Subsequently, we recommend that you file a new bug report using "apport-bug" and make a comment in this bug about the one you file.

Do you really want to proceed?r�
SourcePackagerq�source_�.pyzPackage z. not installed and no hook available, ignoringT)r�z$No additional information collected.�Daterzapport information)�change_description�attachment_comment)!r��
can_updaterF�
update_reportr�r��is_reporter�ui_question_yesnor;r�rr�r.�get_affected_packagesr�r��get_versionrrr��existsr��PACKAGE_HOOK_DIR�printr��ui_info_message�
add_user_inforrr�lenr��update)r�r#�r�pkgs�info_collected�pr�r�s        r�run_update_reportzUserInterface.run_update_report�s����|�|�&�&�t�y�y�'>�'>�?��!�!��+�,��P��
���l�l�.�.�t�y�y�/F�/F�G����&�&��P��	�A����m�m�E�*����9�9����I�I�%�%�+�+�-�.�D��<�<�5�5�d�i�i�6M�6M�N�D����	"�A� �D��+,�D�K�K��(�%&�D�K�K�	�"�
��%�%�a�(�
�����6�!�N�#	"�&�� � ��+�,�a�0V�.W�
�����!�!�#����$�$�&�����
�K�K���	����O�,��t�{�{��q� �� � ��+�,�a�0V�.W�
��!���1�1�2C�D���?�?��L�L����	�	�'�'����$�#.�#7�
 �
����[�
��w�w�~�~��G�G�L�L����!?�!?�7�1�#�S�AQ�R���H�Q�C�'U�V�W��	�
��.�	��	�s%�J"�9
L�"A1L�L�	L*�)L*c	�N�tjtjjtd��}g}|D]�}tjj|�j
d�r�2i}	t|d��5}tt|j�|d�|�ddd�d|vr!tjjd	|���tjj#tjj|��d
}|j%|j'd|�|f���|sy|j)�|j%d
�|j+t-d�|D��cgc]\}}|��	c}}d�}	|	�E||	d
d}
|
r7|j/tjjt|
dz��yyy#1swY��.xYw#t$r8tjjd|�tj �Y���wxYwcc}}w)zlReport a bug from a list of available symptoms.

        Return False if no symptoms are available.
        z*.pyr�rgrhrjNzsymptom script %s is invalidr*z0symptom script %s does not define run() functionr�descriptionF)z
Other problemNz+What kind of problem do you want to report?rrT)�globrr�r��symptom_script_dirr�rVr7rjr}r~r�r;rrdr�r�r��appendr�sort�ui_question_choicer�r)r��scripts�symptoms�scriptr�r��symptom_namer4r!�ch�symptoms           rr
zUserInterface.run_symptomsGs���
�)�)�B�G�G�L�L�);�V�D�E�����	S�F��w�w����'�2�2�3�7���D�
��&�7�3�B�q�������6�6�:�D�A�B��D� ����$�$�F�����7�7�+�+�B�G�G�,<�,<�V�,D�E�a�H�L��O�O�T�X�X�m�\�B�L�Q�R�'	S�*���
�
�����/�0�
�
$�
$�
�;�<�2:�;�.�[�$�[�;��
���>��r�!�u�o�a�(�G���#�#�B�G�G�L�L�1C�W�u�_�$U�V����EB�B���
����$�$�%C�V�L��#�#�%��
��(
<s0�1
G�>&G�$G�3H!�G	�G�=H�Hc�R�tjjt|jj
dz�}tjj
|�s<|jtd�td�|jj
z�y|j|�y)z#Report a bug with a symptom script.rzUnknown symptomzThe symptom "%s" is not known.N)
rr�r�r6rFr?r'r�r�r)r�r<s  r�run_symptomzUserInterface.run_symptomzsx�������0�$�)�)�2C�2C�e�2K�L���w�w�~�~�f�%��!�!��#�$��2�3�d�i�i�6G�6G�G�
�
����F�#r1c��|jjr|j�y|jjr&|j	|jj
�y|jjr|j�S|jj�|j�S|jjrtt�y|jjr'	|j|jj�y|jj&�r't)j*d�dk(r%|j!t#d�t#d��y|j-dt#d	��t/j0d
dgdt.j2t.j2�
�}|j4dk(rF	t7|j8j;�d�|j_|j�S|j!t#d�t#d�dz|j>jA�z�y|jC�S#t$r.}|j!t#d�t%|��Yd}~yd}~wwxYw#t<$r'|j!t#d�t#d��YywxYw)z�Call appropriate run_* method according to command line arguments.

        Return True if at least one report has been processed, and False
        otherwise.
        TNr��XDG_SESSION_TYPE�waylandr	a<The window option cannot be used on Wayland.

Please find the window's process ID and then run 'ubuntu-bug <process ID>'.

The process ID can be found by running the System Monitor application. In the Processes tab, scroll until you find the correct application. The process ID is the number listed in the ID column.rz^After closing this message please click on an application window to report a problem about it.�xprop�_NET_WM_PIDF)r'r-�stderrr���z2xprop failed to determine process ID of the windowr�)"rFr?rA�hangingr�r�filebugrr"r2�versionr)�__version__�
crash_filer�r>r�r�r+�windowr�getenvr*r)r*�PIPEr,rr-r�rrG�decoder�)r�rdrEs   r�run_argvzUserInterface.run_argv�sZ���9�9���������9�9����M�M�$�)�)�-�-�(���9�9����&�&�(�(��9�9�"�"�.��)�)�+�+��9�9����+����9�9���
O����t�y�y�3�3�4���9�9����y�y�+�,�	�9��%�%��,�-��D�
�
��� � ���H��
��N�N��-�(��!���!���	�E����1�$� �$'����(:�(:�(<�R�(@�$A�D�I�I�M��*�*�,�,��!�!��(�)��F�G����,�,�%�%�'�(�
�����!�!��k�
O��%�%�a�(@�&A�3�u�:�N�N���
O��J"� ��)�)��0�1��N�O�� � �s*�-%I!�	5J�!	J�*$J�J�-K�
Kc	�Z�tjtd���}|jddtd���|jddgd	td
���|jdd
t��|j|dd�}d|_d|_d|_d|_	d|_
|S)z=Parse command line options when being invoked in update mode.z%(prog)s <report number>��usage�-p�	--packagezSpecify package name.��help�--tagr7�tags�@Add an extra tag to the report. Can be specified multiple times.��actionr�destrYr"�
report_number)�metavar�typerNF)�argparse�ArgumentParserr��add_argumentr�
parse_argsr?rJrMrKrI)r��parserrFs   r�parse_argv_updatezUserInterface.parse_argv_update�s����(�(�q�1K�/L�M�����D�+�A�6M�4N��O���������U�V�	�	
�	���O�_�3��O�� � ��a�b��*������������������r1c	�
�t|�dkDr�dtjvrqtjj	tjj|d�tjj
tjd��|d<|d}|jd�s|jd�r|j|�St|�dkDr"jd�rtj}nd}tjtd���}|jd	d
dd|xstd
���|jdddtd���|jddtd|xstd���|jddd|xstd���|jdd|xstd�� �|jd!d"t|xstd#��$�|jd%dtd&���|jd'd(d)|xs&td*�tj j"z��|jd+d)td,���|jd-d.gd/td0��1�|jd2d3dtd4���|jd5d6tj�7�|j%|d8d�}|j&}|`|j(r`|j*|j,|j.|j0|j2|j4g}t7|�r|j9d9�t|�d8k(rjd�r	d:|_|S|�|Stjj;tjj	t<|d;z��rd:|_||_|S|jd<�s|jd=�r	||_|S|j?�rd:|_||_|Sd>|v�r|jAd?�r�tj jC|jEd>�d@�}|s|j9|�dA��nM|jGdBdC�r!|j9|�dD|dE�dF|dB�dG��n|j9|�dD|dE�dH��tIjJd8�n@tMjN|�}	|	s)|j9|�dI��tIjJd8�d:|_	|_(|Sd:|_d:|_)||_(|S)Jz�Parse command line options.

        If a single argument is given without any options, this tries to "do
        what I mean".
        r�APPORT_INVOKED_ASz-update-bugz-collectz-bugNzI%(prog)s [options] [symptom|pid|package|program path|.apport/.crash file]rTz-fz
--file-bug�
store_truerJz�Start in bug filing mode. Requires --package and an optional --pid, or just a --pid. If neither is given, display a list of known symptoms. (Implied if a single argument is given.))r^r_rYz-wz--windowz7Click a window as a target for filing a problem report.)r^rYr%z--update-bugr"z;Start in bug updating mode. Can take an optional --package.)rbr_rYz-sz	--symptom�SYMPTOMzWFile a bug report about a symptom. (Implied if symptom name is given as only argument.))rarYrVrWz�Specify package name in --file-bug mode. This is optional if a --pid is specified. (Implied if package name is given as only argument.)rXz-Pz--pidz�Specify a running program in --file-bug mode. If this is specified, the bug report will contain more information.  (Implied if pid is given as only argument.))rbrYz	--hangingz*The provided pid is a hanging application.�-cz--crash-file�PATHz�Report the crash from given .apport or .crash file instead of the pending ones in %s. (Implied if file is given as only argument.)z--savez�In bug filing mode, save the collected information into a file instead of reporting it. This file can then be reported later on from a different machine.rZr7r[r\r]z-vz	--versionz Print the Apport version number.�issue�?)�nargsrYrzL-u/--update-bug option cannot be used together with options for a new reportTrz.crashz.apport�/z	/snap/binrHzv is provided by a snap. No contact address has been provided; visit the forum at https://forum.snapcraft.io/ for help.�contactrz$ is provided by a snap published by �	developerz. Contact them via z
 for help.z`. No contact address has been provided; visit the forum at https://forum.snapcraft.io/ for help.z does not belong to a package.)*r,rrr�r��dirnamer�rrhrc�SUPPRESSrdr�rerr;r<�
report_dirrfror"rJrNr?rrMr�anyrdr'r6�isdigitrVr�r�rr�r�r��get_file_packager�r�)
r�r��cmd�suppressrgrFro�args_only_for_new_reportsr��pkgs
          rr�zUserInterface.parse_argv�s{���t�9�q�=�"�b�j�j�0��'�'�,�,��G�G�O�O�D��G�,��G�G�$�$�R�Z�Z�0C�%D�E���Q���q�'�C��|�|�M�*�c�l�l�:�.F��-�-�d�3�3��t�9�q�=�S�\�\�&�1��(�(�H��H��(�(��J��
��	����������O��
	�	
�	�������L�M�		�	
�	������ ��P��N�O�
	�	
�	���������/��	�		
�	��������/��		�		
�	���������@��	�
	
�	������?�@�	�	
�
	�������*��@��
���)�)�*�	�	
�	������?��	�	
�	��������U�V�	�	
�	�������5�6�		�	
�	���G�3�X�5F�5F��G�� � ��a�b��*���
�
���J��������������������	�	�
)�%��,�-����5���t�9��>�c�l�l�6�2��D�L��K��=��K��7�7�>�>�"�'�'�,�,�'9�5�5�=�I�J��D�L� �D�L�d��_�^�^�H�
%����	�)B�#�D�O�\��W�]�]�_��D�L��D�H�R��M�E�\�����,��'�'�1�1�%�+�+�c�2B�2�2F�G����L�L� �'�"A�B��
�X�X�i��,��L�L� �'�"� ��-�.�/ � $�Y��0�
�<���L�L� �'�"� ��-�.�/D�E��������0�0��7����L�L�E�7�*H�!I�J��H�H�Q�K��D�L��D�L���	 �D�L�#'�D� � �D�L��r1c��|dkrtjd|dz�S|dkrtjd|dz�Stjd|td�z�S)zKFormat the given integer as humanly readable and i18n'ed file
        size.i@Bz%.1f KBg@�@iʚ;z%.1f MBg��.Az%.1f GB)�locale�
format_string�float)�sizes r�format_filesizezUserInterface.format_filesize�s_���'�>��'�'�	�4�&�=�A�A��*���'�'�	�4�)�3C�D�D��#�#�I�t�e�J�6G�/G�H�Hr1c��|jsJ�d}|jD]3}|j|s�	||j|j�z
}�5|S#t$r|t|j|�z
}Y�^wxYw)z'Return the size of the complete report.r�r�get_on_disk_sizerr,�r�r�r\s   r�get_complete_sizezUserInterface.get_complete_size�s����{�{��{������	0�A��{�{�1�~�0��D�K�K��N�;�;�=�=�D�	0����&�0��C����A��/�/�D�0�s� A�$A<�;A<c�
�|jsJ�d}|jD]9}|dk7s�	|j|s�	||j|j�z
}�;|S#t$r|t|j|�z
}Y�dwxYw)z&Return the size of the reduced report.rr�r�r�s   r�get_reduced_sizezUserInterface.get_reduced_size�s����{�{��{������	4�A��J���;�;�q�>�4�����A�� ?� ?� A�A��		4����*�4���D�K�K��N� 3�3��4�s� A�$B�Bc��|jrd|jvrytjd��y|j�S)z�Check whether to offer the "Examine locally" button.

        This will be true if the report has a core dump, apport-retrace is
        installed and a terminal is available (see ui_has_terminal()).
        r�Fzapport-retrace)r�shutil�which�ui_has_terminal�r�s r�can_examine_locallyz!UserInterface.can_examine_locally�s;���{�{�j����;���<�<�(�)�1���#�#�%�%r1c
�<�|jrd|jvsJ�tj�dk(ritj�tjddd|jjd|jd��t
jd�yy)zReopen the crashed application.rr�shrm�RespawnCommandrN)rr�fork�setsid�execlprr�r�r�s rr�zUserInterface.restart�ss���{�{�}����;�;�;�
�7�7�9��>��I�I�K��I�I��������� 0�$�+�+�m�2L�M�	
�
�H�H�Q�K�r1c��|jsJ�|jtd�td�td�td�|jzgd�}|�ytjjd�}d|�d	�}d
}d|jj
dd�zdz}|d
z|z|d
z|z|dz|zdz|zd�}|j||d�y)zLocally examine crash report.zJThis will launch apport-retrace in a terminal window to examine the crash.zRun gdb sessionz1Run gdb session without downloading debug symbolsz)Update %s with fully symbolic stack traceFNz~/.cache/apport/retracezapport-retrace -S system -C z -v zapport-retrace �'z'\''z--gdb z	--output � )rr�r)r�r9r�rr�r�replace�ui_run_terminal)r�r��	cache_dir�retrace_with_download�retrace_no_download�filearg�cmdss       rr�zUserInterface.examines
��������*�*�
�)�
�
�#�$��E�F��=�>��AQ�AQ�Q�	
�
�
������G�G�&�&�'@�A�	�">�y�k�� N��/����(�(�0�0��g�>�>��D��%�x�/�'�9�"�X�-��7�$�{�2�W�<�s�B�W�L�
��	
���T�(�1�+�.�/r1�send_reportc�T�	tjddddddddd	t|�j�g
�tjgd
��y#ttj
f$r>}t
d�}|jt
d�|�d
t|����Yd}~yd}~wwxYw)z#Put whoopsie in auto or never mode.�/usr/bin/gdbus�call�-y�-d�com.ubuntu.WhoopsiePreferences�-o�/com/ubuntu/WhoopsiePreferences�-mz/com.ubuntu.WhoopsiePreferences.SetReportCrashes)
r�r�r�r�r�r�r�r�z<com.ubuntu.WhoopsiePreferences.SetAutomaticallyReportCrashes�truezLSaving crash reporting state failed. Can't set auto or never reporting mode.z*Can't remember send report status settingsr�N)r)�check_outputr+�lowerr>�CalledProcessErrorr�r�)r�r�rd�msgs    rr�z"UserInterface.remember_send_report(s���%	��#�#�$����4��5��E���$�*�*�,��

�
�#�#��

����6�6�7�	��;��C�
�!�!��>�?��%�t�C��J�<�(�
�
��	�s�A
A�B'�)4B"�"B'c��|j�d|jvry|jdj�jd�rc	tj|jd�}t|t�sJ�d|vsJ�		tjjd|�|_y	tjjd|jd�|_y#tttf$r,}d|jd�d|��|jd<Yd}~y	d}~wwxYw#ttf$r#d
|jd�d�|jd<YywxYw#ttf$r#d
|jd�d�|jd<Yy	wxYw)z+Process reports' CrashDB field, if present.NroT�{rz=A package hook defines an invalid crash database definition:
�
rnFz@A package hook wants to send this report to the crash database "z" which does not exist.)r�lstriprV�ast�literal_evalry�dict�AssertionError�SyntaxErrorrr;r��load_crashdbr�rr�)r��specrds   r�check_report_crashdbz"UserInterface.check_report_crashdbQs����;�;��)�4�;�;�">���;�;�y�!�(�(�*�5�5�c�:�	
��'�'����I�(>�?��!�$��-�-�-���~�%�~�
�%�~�~�:�:�4��F���(�
�%�~�~�9�9�$����I�@V�W�����7#�K��<�
�%�%)�[�[��%;�$<�B�u�g�G����0�1���
�� ��*�
�"�"&�+�+�i�"8�!9�:-�.����0�1�$�'
�� ��*�
�"�"&�+�+�i�"8�!9�:-�.����0�1�
�

�s<�	:C�%D"�,2E�D�3"D�D�"/E�E�/F	�F	c
�.�|jsJ�d|jd<|jjd�dk(rd|jvs,|jjd�dk7rd|jvr
|r|�y|jjd�dk(r�|jjdd	�}tjj	|�s;td
�}|r|�d|jd�d�}||jd
<|r|�yd|jvrctjj	|jd�s7td
�}|�d|jd�d�|jd
<|r|�yd|jvr�d|jvr�t
|jd�}|jd=t
tj|jd�j�}||k7r8d|jd<td�|jdz|jd
<y|js,d|jvr|s|jj��n�|j�|jj|j�rt|�}n
t�}d|jv�rtj j#�}	t$j&j't(d|j|j*|j|||f��}
|
j-�|
j/�r2|j1�	|j3�|
j/�r�2|
j;�tj j=�tj j?|	�	|
jA�d|jv�r-d|jv�rd|jdvrdg}nP|jUtd�td�|jdztd �|jdzgd!�}|dgk(rD|jd=d"|jvr
|jd"=d#|jvr}|jd#=no|dgk(rD|jd=d$|jvr
|jd$=d%|jvr3|jd%=n%|jW�t7j8d�d|jvrQd%|jvrC|jjY|jj[d%�j]d&��d|jvr�d$|jvr�d'|jvr�d
|jvr�|j^r�t$j`jc|j�}
|
jd(d	�r(td)�|
d*|
d+|
d(fz|jd
<n#td,�|
d*|
d+fz|jd
<d|jd<d
|jvs|je�s|jW�|r|�y|jjd�d-k(s,|jjd�d.k(sd|jvr�t$j&j'|jjf|jji�f�/�}|j-�|j/�r3|j1�	|j;d0�|j/�r�3	|jA�|jk�r|jk�|jd1<|jjd�d2k7r�t$j&j'|jjl|jf�/�}|j-�|j/�r3|j1�	|j;d0�|j/�r�3|jA�|jk�}|�#|d3urd4|jd1<n||jd1<t$j&j'|jjn�5�}|j-�|j/�r3|j1�	|j;d0�|j/�r�3|jA�|jW�d
|jvr�d#|jvrd|jvs9|jjdd	�jqd6�sgd|jvrY|js�sI|jutd7�td8��|jw�t7j8d�|r|�yy#t4$rt7j8d�Y���wxYw#tBtDtFjHf$rB}td�}|�dtK|���|jd
<d|jd<Yd}~���d}~wtL$r9d
|jvr'td�|jd
<d|jd<Y���tN$rj}t$jPjIdtK|��td�dztS|�z|jd
<d|jd<Yd}~��jd}~wwxYw#t4$rt7j8d�Y��
wxYw#tBtDtFjHf$r3}td�}|�dtK|���|jd
<Yd}~��;d}~wwxYw#t4$rt7j8d�Y���wxYw#t4$rt7j8d�Y���wxYw)9aHCollect additional information.

        Call all the add_*_info() methods and display a progress dialog during
        this.

        In particular, this adds OS, package and gdb information and checks bug
        patterns.

        If a symptom script is given, this will be run first (used by
        run_symptom()).
        �Truer�rtrur��DependenciesNrlrzIThis problem report applies to a program which is not installed any more.z (�)rn�InterpreterPath�ExecutableTimestampr�zPThe problem happened with the program %s which changed since the crash occurred.r�)�targetr!rFr�7This problem report is damaged and cannot be processed.r�z5This report is about a package that is not installed.z%szBAn error occurred while attempting to process this problem report:rmrqz(not installed)rzcYou have two versions of this application installed, which one do you want to report a bug against?z%s snapz%s deb packageF�PackageArchitecturer�
SnapSource�SnapTagsr��SnapGitNamerszG%s is provided by a snap published by %s. Contact them via %s for help.r!rtz�%s is provided by a snap published by %s. No contact address has been provided; visit the forum at https://forum.snapcraft.io/ for help.�KernelCrash�
KernelOops�r�rF皙�����?�_KnownReportrT�1)r��Kernelr�z7Could not determine the package or source package name.)<rrrr�r'r�rr�st_mtimer�r|�!ui_start_info_collection_progressr�r�rz�NoninteractiveHookUIr�copyr;�REThreadr�r��start�is_alive�!ui_pulse_info_collection_progress�
process_event�KeyboardInterruptr�r�r��clearr-�	exc_raiser>�EOFError�zlibrd�reprrr�rr+r9� ui_stop_info_collection_progress�add_tags�popr�r�r<r�r��search_bug_patterns�get_bugpattern_baseurl�return_value�known�	anonymizerV�_is_snapr��ui_shutdown)r�r�r��on_finished�exe_pathr��	orig_time�cur_time�hookui�orig_env�icthreadrd�resr��bpthread�known_thread�val�anonymize_threads                  rr�zUserInterface.collect_infoysa
�� �{�{��{�(.����$�%�
�K�K�O�O�M�*�g�5�,�$�+�+�:U��K�K�O�O�M�*�g�5�.�D�K�K�:W���
���;�;�?�?�=�)�W�4��{�{���'7��<�H��7�7�>�>�(�+��8���� �E��D�K�K�0@�$A�#B�!�D�C�47����0�1���M�� �D�K�K�/��w�w�~�~�d�k�k�2C�&D�E��<��C�
�%�r�$�+�+�.?�"@�!A��C��K�K� 4�5�#�#�
���t�{�{�*�/D����/S��D�K�K�(=�>�?�I����1�2��2�7�7�4�;�;�/?�#@�A�J�J�K�H��H�$�07����,�-��C���k�k�"2�3�	4����0�1��� � � ����3�"�
�K�K�#�#�%�
�2�2�4��|�|�#�#�D�K�K�0�����-�/���4�;�;�.��:�:�?�?�,��!�?�?�3�3�.�.�����(�(��(�(��&�*�
�4������ ��'�'�)��:�:�<�$��,�,�.��'�'�)��
�
���
�
� � �"��
�
�!�!�(�+�<��&�&�(�2����$��d�k�k�)A�$����I�(>�>��#�C��1�1��.���i�L�4�;�;�v�+>�>��.�/�$�+�+�i�2H�H����C��1�#�:����I�.�,����;� �K�K�(=�>�&�$�+�+�5� �K�K��8��Q�C�Z����F�+�#�t�{�{�2� �K�K��5�!�T�[�[�0� �K�K�
�3��9�9�;��H�H�Q�K�����$��t�{�{�)B����$�$�T�[�[�_�_�Z�%@�%F�%F�s�%K�L��$�+�+�%� ����3�
�T�[�[�8X�(����;��(�(��'�'�1�1�$�2B�2B�C���8�8�I�r�*�89�9�9��f��t�K�'8�$�y�/�J�9K�D�K�K� 4�5�
9:�D�9��f��t�K�'8�9�	9:�D�K�K� 4�5�
18����,�-�#�t�{�{�2�$�:S�:S�:U��5�5�7���M�������
�.�-�?��;�;�?�?�=�1�\�A�����+�!�?�?�3�3��;�;�:�:��,�,�=�=�?�A�4������ ��'�'�)��:�:�<�$� �
�
�c�*��'�'�)�R��&�&�(�
�(�(�*�2:�2G�2G�2I�D�K�K��/��{�{���}�-��6�%���7�7��<�<�-�-�T�[�[�N� 8� ���"�"�$�"�+�+�-��:�:�<�$�$�)�)�#�.�#�+�+�-��&�&�(�"�/�/�1���?��d�{�69����N�3�69����N�3� &���7�7�t�{�{�?T�?T�7�U���"�"�$�"�+�+�-��6�6�8� �$�)�)�#�.�#�+�+�-�
�&�&�(��1�1�3�$�4�;�;�6�(�t�{�{�:�*�$�+�+�=�!�K�K�O�O�M�2�>�I�I�(�S�%�T�[�[�8��-�-�/��)�)��2�3��S�T���$�$�&��H�H�Q�K���M���s-�$������$�� ��4�:�:�6�<��U�V�C�;>�%�t�D��K�=�8Q�D�K�K� 4�5�4;�D�K�K� 0�1��!�@�+�4�;�;�>�<=�S�=����$8�9�9@����$4�5�� �
<��N�N�(�(��t�E�{�;��;��!�	!�
�e�*�%��K�K� 4�5�5<�D�K�K� 0�1��
<��B-�$������$�� ��4�:�:�6�R��U�V�C�;>�%�t�D��K�=�8Q�D�K�K� 4�5��R��"-�$������$��$)� ��H�H�Q�K� �s��#h�i�m�:m9�o
�o2�h=�<h=�m�7j�Am�m�'Am�m�m6�5m6�9o
�(o�o
�
o/�.o/�2p�pc�Z�|jsJ�d|jvxsd|jvS)Nr�rm)rr�s rr�zUserInterface._is_snap�s+���{�{��{��t�{�{�*�C�f����.C�Cr1c��		td|gd��y#t$rtj|dd��rYyd}YnwxYwn#t$r}d|��}Yd}~nd}~wwxYwtd	�}td
�|z}|j
|||z�y)zjOpen the given URL in a new browser window.

        Display an error dialog if everything fails.
        zxdg-openTrDNr)�new�	autoraiserr�zUnable to start web browserz'Unable to start web browser to open %s.)r^r>�
webbrowserr7r�r�r�)r��url�
error_detailsrdr��messages      r�open_urlzUserInterface.open_url�s���

	)�
#� �*�c�!2��F����
#��?�?�3�A��>�� "�
�	
#�����	)� ���L�M��	)���/�0���=�>��D�����e�W�}�%<�=s-��!;�?�;�?�;�?�	A�A�Ac	�����jsJ��jj�j�sy�jjd��jjd�k(r	�jd=	�jd=d�_�fd�}t
j���fd�}t�j�D]!}|jd�s��j|=�#�j�tjj�jj�j||f��}|j�	|j�rv�j!�j
�	�jd	d
��\}}}�j#||�|j%�|j'�|j�r�v|j'�|jA�}
�jC��jjE�j|
�}|r�jG|�yy#t$rY���wxYw#t$rY���wxYw#tj($rY��wxYw#t*$rt-j.d�Y��t0j2t4j6j8f$r>}t;d
�}	�j=t;d�|	�dt?|����Yd}~yd}~wwxYw)zOUpload the current report and guide the user to the reporting
        web page.Nr��Architecture�StacktraceAddressSignaturec�,��t|�|z�_y�N)r�r�)�sent�totalr�s  �r�progress_callbackz4UserInterface.file_report.<locals>.progress_callback�s���#(��;��#6�D� r1c�v��tj�}�j|||f�|j�yr)�	threading�Event�put�wait)r�r(�message_displayed�
message_queues   �r�message_callbackz3UserInterface.file_report.<locals>.message_callback�s2��� )��� 1�����u�d�,=�>�?��"�"�$r1r�r�Tr�)�block�timeoutrzHCannot connect to crash database, please check your Internet connection.zNetwork problemr�)$rr�r�rrr��queue�SimpleQueue�listrV�ui_start_upload_progressr;r��uploadr�r��ui_set_upload_progressr*�setr��Emptyr�r�r��smtplib�SMTPConnectError�urllibrd�URLErrorr�r�r+r��ui_stop_upload_progress�get_comment_urlr�)
r�rrr\�upthreadr�r(�
msg_displayedrdr��ticketr�r
s
`           @rr�zUserInterface.file_report�s�����{�{��{��|�|�#�#�D�K�K�0���;�;�?�?�0�1�T�[�[�_�_�^�5T�T�
��K�K� 5�6�	����8�9� $���	7��)�)�+�
�	%��d�k�k�"�	#�A��|�|�C� ��K�K��N�	#�	
�%�%�'��?�?�+�+��<�<�&�&��+�+�0�2B�C�,�
��	����	��#�#�%��+�+�D�,@�,@�A��1>�1B�1B�"�C�2C�2�.�E�4���(�(���5�!�%�%�'��&�&�(��#�#�%�
��� ��&�&�(���$�$�&��l�l�*�*�4�;�;��?����M�M�#����{�
��
���	��	��H�{�{�����!�	��H�H�Q�K��(�(�&�,�,�*?�*?�@�	��:��C�
�!�!�!�$5�"6�3�%�t�C��J�<�8P�Q���
	�sm�/
H<�=
I�+I5�7A	I�I5�I5�<	I	�I	�	I�I�I2�/I5�1I2�2I5�5K?�,K?�4K:�:K?c	��	tj�|_t|d�5}|jj	|d��ddd�d|jvrtd��	d
|jvr&|jd
j!�d|_ytj$j'|jj)dd��|_y#1swY��xYw#t$r.d|_|jtd�td��Yy	t$r6}d|_|jtd
�|j�Yd}~y	d}~wtt
ttjf$rE}d|_td�}|jtd
�|�dt|����Yd}~y	d}~wwxYw)z�Load report from given path and do some consistency checks.

        This might issue an error message and return False if the report cannot
        be processed, otherwise self.report is initialized and True is
        returned.
        �rb�
compressed)�binaryNrtz+Report does not contain "ProblemType" fieldzMemory exhaustionzEYour system does not have enough memory to process this crash report.Fr�r�r�rqrrlrT)r;r�rr7�loadr�MemoryErrorr�r�r>r��	TypeErrorr�r�rdr�r�r�r<r�r)r�r�r�rdr�s     rr�zUserInterface.load_reports���	� �-�-�/�D�K��d�D�!�
9�Q���� � ��<� �8�
9��D�K�K�/� �!N�O�O�0�0����#�#�{�{�9�5�;�;�=�a�@�D���	 &�/�/�A�A������ 0�"�5� �D���C
9�
9���		��D�K��!�!��%�&��5��
���	��D�K��!�!�!�$<�"=�u�~�~�N����:�~�t�z�z�B�	��D�K��M�N�C��!�!��*�+��u�D��e��
�-F�
���
	�s@�%C&�C�!C&�C#�C&�&4G�G�$,E�&G�;;F;�;Gc���|jsJ�|jj|j�syd|jvr�t|jdt�r+|jdjd�|jd<d|jvr-t
d�|jdj�dz}nd}|j|t
d�|jdz�y	y)
znCheck if the current report is unreportable.

        If so, display an info message and return True.
        Frn�UTF-8rqr�rrz#The problem cannot be reported:

%sT)	rr�r�ry�bytesrQr�r�r*)r�r�s  rr�z UserInterface.check_unreportable:s���
�{�{��{��|�|�#�#�D�K�K�0���4�;�;�.��$�+�+�&:�;�U�C�48�K�K�(�5��&��/����0�1��D�K�K�'��/�*�T�[�[��-C�-I�-I�-K�A�-N�N����� � ���9�:��+�+�2�3�4�
�
�r1c	��|jsJ�d|jvr<tjj|jd�r|jd}n*	tj
j
|j�}|sytjdd��}	|j|d��|j#d
�syt%|j'd
��}d|vry|S#t$rYywxYw#tj$r9}tjjd|�dt!|��d	��Yd}~yd}~wwxYw)z�Return a .desktop info dictionary for the current report.

        Return None if report cannot be associated to a .desktop file.
        �DesktopFileNF)�
interpolation�strictr*rhz	Warning! z is broken: r�z
Desktop Entryr!)rrr�r'r;r<�find_package_desktopfiler�r�configparser�ConfigParserr~r�r�rGr�r+�has_sectionr�rU)r��desktop_file�cprdr�s     r�get_desktop_entryzUserInterface.get_desktop_entrySs��
�{�{��{��D�K�K�'�B�G�G�N�N�4�;�;�}�;U�,V��;�;�}�5�L�
�%�/�/�H�H��$�$� ����
�
&�
&�T�%�
H��	��G�G�L�7�G�3��~�~�o�.���b�h�h��/�0�������
��#�
��
���!�!�	��J�J���y���l�3�u�:�,�b�Q�R���	�s*�)C$�C3�$	C0�/C0�3D?�/D:�:D?c��|jsJ�|jj|j�syd|jvry|jdjd�rC|j	td�td��|j
|jd�y|j	td�td��y)z�Check if current report matches a bug pattern.

        If so, tell the user about it, open the existing bug in a browser, and
        return True.
        Fr��httpzProblem already knownz�This problem was already reported in the bug report displayed in the web browser. Please check if you can add any further information that might be helpful for the developers.z;This problem was already reported to developers. Thank you!T)rr�r�rVr*r�r�r�s rr�zUserInterface.handle_duplicatess����{�{��{��|�|�#�#�D�K�K�0������,���;�;�~�&�1�1�&�9�� � ��)�*��A��
�
�M�M�$�+�+�n�5�6��
� � ��)�*��O�P�
�
r1c��|jsJ�|jjr0|jj|jj�yy)z6Add extra tags to report specified with --tags on CLI.N)rrFr[r�r�s rrzUserInterface.add_extra_tags�s8���{�{��{��9�9�>�>��K�K� � ������0�r1r�r�c��td��)a	Show details of the bug report.

        Return the action and options as an Action object:

        - Valid attributes are: report the crash ('report'), restart
          the crashed application ('restart'), or ignore further crashes
          ('ignore').
        �.this function must be overridden by subclasses��NotImplementedError)r�r�r�s   rr�z'UserInterface.ui_present_report_details�s��"�"R�S�Sr1c��td��)z:Show an information message box with given title and text.r;r<�r�r�r(s   rr*zUserInterface.ui_info_message����!�"R�S�Sr1c��td��)z4Show an error message box with given title and text.r;r<r?s   rr�zUserInterface.ui_error_message�r@r1c��td��)z�Open a indefinite progress bar for data collection.

        This tells the user to wait while debug information is being
        collected.
        r;r<r�s rr�z/UserInterface.ui_start_info_collection_progress����"�"R�S�Sr1c��td��)zaAdvance the data collection progress bar.

        This function is called every 100 ms.
        r;r<r�s rr�z/UserInterface.ui_pulse_info_collection_progress����
"�"R�S�Sr1c��td��)z,Close debug data collection progress window.r;r<r�s rr�z.UserInterface.ui_stop_info_collection_progress�r@r1c��td��)z{Open progress bar for data upload.

        This tells the user to wait while debug information is being uploaded.
        r;r<r�s rrz&UserInterface.ui_start_upload_progress�rEr1�progressc��td��)z�Update data upload progress bar.

        Set the progress bar in the debug data upload progress window to the
        given ratio (between 0 and 1, or None for indefinite progress).

        This function is called every 100 ms.
        r;r<)r�rHs  rrz$UserInterface.ui_set_upload_progress�s��"�"R�S�Sr1c��td��)z(Close debug data upload progress window.r;r<r�s rrz%UserInterface.ui_stop_upload_progress�r@r1c��y)zdCalled right before terminating the program.

        This can be used for for cleaning up.
        Nr�r�s rr�zUserInterface.ui_shutdown�s�r1c��td��)zpCheck for a terminal window.

        Check if a terminal application is available and can be launched.
        r;r<r�s rr�zUserInterface.ui_has_terminal�rEr1c��td��)z�Run command in a terminal window.

        Run given command in a terminal window; raise an
        exception if terminal cannot be opened.
        r;r<)r��commands  rr�zUserInterface.ui_run_terminal�rCr1c��td��)��Show a yes/no question.

        Return True if the user selected "Yes", False if selected "No" or
        "None" on cancel/dialog closing.
        r;r<�r�r(s  rr$zUserInterface.ui_question_yesno�rCr1c��td��)�mShow an question with predefined choices.

        options is a list of strings to present. If multiple is True, they
        should be check boxes, if multiple is False they should be radio
        buttons.

        Return list of selected option indexes, or None if the user cancelled.
        If multiple == False, the list will always have one element.
        r;r<�r�r(�options�multiples    rr9z UserInterface.ui_question_choice�s��"�"R�S�Sr1c��td��)�mShow a file selector dialog.

        Return path if the user selected a file, or None if cancelled.
        r;r<rQs  r�ui_question_filezUserInterface.ui_question_file
rEr1r)NFN)TN)<r�r�r�r�rr+r�r�r��staticmethodr�r�r�r�r�rr2r
rArRrrc�	Namespacerhr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r6r�rrr�r�r*r�r�r�r�rr�rrr�r�r�r$r9rYr�r1rr�r�Ps���*�T�#�Y�*�>"�Hx�t�-��-�2�h�����*��*�}�S�4�Z�}�4�}�~]�4�]�~1�f
$�M"�f����
��(�2D�2D����*U�t�C�y�U�X�-?�-?�U�n�I��I���&��0�B'��'��'�R&�RJN�k�Z	D�>�*M�^*�X�2�@ �D1�GK�T�!%�T�9<�t��T�	�T�T�T�T�T�T�T�T�u�t�|�T��T�T��T�T�T�
T�Tr1r�c�<�eZdZdZd�Zd�Zd�Zd
d�Zd�Zd�Z	d�Z
y	)rzagInteractive functions which can be used in package hooks.

    This provides an interface for package hooks which need to ask interactive
    questions. Directly passing the UserInterface instance to the hooks needs
    to be avoided, since we need to call the UI methods in a different thread,
    and also don't want hooks to be able to poke in the UI.
    c��||_tj�|_tj�|_d|_d|_d|_y)zSCreate a HookUI object.

        ui is the UserInterface instance to wrap.
        N)r�rr	�_request_event�_response_event�_request_fn�
_request_args�	_response)r�r�s  rr�zHookUI.__init__sB��
���(�o�o�/���(���0������!�����r1c�(�|jdd|�S)z�Show an information with OK/Cancel buttons.

        This can be used for asking the user to perform a particular action,
        such as plugging in a device which does not work.
        r*r��_trigger_ui_requestrQs  r�informationzHookUI.information-s���'�'�(9�2�t�D�Dr1c�&�|jd|�S)rPr$rdrQs  r�yesnozHookUI.yesno5s���'�'�(;�T�B�Br1c�*�|jd|||�S)rSr9rdrTs    r�choicez
HookUI.choice=s���'�'�(<�d�G�X�V�Vr1c�&�|jd|�S)rXrYrdrQs  r�filezHookUI.fileIs��
�'�'�(:�D�A�Ar1c�z�|jj�rJ�|jj�rJ�|j�J�d|_||_||_|jj
�|jj�d|_|jj�|jS)z5Called by HookUi functions in info collection thread.N)	r^�is_setr_r`rbrarrr�)r��fnrFs   rrezHookUI._trigger_ui_requestTs����&�&�-�-�/�/�/��'�'�.�.�0�0�0����'�'�'�������!��������!����!�!�#�������"�"�$��~�~�r1c�t�|jjd�|jj�sy|jj�rJ�|jj	�t|j|j�|j�|_	|jj�y)z;Called by GUI thread to check and process hook UI requests.r�N)r^rrnr_r�r
r�r`rarbrr�s rr�zHookUI.process_eventfs���	
��� � ��%��"�"�)�)�+���'�'�.�.�0�0�0����!�!�#�;�����$�*:�*:�;�T�=O�=O�P������ � �"r1N�F)r�r�r�r�r�rfrhrjrlrer�r�r1rrzrzs.����$E�C�
W�B��$
#r1rzc�N��eZdZdZ�fd�Zdefd�Zd�Zd�Zd
d�Z	d�Z
d	�Z�xZS)r�z8HookUI variant that does not ask the user any questions.c�$��t�|�d�yr)�superr�)r��	__class__s �rr�zNoninteractiveHookUI.__init__vs���
����r1rc�4�|jj�d�S)Nz())rur�r�s r�__repr__zNoninteractiveHookUI.__repr__ys���.�.�)�)�*�"�-�-r1c��yrr�rQs  rrfz NoninteractiveHookUI.information|���r1c��yrr�rQs  rrhzNoninteractiveHookUI.yesnoryr1c��yrr�rTs    rrjzNoninteractiveHookUI.choice�ryr1c��yrr�rQs  rrlzNoninteractiveHookUI.file�ryr1c�.�tjd�y)Nr�)r�r�r�s rr�z"NoninteractiveHookUI.process_event�s
���
�
�3�r1rq)
r�r�r�r�r�r+rwrfrhrjrlr��
__classcell__)rus@rr�r�ss0���B��.�#�.�����r1r�r)NF)Ar�rcr�r1�dataclassesrarr5rrr��os.pathrrRrr
r�r�rr)r�rr�r��urllib.errorrr�r��collections.abcrr��typingr�apport.crashdbr;�apport.fileutils�apport.logging�apport.REThread�apport.packaging_implrr��apport.user_grouprrLrrr6rrr+rr r0r�rCrr�r^rer��	dataclassr�r�rzr�r�r1r�<module>r�s~���&�
�������	�
��
��	�
�
���
�������$� ������3�8����Z�Z�^�^�$9�;W�X��
�
��	�c�	�C�$�J�	�#��*�	�	'�s�	'��	'��t��	'��C��D��c��N��:.3�&�
�s�)�&�&*�&�>A�&�	�&�R�NS�N$�b
�������T�T�D6^#�^#�B�6�r1

Zerion Mini Shell 1.0