__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

x6�g5)�	��SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ r J!r! SSK"r#SSK$r#SSK%r%SSK&J'r' SSK(J)r* SSK+J,r,J-r- \R\R_SS5r0\0S	3r1\0S
3r2Sr3\R\R_SS
5r4Sr5Sr6Sr7Sr8/SQr9Sr:S\;S\!\;4Sjr<S-S\;S\=S-S\=S-S\;4Sjjr>S-S\;S\=S-S\=S-S\;4Sjjr?Sr@S.S\A\;S\B\;\;4S-S\CS\;4S jjrDS!rES"rFS#rGS$\;S-S%\HS\;4S&jrIS'rJS(rK"S)S*\B\;\;45rL"S+S,\%R�5rNg)/z;Representation of and data collection for a problem report.�N)�Iterable�Iterator)�kill_pkttyagent)�impl)�HookUI�NoninteractiveHookUI�APPORT_DATA_DIRz/usr/share/apportz/general-hooks/z/package-hooks/z/opt�APPORT_IGNORE_FILEz~/.apport-ignore.xmlz/etc/apport/report-ignorez/etc/apport/report-onlyz/etc/apport/blacklist.dz/etc/apport/whitelist.d)�sh�bash�dash�csh�tcshzpython*zruby*�phpzperl*zmono*�awkc���[R"U5 [R"U5H&nX!;dM
UR	U5 [X!5 M( g![a gf=f)z7Recursively add dependencies of package to depends_set.N)�	packaging�get_version�
ValueError�get_dependencies�add�_transitive_dependencies)�package�depends_set�ds   �//usr/lib/python3/dist-packages/apport/report.pyrrVsZ������g�&��
'�
'��
0�����O�O�A��$�Q�4�1������s�A�
A&�%A&�	directory�returnc#�x# �[R"U5R5HZnURSS9nUH8nUR	5nU(dMURS5(aM4Uv� M: SSS5 M\ g!,(df   Mn=f![a M~f=f![a gf=f7f)z?Read every file in the directory and return each stripped line.�utf-8��encoding�#N)�pathlib�Path�iterdir�open�strip�
startswith�OSError)r�	list_file�fd�line�strippeds     r�_read_list_files_in_directoryr/bs����
� ���i�0�8�8�:�I�
��^�^�W�^�5�� "��#'�:�:�<��#�8�H�,?�,?��,D�,D�"*�N�!#�6�5�;�5�5��
�
��
���
��
�sz�B:�'B*�B�B�B�2B�:B�B*�B:�
B	�B�B*�B�
B'�#B*�&B'�'B*�*
B7�4B:�6B7�7B:�path�pid�dir_fdc�h�Ub[R"XS9$[R"SUSU35$)zjUse readlink() to resolve link.

Return a string representing the path to which the symbolic link points.
�r2�/proc/�/)�os�readlink)r0r1r2s   r�_read_proc_linkr9rs5�����{�{�4�/�/�
�;�;���u�A�d�V�,�-�-�c��Uc	SUSU3nO5[R"U[R[R-US9n[R"US5nUR5R
5RSSS9sSSS5 $!,(df   g=f![anS	[U5-sSnA$SnAff=f)
zPRead file content.

Return its content, or return a textual error if it failed.
Nr5r6r4�rb�UTF-8�replace��errors�Error: )
r7r'�O_RDONLY�	O_CLOEXEC�io�readr(�decoder*�str)r0r1r2�	proc_filer,�errors      r�_read_proc_filerJs���	&��>�%+�C�5��$��#8�I�����b�k�k�B�L�L�&@��P�I�
�W�W�Y��
%���7�7�9�?�?�$�+�+�G�I�+�F�&�
%�
%���&��3�u�:�%�%��&�s<�AB!�,B�	B!�
B�B!�B!�!
C�+
B>�8C�>Cc��^�Sn[SU4SjSS9nUR5R5nSSS5 U$!,(df   U$=f![anS[	U5-sSnA$SnAff=f)z�Read /proc/pid/maps.

Since /proc/$pid/maps may become unreadable unless we are ptracing the
process, detect this, and attempt to attach/detach.
z%Error: unable to read /proc maps file�mapsc�.>�[R"XTS9$)Nr4)r7r')r0�mode�proc_pid_fds  �r�<lambda>�_read_maps.<locals>.<lambda>�s���b�g�g�d��&Mr:r )�openerr"NrA)r'rEr(r*rG)rOrLr,rIs`   r�
_read_mapsrS�su���3�D�&�
��M��
���7�7�9�?�?�$�D�
��K�
�
��K���&��3�u�:�%�%��&�s7�A�=�A�
A�A�A�
A1�
A,�&A1�,A1�command�env�timeoutc�L�[R"USSUS[R[RUS9nURS:XaUR
R5$[SUSURSUR
R535e![RavnUR
(a,SUR
R
5R53nOSn[S[UR5SURS	U35UeS
nAff=f)
z�Run command and capture its output.

Try to execute given command (argv list) and return its stdout, or return
a textual error if it failed.
Fr=r>)�checkr"rUr@�stdout�stderrrV�: z with no stdoutzError: command z timed out after z secondsNrz failed with exit code )
�
subprocess�run�PIPE�STDOUT�TimeoutExpiredrYrF�rstripr*rG�cmdrV�
returncode)rTrUrV�sprI�outputs      r�_command_outputrf�s����^�^�������?�?��$�$��	
��&
�}�}����y�y���!�!�
�
�'��"9�"�-�-��I��I�I�����	!�����$�$���<�<��%�,�,�-�-�/�6�6�8�9�:�F�&�F���c�%�)�)�n�-�.��m�m�_�H�V�H�
6�
��	���s�7B�D#�-A1D�D#c��SUR;agURGH�nUR[RR
R:XdM8URS:XdMJURSRnX0;a gUR5 UR5(dM�URSR[RR
R:XdM�URSRnXn[U[R5(a"UR!5nUR#S5nO&[U[$5(aUR#S5n[&R("U5nUR1U5(aGM� g URSR$![a GM�f=f![&R*[,[.4a GM�f=f)zpCheck if given report matches the given bug pattern XML DOM node.

Return the bug URL on match, otherwise None.
�urlN�re�keyrr=)�
attributes�
childNodes�nodeType�xml�dom�Node�ELEMENT_NODE�nodeName�	nodeValue�KeyError�	normalize�
hasChildNodes�	TEXT_NODE�
isinstance�problem_report�CompressedValue�	get_value�encode�bytesri�compilerI�	TypeErrorr�search)�report�pattern�crj�regexp�v�re_cs       r�_check_bug_patternr��sx��

�G�&�&�&��
�
�
���:�:������2�2�2�q�z�z�T�7I�
��l�l�5�)�3�3��� ��
�K�K�M���� � �Q�\�\�!�_�%=�%=������AW�AW�%W����a��2�2���K���a��!?�!?�@�@����
�A�#�]�]�7�3�F���5�)�)�#�]�]�7�3�F���:�:�f�-�D��{�{�1�~�~��/ �2���e�$�.�.�.��)�
��
�����)�Z�8����s$�)G�6G�
G�G�G8�7G8c��[RRRU5nURS5Hn[X5nU(dMUs $ g![RR
R[4a gf=f)Nr�)
rnro�minidom�parseString�parsers�expat�
ExpatError�UnicodeEncodeError�getElementsByTagNamer�)r��patternsror�rhs     r�_check_bug_patternsr��sy����g�g�o�o�)�)�(�3���+�+�I�6�� ��1���3��J�7�
��
�K�K���(�(�*<�=����s�)A�.B�
Bc�&�URH�nUR[RRR
:XaAURR5S:Xa#UR5 URU5 Mv[U5 M� g)z6Recursively remove whitespace from given XML DOM node.�N)rlrmrnrorprwrsr(�unlink�removeChild�_dom_remove_space)�noder�s  rr�r��s]��
�_�_���:�:������/�/�/�A�K�K�4E�4E�4G�2�4M�
�H�H�J����Q���a� �r:�gdb_sandbox�	same_archc�t�U(a![RRUSS5OSn[SU5nU(d=[	[
R[R"[
R5S5eU(d6[SU5nU(aUnU$[RRS5 U$)zDetermine path to GDB.�usr�binN�gdbzgdb not found in retracing envz
gdb-multiarchzWARNING: Please install gdb-multiarch for processing reports from foreign architectures. Results with "gdb" will be very poor.
)r7r0�join�_which_extrapath�FileNotFoundError�errno�ENOENT�strerror�sysrZ�write)r�r��gdb_sandbox_bin�gdb_path�mas     r�
_get_gdb_pathr�s���AL�b�g�g�l�l�;��u�=�RV�O����7�H����L�L�"�+�+�e�l�l�3�5U�
�	
��
�o��
?��
��H��O�
�J�J���'�
�
�Or:c��[RRU5(dg0n[USS9n[	[UR
5US5U5 SSS5 US"X5 g!,(df   N=f![a5n[U5RS5(aUS"U5 SnAO	eSnAff=fg![a g[a� [RR[RRU55SRS	S
5n[R "5USU-'["R$R'SU5 [R("5 gf=f)
NFr r!�exec�add_infoz
add_info()Tr�-�_�
HookError_zhook %s crashed:)r7r0�existsr'r�r~rErrGr)�
StopIteration�	Exception�splitext�basenamer>�	traceback�
format_exc�apport�loggingrI�	print_exc)r��ui�hook�symbr,rI�hooknames       r�	_run_hookr�s>��
�7�7�>�>�$����
�D��
�$��
)�R�������D�&�1�4�8�*�	����V�(� �)*�
)��
�	��5�z�$�$�\�2�2��Z� ��(�(���
	��)���������7�7�#�#�B�G�G�$4�$4�T�$:�;�A�>�F�F�s�C�P��*3�*>�*>�*@��|�h�&�'������/��6������
�sY�
C�&A.�C�"A?�.
A<�8C�?
B>�	*B9�3C�8B9�9B>�>C�
E:�B(E:�9E:c��SnU(a?[RRU[RR	SS5/5n[
R"XS9$)z.Return path of command, preferring extra_path.N�PATHr�)r0)r7�pathsepr��environ�get�shutil�which)rT�
extra_pathr0s   rr�r�<s?���D���z�z���
�B�J�J�N�N�6�2�,F�G�H���<�<��+�+r:c�J�\rSrSrSrS
SjrS\\SS4Sjr\	S5r
S	rg)�_EnvironmentiEz)Wrapper around an environment dictionary.rNc�p�URS5nUcgUS:XaUS	gSU;dSU;aSUS'gSUS'g)z/Anonymize PATH environment variable if present.r�NzG/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesz/homez/tmpz(custom, user)z(custom, no user))r�)�selfr0s  r�anonymize_path�_Environment.anonymize_pathHsM���x�x�����<���8�
8��V��
��_��$��+�D��L�.�D��Lr:�keysc�,�UHnX ;dM
SX'M g)z1Anonymize given environment variables if present.z<set>N�)r�r�rjs   r�anonymize_vars�_Environment.anonymize_varsWs���C��{�#��	�r:c	��U"URS5Vs/sHnSU;dMURSS5PM sn5$s snf)zzRead environment variables from text representation.

The environment variables are expected to be separated by newlines.
�
�=�)�split)�clsr��entrys   r�from_string�_Environment.from_string]sE���.5�m�m�D�.A�R�.A�U�S�E�\�
 �U�[�[��a�
 �.A�R�
�	
��Rs
�
A�Ar��rN)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r�rrGr��classmethodr��__static_attributes__r�r:rr�r�Es5��3�
/�$�8�C�=�$�T�$��
��
r:r�c��\rSrSrSrSDS\S\S-SS4Sjjr\S\S\4S	j5rS\S\S-4S
jr	S\S\4Sjr
SES\S-SS4SjjrS
rS\SS4Sjr
SFSjrSFSjrSFSjrS\S-4Sjr\S\S\S-4Sj5rSGS\S-S\S-S\\S-SS4SjjrSFSjrSGS\S-S\\S-S\S-SS4SjjrSES\S\\S-SS4SjjrS\4SjrSHS\S-S \S-SS4S!jjrS"rSGS#\S-S\S-S$\S-S\4S%jjrS#\S\S-S$\S-S\4S&jr S'\S-S\S-4S(jr!\S)5r"S\4S*jr#S\4S+jr$SFS,jr%S\4S-jr&S\S-4S.jr'S\S-4S/jr(S\S-4S0jr)S\S-4S1jr*S\+\4S2jr,S\S-4S3jr-\S4\S\S-4S5j5r.S\S-4S6jr/SFS7jr0S\4S8jr1SES9\S-S \S-S\2\+\\3\\444S:jjr4S;r5SFS<jr6S=\3\\74S>\S?\SS4S@jr8S=\3\\74SS4SAjr9\:SB5r;SCr<g)I�Reportimz�A problem report specific to apport (crash or bug).

This class wraps a standard ProblemReport and adds methods for collecting
standard debugging data.
N�problem_type�daterc�`�[RRXU5 SUlSUlg)aInitialize a fresh problem report.

date is the desired date/time string; if None (default), the current
local time is used.

If the report is attached to a process ID, this should be set in
self.pid, so that e. g. hooks can use it to collect additional data.
N)ry�
ProblemReport�__init__r1�_proc_maps_cache)r�r�r�s   rr��Report.__init__ts)��	�$�$�-�-�d�$�G�#���CG��r:rc�(�Sn[R"U5nU(aUSSRU5S3-
n[R"U5(d-[R"U5nU(aUSUS3-
nU$US-
nU$![
a U$f=f)z�Return a string suitable for appending to Package/Dependencies.

If package has only unmodified files, return the empty string. If not,
return ' [modified: ...]' with a list of modified files.
r�z [modified: � �]z
 [origin: z [origin: unknown])r�get_modified_filesr��is_distro_package�get_package_originr)r�suffix�mod�origins    r�_customized_package_suffix�!Report._customized_package_suffix�s������*�*�7�3�����S�X�X�c�]�O�1�5�5�F�		��.�.�w�7�7�"�5�5�g�>����
�6�(�!�4�4�F��
��2�2�F�
�
��	�	���
�		�s�AB�<B�
B�Bc��[R"U5nUSU=(d SURU53US'U$![a SnN4f=f)z�Add Package: field.

Determine the version of the given package (uses "(not installed") for
uninstalled packages) and add Package: field to report.
This also checks for any modified files.

Return determined package version (None for uninstalled).
Nr�z(not installed)�Package)rrrr��r�r�versions   r�add_package�Report.add_package�sg��	��+�+�G�4�G�
�i�q��5�$5�6��.�.�w�7�8�
:�	
�Y��
����	��G�	�s�>�A
�A
c���[5n[X5 Sn[U5H@n[R"U5nU(aUS-
nX4SUUR
U53-
nMB U$![
a MSf=f)Nr�r�r�)�setr�sortedrrrr�)r�r�dependencies_set�dependencies�depr�s      r�_get_transitive_dependencies�#Report._get_transitive_dependencies�s���%(�U�� ��;����*�+�C�
��)�)�#�.��
���$���e�1�Q�C��(G�(G��(L�'M�N�N�L�,�����
��
�s�A)�)
A7�6A7c��U(d?SU;aUSS:XaUSnO"[RRUS5nU(dgURU5nU(dSU;a[R
"U5US'U(dgSU;a[R"U5US'SU;aURU5US'gg![a NOf=f)	a�Add packaging information.

If package is not given, the report must have ExecutablePath.
This adds:
- Package: package name and installed version
- SourcePackage: source package name (if possible to determine)
- PackageArchitecture: processor architecture this package was built
  for
- Dependencies: package names and versions of all dependencies and
  pre-dependencies; this also checks if the files are unmodified and
  appends a list of all modified files
�ExecutablePath�ProblemType�KernelCrashr�N�
SourcePackage�PackageArchitecture�Dependencies)	r��	fileutils�find_file_packager�r�
get_sourcer�get_architecturerr�s   r�add_package_info�Report.add_package_info�s�����t�+��]�0C�}�0T��y�/�� �*�*�<�<�T�BR�=S�T�����"�"�7�+���o�T�1�
�(1�(<�(<�W�(E��_�%��� ��,�*3�*D�*D�W�*M�D�&�'���%�#'�#D�#D�W�#M�D�� �&���
��
�s�&C�
C�Cc�
�URS5SURS5SURSS5S3US'URS5n[S	S
SU/5US'[S	S
U/5US'[S	SSU/5USU3'SSKn[SUS3SS9nUR	U5nSSS5 SW;aUSn[S	SSU/5USU3'/nSU;aDUSH;nUSURS5n	U	(dM#X�;dM*URU	5 M= UHn
[S	SSU
/5USU
3'M URS5(a!UR
URS55 gg!,(df   N�=f)z�Add info about an installed Snap.

This adds a Snap: field, containing name, version and channel.
It adds a SnapSource: field, if the snap has a Launchpad contact
defined.
�namer�r�z (�channel�unknown�)�Snap�snap�changesz
--abs-time�SnapChanges�connections�SnapConnections�infoz	SnapInfo.rNz/snap/z/current/meta/snap.yamlr r!�base�plugszdefault-provider�contact)r�rf�yamlr'�	safe_load�append�add_snap_contact_info)r�r�snapnamer!�f�	snap_metar�	providers�plug�dp�providers           r�
add_snap_info�Report.add_snap_info�s����x�x��� ��$�(�(�9�"5�!6�����)�Y�/�0��
3�	
�V���8�8�F�#��-�
�Y��h�7�
��]��#2�6�=�(�2S�"T��
��'6�
�V�\�8�4�(
��y��
�
#�$�	�
�F�8�*�$;�<�w�
O�ST����q�)�I�P��Y���V�$�D�'6����t�4�(�D�9�T�F�#�$��	��i��!�'�*���w�'��-�1�1�2D�E���2�"�-��$�$�R�(�+�"�H�+:����x�8�,�D�9�X�J�'�(�"�
�8�8�I����&�&�t�x�x�	�':�;��%P�
O�s�E4�4
F�snap_contactc��Sn[R"U[RR	U55nU(aTURS5(a>URS5US'URS5(aURS5US'Sn[R"U[RR	U55nU(a.URS5US'URS5US'S	US
'gg)z�Load report with information about where it should be filed.

Parse project (e.g. 'subiquity') or source package string
(e.g. 'ubuntu/+source/gnome-calculator') from snap 'contact'.
Additionally, extract any tag/tags defined in the contact URL.
ze^https?:\/\/.*launchpad\.net\/(?:distros/)?((?:[^\/]+\/\+source\/)?[^\/]+)(?:.*field\.tags?=([^&]+))?r��
SnapSource��SnapTagsz'^https?://.*github\.com/([^/]+)/([^/]+)�SnapGitOwner�SnapGitNamezsnap-github�CrashDBN)rir��urllib�parse�unquote�group)r�r.�p�ms    rr$�Report.add_snap_contact_infos���
J�	
�
�I�I�a����-�-�l�;�<���������!"�����D����w�w�q�z�z�#$�7�7�1�:��Z� �
7���I�I�a����-�-�l�;�<���#$�7�7�1�:�D�� �"#�'�'�!�*�D���+�D��O�
r:c��SU;a*[RR5upUSU3US'SU;a+[R"5nUSSUSSUS3US'SU;a[R
"5US'gg)	z�Add operating system information.

This adds:
- DistroRelease: NAME and VERSION from /etc/os-release, or
  'lsb_release -sir' output
- Architecture: system architecture in distro specific notation
- Uname: uname -srm output
�
DistroReleaser��Unamerr1��ArchitectureN)r�r�get_os_versionr7�uname�get_system_architecture)r��osname�	osversion�us    r�add_os_info�Report.add_os_info+s����$�&� &� 0� 0� ?� ?� A��F�'-�h�a�	�{�$;�D��!��$�����
�A� ��t�f�A�a��d�V�1�Q�q�T�F�3�D��M���%�#,�#D�#D�#F�D�� �&r:c
��[R"[R"55Sn[
RR5n[R"5VVVVs/sHup4pVX;dM
XR::dMUPM nnnnnUR5 U(aSRU5US'gSUS'g![a gf=fs snnnnf)zWAdd information about the user.

This adds:
- UserGroups: system groups the user is in
rNr��
UserGroupszN/A)�pwd�getpwuidr7�geteuidrtr�r�get_sys_gid_max�grp�getgrall�sortr�)r��user�sys_gid_maxrr:�gid�memb�groupss        r�
add_user_info�Report.add_user_info=s���	��<�<��
�
��-�a�0�D��&�&�6�6�8��'*�l�l�n�
�&4�"����|�
� #� 2�
�&4�	�
�
	���
��!$���&�!1�D���"'�D�����	��	��
s#�,B:�&C

�6C

�=C

�:
C�Cc�(^�SU;ag[RRUS5m[[	U4Sj[
55(dgSnUSR
5H"nURSS5up4US:XdM Un O U(dgUSRS	5n/S
Qn[U5S:�a�USRS5(a�URS
5(aLUSS:XaC[U5S:�a4URUS5nU(a
USUS'XpS'gSUS3US'gUS	[U5S:�aUSRS5(aM�[U5S:�a�USRS5(a/SU;a)[RRUSUS5US'[R"US[R5(a-USUS'[RRUS5US'SU;a�UT:wa�UH�n[R"X�S-[R5(dM4X�S-n	[RR[RRU	55U:XaUSUS'X�S' O SU;aQ[RRUS5S:Xa*USUS'UR!5n
U
(aX�S'gSUS'ggg![a GM�f=f)z�Check if process is a script.

Use ExecutablePath, ProcStatus and ProcCmdline to determine if
process is an interpreted script. If so, set InterpreterPath
accordingly.
rNc�2>�[R"TU5$�N)�fnmatch)�i�exebasenames �rrP�+Report._check_interpreted.<locals>.<lambda>hs���G�O�O�K��$Cr:�
ProcStatus�	r�zName:�ProcCmdline�)z	/usr/bin/z
/usr/sbin/z/bin/z/sbin/r1r��pythonz-m��InterpreterPathz'Cannot determine path of python module �UnreportableReason�.�ProcCwdr�twistdz&Cannot determine twistd client program)r7r0r��any�filter�interpreters�
splitlinesr�r�lenr)�_python_module_pathr��access�R_OK�realpath�_twistd_executable)r�rr-�kr��cmdargs�bindirsr0r:�argvexe�exer_s           @r�_check_interpreted�Report._check_interpretedWs����4�'���g�g�&�&�t�,<�'=�>��
�6�C�\�R�S�S������&�1�1�3�D�
����D�!�,����G�|����4����}�%�+�+�D�1��@���'�l�a��G�A�J�$9�$9�#�$>�$>����x�(�(�W�Q�Z�4�-?�C��L�TU�DU��/�/���
�;���.2�3C�.D�D�*�+�-1�)�*�
�B�'�!�*��N��-�.����
��'�l�a��G�A�J�$9�$9�#�$>�$>� �w�<�1���q�z�$�$�S�)�)�i�4�.?��W�W�\�\�$�y�/�7�1�:�F���
��y�y����R�W�W�-�-�*.�/?�*@��&�'�)+���)9�)9�'�!�*�)E��%�&��D�(�T�[�-@����9�9�Q���^�R�W�W�5�5��!�*�n�G��w�w�'�'����(8�(8��(A�B�d�J�26�7G�2H��.�/�18�-�.��
�
��%���� � ��&6�!7�8�H�D�&*�+;�&<�D�"�#��)�)�+�C��),�%�&�-U��)�*�E�
&��c�
��
�s�'L�
L�Lc��USRS5SSnU(a�USRSS5nUSRS5(d2USRS	5(dUSRS
5(a[U5S:XaUS$US$[US5S:�a7USSS:Xa+USSS:waUSSSnSU;dS
U;dSU;aUS$URS5 U(aM�g)z5Determine the twistd client program from ProcCmdline.rcrdr1Nrr�r�z--filez--pythonz--sourcer�r&�y�s)r�r)rp�pop)r��args�arg�optss    rru�Report._twistd_executable�s���M�"�(�(��.�q�r�2����q�'�-�-��Q�'�C��A��!�!�(�+�+��q�6�$�$�Z�0�0��q�6�$�$�Z�0�0��s�8�q�=��q�6�M��A�w���3�q�6�{�Q��3�q�6�!�9��#3��A��q�	�S�8H��1�v�a�b�z���$�;�#��+������7�N��H�H�Q�K��d�"r:�modulec��[RRU5nUcgUR$![a gf=f)z&Determine path of given Python module.N)�	importlib�util�	find_spec�ImportErrorr�)r��specs  rrq�Report._python_module_path�sC��	��>�>�+�+�F�3�D��<���{�{���	�	��	�s�1�
>�>r1rO�extraenvc��U(d�U(d(UR=(d [R"5nUR(dXl[R"SU3[R[R
-[R-5n[SX5US'URXUS9 [SX5US	'[S
X5RS5US'[!U5US
'SU;a[SX5US'SH9nUSR#SUS35(dM"US[%SU35SUS' O [R&R)US5(d[USS35eUR+5 UR-5 USR/SS5R/SS5R/SS5US'[R0"5S:Xa[SX5nUS:waX`S'ggg![an[S5UeSnAf[a0nUR[R:Xa[S5UeeSnAff=f![a GN�f=f![an[S5UeSnAf[a0nUR[R:Xa[S5UeeSnAff=f![a gf=f)a�Add /proc/pid information.

If neither pid nor self.pid are given, it defaults to the process'
current pid and sets self.pid.

This adds the following fields:
- ExecutablePath: /proc/pid/exe contents; if the crashed process is
  interpreted, this contains the script path instead
- InterpreterPath: /proc/pid/exe contents if the crashed process is
  interpreted; otherwise this key does not exist
- ExecutableTimestamp: time stamp of ExecutablePath, for comparing at
  report time
- ProcEnviron: A subset of the process' environment (only some standard
  variables that do not disclose potentially sensitive information,
  plus the ones mentioned in extraenv)
- ProcCmdline: /proc/pid/cmdline contents
- ProcStatus: /proc/pid/status contents
- ProcMaps: /proc/pid/maps contents
- ProcAttrCurrent: /proc/pid/attr/current contents, if not "unconfined"
- CurrentDesktop: Value of $XDG_CURRENT_DESKTOP, if present
r5znot accessibleNzinvalid process�cwdrj)r1rOr��statusra�cmdlinerdrc�ProcMapsrrz)�rofs�rwfs�	squashmnt�
persistmntr6z does not exist�\z\\r�z\ rzattr/current�
unconfined�ProcAttrCurrent)r1r7�getpidr'rB�O_PATH�O_DIRECTORY�PermissionErrorrr*r�r�r9�add_proc_environrJrarSr)rpr0r�r{�_add_executable_timestampr>�getuid)r�r1rOr�rIr:�vals       r�
add_proc_info�Report.add_proc_info�s���:���h�h�-�"�)�)�+���8�8���	
� �g�g��S�E�N�B�K�K�"�)�)�$;�b�n�n�$L���	�-�e�S�F�D��O�	
���#���R�,�X�s�H��\��-�i��J�Q�Q�RV�W��]��%�k�2��Z���4�'�
�)8���)Q��%�&�=�A��$�%�0�0�1�Q�C�q��:�:�)-�.>�)?��a��s�G���)O��%�&��=��w�w�~�~�d�#3�4�5�5���%5� 6�7��G�H�H�	
���!��&�&�(�
���
�W�T�6�
"�
�W�S�%�
 �
�W�T�3�
�		
�]��	��y�y�{�a��%�n�c�G���,�&�.1�*�+�'� ��c#�
>� �!1�2��=���
��;�;�%�,�,�.�$�%6�7�U�B���
���	��	��#�
>� �!1�2��=���
��;�;�%�,�,�.�$�%6�7�U�B���
��B�	��	�sm�A
H�I"�;I3�/K	�
I�H"�"
I�/+I�I�"
I0�/I0�3
K�=J	�	
K�+K�K�	
K�Kc�t�[[[R"US5R55US'g)Nr�ExecutableTimestamp)rG�intr7�stat�st_mtime)r�s rr�� Report._add_executable_timestamp,s,��&)�#�b�g�g�d�;K�6L�.M�.V�.V�*W�&X��
"�#r:c��U(dfU(d[R"5n[R"SU3[R[R-[R
-5n[
[RRU55nURXB5 g![anSU3US'SnAgSnAff=f)alAdd environment information.

If pid is not given, it defaults to the process' current pid.

This adds the following fields:
- ProcEnviron: A subset of the process' environment (only some standard
  variables that do not disclose potentially sensitive information,
  plus the ones mentioned in extraenv)
- CurrentDesktop: Value of $XDG_CURRENT_DESKTOP, if present
r5rA�ProcEnvironN)r7r�r'rBr�r�r�r�r�get_process_environr*�_add_environ)r�r1r�rOr�rIs      rr��Report.add_proc_environ/s��� ���i�i�k���'�'��������b�i�i� 7�"�.�.� H��K�	�"�6�#3�#3�#G�#G��#T�U�G�	
���'�,���	�$+�E�7�"3�D�����	�s�/(B)�)
C�3C�Cr�c�h�1SknU1Sk-nU(aU[U5-nUR5 URU5 SU;aUSUS'SR[	UR55VVs/sH$upVXT;dMUS3UR
SS5-PM& snn5US'gs snnf)	N>�
LD_PRELOAD�LD_LIBRARY_PATH�XDG_RUNTIME_DIR>�LANGr��TERM�SHELL�LC_NAME�LC_TIME�LOCPATH�LANGUAGE�LC_CTYPE�LC_PAPER�
LC_ADDRESS�
LC_COLLATE�
LC_NUMERIC�LC_MESSAGES�LC_MONETARY�LC_TELEPHONE�LC_MEASUREMENT�LC_IDENTIFICATION�XDG_CURRENT_DESKTOP�CurrentDesktopr�r��\nr�)r�r�r�r�r��itemsr>)r�r�r�r��	safe_varsrj�values       rr��Report._add_environMs���N��"�&
�
�	�(���X��&�I���� ����~�.� �G�+�%,�-B�%C�D�!�"�"�i�i�#)�����"9�
�"9�J�C��#�7�3�%�q�	�E�M�M�$��6�6�"9�
�
��]���
s�7B.
�B.
c	�@�SU;ag[R"SS9n[USS5(aUSRU5 OURUS5 UR	5 USR5SnSS	U3UR/n[R"USS
[R[RS9nURS
:HnU(aURUS'SSS5 U$![a SSS5 gf=f!,(df   W$=f)zGAdd information from kernel crash.

This needs a VmCore in the Report.
�VmCoreF�apport_vmcore_��prefixr�r?r��crashz/usr/lib/debug/boot/vmlinux-sbt -a -f
ps
runq
quit
)rX�inputrYrZNr�
Stacktrace)�tempfile�NamedTemporaryFile�hasattrr��flushr�rr\r]r^r_r*rcrY)r��core�kverrTr��rets      r�add_kernel_crash_info�Report.add_kernel_crash_infous��
�4���
�
(�
(�0@�
A�T��t�H�~�w�/�/��X��$�$�T�*��
�
�4��>�*��J�J�L���=�&�&�(��+�D��">�t�f� E�t�y�y�Q�G�	
�"�����7�%�?�?�%�,�,����"�"�a�'�C��%*�\�\��\�"�-B�.�
��
�
��%B�
A�"
��#B�
A�.�
�s0�A6D�4C6�%D�6
D�D�
D�D�
D�rootdirr�c�2�SU;dSU;agSSSSSS	S
S.nURX5upESUS
'U/SQ-
n/nUR5HupxURU5 USSSU/-
nM! URS5 USS/-
n[XES9n	SU	;dSU	;a�SU	;a9SR	U	R5V
s/sH
n
SU
;dMU
PM sn
5nORSU	;a9SR	U	R5V
s/sH
n
SU
;dMU
PM sn
5nOU	R5SnSUR
5-nX�S'[U5eU	RSSS9Sn
U
RS5(a=[[R[R"[R5S5e[R "S[R"5nURU	5nUR%S5 UH4nUR'S S!5R
5XR%S5'M6 S"U;aS#US";aUS"US$'US"	S%U;a$US%R)S&5(aUS%US$'US%	S$U;a][R*"S'US$5nU(a9UR-S5US$'US$RS(5(aUS$SS)US$'OUS$	S*U;a.UR/5 UR15nU(aUUS+'gggs sn
fs sn
f),a�Add information from gdb.

This requires that the report has a CoreDump and an
ExecutablePath. This adds the following fields:
- Registers: Output of gdb's 'info registers' command
- Disassembly: Output of gdb's 'x/16i $pc' command
- Stacktrace: Output of gdb's 'bt full' command
- ThreadStacktrace: Output of gdb's 'thread apply all bt full' command
- StacktraceTop: simplified stacktrace (topmost 5 functions) for inline
  inclusion into bug reports and easier processing
- AssertionMessage: Value of __abort_msg, __glib_assert_msg, or
  __nih_abort_msg if present

The optional rootdir can specify a root directory which has the
executable, libraries, and debug symbols. This does not require
chroot() or root privileges, it just instructs gdb to search for the
files there.

Raises a OSError if the core dump is invalid/truncated, or OSError if
calling gdb fails, or FileNotFoundError if gdb or the crashing
executable cannot be found.
�CoreDumprNzinfo registersz	x/16i $pczbt fullzthread apply all bt fullzprint __abort_msg->msgzprint (char*) __glib_assert_msgzprint (char*) __nih_abort_msg)�	Registers�Disassemblyr��ThreadStacktrace�AssertionMessage�GLibAssertionMessage�NihAssertionMessagez/nonexistent�HOME)z--batch�--exzset backtrace limit 2000z-iexzset debuginfod enable offr�zp -99�	separator)rUz%is truncated: expected core file sizezis not a core dumpzwarning:r�zWarning:rzInvalid core dump: rhr�)�maxsplitzNo such file or directory.z&executable file for coredump not foundz^\$\d+\s*=\s*-99$z

z
.
r�z"ERROR:r�r��$z(^\$\d+\s+=\s+0x[0-9a-fA-F]+\s+"(.*)"\s*$r����r��StacktraceAddressSignature)�gdb_commandr�r#rfr�ror(r*r��endswithr�r�r�r7r�rir~�	MULTILINEr�r>r)�matchr9�_gen_stacktrace_top�crash_signature_addresses)r�r�r��gdb_reports�gdb_cmdr��
value_keysrrb�outr-�warnings�reason�
first_line�part_re�parts�partr;�addr_signatures                   r�add_gdb_info�Report.add_gdb_info�sZ��6�T�!�%5�T�%A��*�&�#� :� 8�$E�#B�
�� �+�+�G�A���(�����
�	
���
�$�*�*�,�I�D����d�#������5�5�G�-�	���+�&��F�G�$�$���g�3��
4�s�:�#�s�*��S� ��9�9�&)�n�n�&6�M�&6�d�*��:L�T�&6�M����s�"��9�9�&)�n�n�&6�M�&6�d�*��:L�T�&6�M����>�>�+�A�.��*�X�^�^�-=�=�F�)/�%�&��&�/�!��Y�Y�t�a�Y�0��3�
����;�<�<�#�������E�L�L�)�8��
��*�*�1�2�<�<�@���
�
�c�"��
�	�	�!���D�&*�l�l�6�7�&C�&I�&I�&K�D����"�#��
"�T�)��D�!7�8�8�+/�0F�+G��'�(��+�,�!�D�(��)�*�5�5�c�:�:�+/�0E�+F��'�(��*�+���%����;�T�BT�=U��A��+,�7�7�1�:��'�(��*�+�4�4�U�;�;�/3�4F�/G��"�/M�D�+�,���+�,��4���$�$�&�!�;�;�=�N��5C��1�2�� ��mN��Ns�<
L�
L�;
L�	Lc�$�[/SQ5nS/S-nSnSnSnSn[R"S5n[R"S5n[R"S5n	US	R5GHyn
UR	U
5nU(dUR	U
5nU(dM6U(aU(a�URS
5(a5URS
5R
5SR
S5SnOSnU(a'U(aURS
5(dUS;aM�SnURS5(dX�;a-SnSnS/S-nURS5(aSnUS:XaSnGMSnURS
5=(d URS5n
U
R
5SnU[U5:dGMWU	R	U5(aGMpX�U'US-
nGM| SRU5R5US'g)z�Build field StacktraceTop as the top five functions of Stacktrace.

Signal handler invocations and related functions are skipped since they
are generally not useful for triaging and duplicate detection.
)�g_logv�g_log�	IA__g_log�
IA__g_logv�g_assert_warning�IA__g_assert_warning�
__GI_abort�_XErrorr��rFzD^#(\d+)\s+(?:0x(?:\w+)\s+in\s+\*?(.*)|(<signal handler called>)\s*)$z0^#(\d+)\s+(?:(.*)|(<signal handler called>)\s*)$z,^(__.*_s?sse\d+(?:_\w+)?|__kernel_vsyscall)$r�r1�(N�_X>�XWindowEvent�handle_error�handle_responserfTrr�r��
StacktraceTop)r�rir~ror�r9r�r)rpr�r()r��unwind_functions�toptrace�depth�unwound�	unwinding�unwinding_xerror�bt_fn_re�bt_fn_noaddr_re�ignore_functions_rer-r;�fn�frame�functions               rr��Report._gen_stacktrace_tops����	
�
���4�!�8�������	� ���:�:�S�
���*�*�?�
��!�j�j�;�
����&�1�1�3�D����t�$�A��#�)�)�$�/�����i��7�7�1�:�:������)�)�+�A�.�4�4�S�9�!�<�B��B�$���M�M�$�/�/��!T�T� �',�$��7�7�1�:�:��!7� $�I��E� "�t�a�x�H��w�w�q�z�z�#'���Y��+/�(��!�	��G�G�A�J�,�!�'�'�!�*�E��{�{�}�Q�'�H��s�8�}�$�-@�-F�-F�x�-P�-P�"'�����
��U4�V!%�	�	�(� 3� 9� 9� ;��_�r:r��
srcpackagec�|�Uc
[5nURXU5nURSS5 [5 U$)asRun hook script for collecting package specific data.

A hook script needs to be in PACKAGE_HOOK_DIR/<Package>.py or in
GENERAL_HOOK_DIR/*.py and has to contain a function 'add_info(report,
ui)' that takes and modifies a Report, and gets an UserInterface
reference for interactivity.

return True if the hook requested to stop the report filing process,
False otherwise.
N�	_HooksRun)r�_add_hooks_infor�r)r�r�rrr�s     r�add_hooks_info�Report.add_hooks_infods<�� �:�%�'�B��"�"�2�
�;������d�#����
r:c�l�U(dURS5nU(a"UR5SnSU;a	SU3US'gU(dURS5nU(a"UR5SnSU;a	SU3US'g[/nSn[RRURS	S
55nUR
[5(aUnOsU(al[RRU5HGnUR
[5(dM[RRU5(dMEUn O U(a�[U5[[5:�anUR[RRUSSS
55 [RR!U5n[U5[[5:�aMn[#[$R$"[&S-55Hn[)XU5(dM g U(a<UH6n	[)X[RRX�S-55(dM6 g U(a>UH8n	[)X[RRU	SUS355(dM8 g g![a GNgf=f)Nr�rr6zinvalid Package: rhFr	zinvalid SourcePackage: rr��sharer�z
package-hooksz/*.pyTz.py�source_)r�r��PACKAGE_HOOK_DIRr7r0rtr)�_opt_dirr�r�	get_files�isfilerrpr#r��dirnamer��glob�GENERAL_HOOK_DIRr�)
r�r�rr�	hook_dirs�opt_path�	exec_pathr&r��hook_dirs
          rr�Report._add_hooks_info{s.����h�h�y�)�G���m�m�o�a�(�G��g�~�/@��	�-J��)�*������/�2�J��#�)�)�+�A�.�J��j� �/F�z�l�-S��)�*��%�&�	����G�G�$�$�T�X�X�.>��%C�D�	�����)�)� �H�
�
��)�)�3�3�G�<�A��|�|�H�-�-�"�'�'�.�.��2C�2C�#$���=���h�-�3�x�=�0�� � ��G�G�L�L��7�H�o�N���7�7�?�?�8�4��	�h�-�3�x�=�0��4�9�9�%5��%?�@�A�D���4�(�(��B�
�%���T�r�w�w�|�|�H��o�'N�O�O��&�
�%����b�g�g�l�l�8�w�z�l�#�5N�O��� �	&���=�
��
�s$� :J%�"J%�J%�J%�%
J3�2J3rhc��U(dg[RRU5nUR5R	SSS9nSSS5 SW;ag[
X5nU(aU$g!,(df   N*=f![
a gf=f)a�Check bug patterns loaded from the specified url.

Return bug URL on match, or None otherwise.

The url must refer to a valid XML document with the following syntax:
root element := <patterns>
patterns := <pattern url="http://bug.url"> *
pattern := <re key="report_key">regular expression*</re> +

For example:
<?xml version="1.0"?>
<patterns>
    <pattern url="http://bugtracker.net/bugs/1">
        <re key="Foo">ba.*r</re>
    </pattern>
    <pattern url="http://bugtracker.net/bugs/2">
        <re key="Package">^\\S* 1-2$</re>
        <!-- test for a particular version -->
        <re key="Foo">write_(hello|goodbye)</re>
    </pattern>
</patterns>
Nr=r>r?z<title>404 Not Found)r6�request�urlopenrErFr*r�)r�rhr2r�s    r�search_bug_patterns�Report.search_bug_patterns�s��0��	����'�'��,��"�<�<�>�0�0���0�K��-�"�X�-��!�$�1����J��-�,���	��	�s.�A=�A,�A=�,
A:�6A=�:A=�=
B
�	B
c�d�[R"[R"55Sn[RSU5nSnSnSn[R"U[R[R-5n[R"U5n[R"UR5(a([R"US5nURS5nUbUR!5 OUb[R "U5 US:Xa0["R$R'5R)SSS5nO*["R$R*R-U5nUR8R;5 [=UR85 U$![a N�f=f!UbUR!5 fUb[R "U5 ff=f!["R.R0R2a#n[5[S[7U535UeSnAff=f)	z�Read ignore list XML file and return a DOM tree.

Return an empty DOM tree if file does not exist.

Raises ValueError if the file exists but is invalid XML.
r�~r�N�riP�r�z has invalid format: )rLrMr7rN�_ignore_filer>r'�
O_NOFOLLOWrB�fstatr��S_ISREG�st_mode�fdopenrEr*�closernro�getDOMImplementation�createDocumentr�r�r�r�r�rrG�documentElementrur�)�homedir�ifpath�contentsr,r&�strorIs        r�_get_ignore_dom�Report._get_ignore_dom�s����,�,�r�z�z�|�,�Q�/���%�%�c�7�3����
����
	�����������!<�=�B����"��B��|�|�B�J�J�'�'��I�I�b�#�&���6�6�%�=���}����	���������r�>��'�'�.�.�0�?�?��h�PT�U�C�
��g�g�o�o�1�1�(�;��	���%�%�'��#�-�-�.��
��1�	��	���}����	�������� ���;�;�$�$�/�/�
� �#�n�$9�#�e�*��F�����
�s=�
BF!�)G$�!
F.�+F1�-F.�.F1�10G!�$(H/�H*�*H/c��[US5nURS5nU(aU$[R"U5R$![
a SU3s$f=f)N�Signal�
SignalNamezsignal )r�r��signal�Signalsrr)r��
signal_number�signal_names   r�_get_signal_name�Report._get_signal_names]���D��N�+�
��h�h�|�,�����	-��>�>�-�0�5�5�5���	-��]�O�,�,�	-�s�A
�
A�Ac��SU;deUS[[5;dUS[[5;ag[[[55nU[[[
55-nU(a
USU;agUR
5n[[R "US5R"5nUR'S5H=nUR)S5US:XdM[+UR)S55U:�dM= g g![[4a7 [RRS5 [R"5 gf=f![$a gf=f![[4a gf=f)aCheck if current report should not be presented.

Reports can be suppressed by per-user denylisting in
~/.apport-ignore.xml (in the real UID's home) and
/etc/apport/report-ignore/. For environments where you are only
interested in crashes of some programs, you can also create an
allowlist in /etc/apport/report-only/, everything which does not
match gets ignored then.

This requires the ExecutablePath attribute. Throws a ValueError if the
file has an invalid format.

Privileges may need to be dropped before calling this.
rTzCould not get ignore file:F�ignore�program�mtime)r/�
_DENYLIST_DIR�_LEGACY_DENYLIST_DIRr��_ALLOWLIST_DIR�_LEGACY_ALLOWLIST_DIRrGrrtr�r�rIr�r�r�r7r�r�r*r��getAttribute�float)r��	allowlistro�	cur_mtimerSs     r�
check_ignored�Report.check_ignored%sv�� �4�'�'�'�� �!�%B��&
�
�
�"�
#�'D� �(
�
���5�n�E�F�	��S�6�7L�M�N�N�	���.�/�y�@��	��&�&�(�C�	��B�G�G�D�)9�$:�;�D�D�E�I�	��2�2�8�<���&�&�y�1�T�:J�5K�K��V�0�0��9�:�i�G�#�=���)�H�%�	��N�N� � �!=�>����!��	���	��	���H�%�	���	�sI�;D�,E�9*E&�'E&�E&�	E&�AE�E�
E#�"E#�&E9�8E9c�J�SU;deUR5n[[[R"US5R
55nURS5H/nURS5US:XdMURSU5  OU URS5nURSUS5 URSU5 URRU5 [R "[R""55Sn[$R'SU5n[)USS	S
9nUR+USSS
9 SSS5 UR-5 g![a)nUR[R:XaSnAgeSnAff=f!,(df   NU=f)aFIgnore future crashes of this executable.

Add a ignore list entry for this report to ~/.apport-ignore.xml, so
that future reports for this ExecutablePath are not presented to the
user any more.

Throws a ValueError if the file already exists and has an invalid
format.

Privileges may need to be dropped before calling this.
rNrSrTrUrr7�wr r!z  r�)�	addindent�newl)rGrGr�r7r�r�r*r�r�r�rZ�setAttribute�
createElementrB�appendChildrLrMrNr9r>r'�writexmlr�)	r�rorUrIrS�erC�ignore_file_pathr,s	         r�mark_ignore�Report.mark_ignore\sd�� �4�'�'�'��"�"�$��	���B�G�G�D�)9�$:�;�D�D�E�F�E��.�.�x�8�F��"�"�9�-��6F�1G�G��#�#�G�U�3��9��!�!�(�+�A�
�N�N�9�d�+;�&<�=�
�N�N�7�E�*����+�+�A�.��,�,�r�z�z�|�,�Q�/��'�/�/��W�=��
�"�C�'�
:�b��L�L��t�$�L�7�;�	�
�
���5�	��{�{�e�l�l�*����		��.;�
:�s)�5E�3F�
F�(F�F�F�
F"c�"�URS5(dgUSR5Vs/sHoRS5PM nn[U5S:aUR	S5S:H$UR	S5[U5S-:*$s snf)z�Check whether StackTrace can be considered 'useful'.

The current heuristic is to consider it useless if it either is shorter
than three lines and has any unknown function, or for longer traces, a
minority of known functions.
rF�??rfTrg@)r�ror)rp�count)r�r&�
unknown_fns   r�has_useful_stacktrace�Report.has_useful_stacktrace�s����x�x��(�(��26��2G�2R�2R�2T�U�2T�Q�l�l�4�(�2T�
�U��z�?�Q���#�#�D�)�Q�.�.�����%��Z��3�)>�>�>��Vs�Bc��URSS5R5H/nURS5SR5nUS:wdM-Us $ g)z)Return topmost function in StacktraceTop.rr�r	rrmN)r�ror�r()r�r-�fnames   r�stacktrace_top_function�Report.stacktrace_top_function�sL���H�H�_�b�1�<�<�>�D��J�J�s�O�A�&�,�,�.�E���}���?�
r:c��USR5n[U5S:ag[U5S:a*[RR	US5SUS3$[
R"S5n[U5S-
nSnUS:�aJURX5nU(a#URS5nURS	5nO
US-nUS:�aMJ[RR	US5nUS
nURS5Sn	[
R"S[
R"U	5S
3U5nU(aURS5n
OSn
US:XaWUS:XaSnOUnOUS3nUSU	SU3nU
(aUSU
3-
nU$)N�	Tracebackr�rfr� crashed with rz^\s*File\s*"(\S+)".* in (.+)$rr1����:�^z: (.+)$�<module>�__main__�()� in r[)rorpr7r0r�rir~r�r9r��escape)
r��trace�trace_rer^rr;�module_pathr0�	last_line�	exception�message�context�titles
             r�_get_python_exception_title�"Report._get_python_exception_title�s����[�!�,�,�.���u�:��>���u�:��>��7�7�#�#�D�)9�$:�;�<� ��q��
�,�
�
�:�:�>�?����J��N�����1�f����u�x�(�A���g�g�a�j���7�7�1�:���
��F�A�
�1�f��w�w����%5� 6�7���"�I�	��O�O�C�(��+�	��H�H�q����9�-�.�g�6�	�B����g�g�a�j�G��G��z�!��d�#3�4�4�$��&��!�
�"�o�G��&��y�k��g�Y�?����r�'��^�#�E��r:c��UR5nU(aSUS3nOSnSnSU;a$SU;aUSUS:waUSS:wa	SUSS3n[RRUS	5S
UR	5UU3$)Nrr~r�rAr
�allz
 [non-native z	 package]rrx)rtr7r0r�rP)r�r�
arch_mismatchs   r�_get_signal_crash_title�Report._get_signal_crash_title�s���
�
)�
)�
+��
���t�2��B��B��
��d�"�%��-��^�$��-B�(C�C��*�+�u�4�+�D�1F�,G�+H�	�R�M��w�w����%5� 6�7�8��T�2�2�4�5�b�T�-��
J�	
r:c�:�URS5S:Xa6SU;a0SU;a*[RRUS5SUS3$SU;aSU;aSU;aUR	5$SU;aSU;aUR5$URS5S	:XaCS	U;a=S
US	S3nURS5(aUS
USR
5S--
nU$URS5S:XaOSU;aIUSnURS5(aURSS5SnU$URSS5SnU$URS5S:XaASU;a;SnSU;aUSUS-S--
nXSS--
nSU;aUSUS-S--
nUS-
nU$g) a*Create an appropriate title for a crash database entry.

This contains the topmost function name from the stack trace and the
signal (for signal crashes) or the Python exception (for unhandled
Python exceptions).

Return None if the report is not a crash or a default title could not
be generated.
rJ�6rr�z assert failure: rrwrr�zpackage z failed to install/upgrade�ErrorMessager[ry�
KernelOops�OopsTextz$------------[ cut here ]------------r�r1r�r�Failurer��MachineType�[z] z failure�NonfreeKernelModulesz [non-free: r�N)	r�r7r0r�r�r�ror)r�)r�r��oopss   r�standard_title�Report.standard_title�s���
�H�H�X��#�%� �D�(�"�d�*��7�7�#�#�D�)9�$:�;�<�=��+�,�-�/�
�
�t�� 0�D� 8�_�PT�=T��/�/�1�1��$��#3�t�#;��3�3�5�5��8�8�M�"�i�/�I��4E��t�I��/�/I�J�E��x�x��'�'����^� 4� ?� ?� A�"� E�E�E���L��8�8�M�"�l�2�z�T�7I��
�#�D����E�F�F��
�
�4��+�A�.���L��
�
�4��+�A�.���L��8�8�M�"�l�2�y�D�7H��E���$���t�M�2�2�T�9�9���)�_�z�1�1�E�%��-���$�/E�*F�F��L�L���T�M�E��L�r:c�j�/nURSS5S-URSS5-R5HvnU(dMUR5SSup4[R"U5nUcM<US:wdMDUcMI[R
"XE5S:dMeUR
U5 Mx U$)	z=Return list of obsolete packages in Package and Dependencies.r�r�r�rNr1�Noner)r�ror�r�get_available_version�compare_versionsr#)r��obsoleter-�pkg�ver�avails      r�obsolete_packages�Report.obsolete_packages#s������H�H�Y��#�d�*�T�X�X�n�b�-I�I�
�*�,��D����z�z�|�B�Q�'�H�C��3�3�C�8�E����6�M��%��.�.�s�:�Q�>�����$���r:c�l	�SU;a
USS;agSU;anUSS:XaeSn[R"S5nUSR5H4nURU5nU(dMUS	UR	S
5--
nM6 U$URS5S:Xa,S
U;a&USS	-US
-n[R"SSU5$SU;a�SU;a�USS	US3n[R"S5nUSR5n[U5S:agUHLnURU5nU(a1US	UR	S
5=(d UR	S5--
nML g U$SU;GawUSR5nSn[U5S
:Xa<[R"SUS5nU(dgUSS	-UR	S
5-$[U5S:ag[R"S5nUH�nURU5nU(dMUR	S5S:waUS	UR	S5--
nMKUR	S
5n	[RRU	5(a[RRU	5n	US	U	SUR	S53-
nM� USRS	5Sn
U
SUSS3-
n
USS	-U
-U-$USS:XaaS U;a[S!US ;d	S"US ;aIUS nURS#5(aUS	US#3-
nURS$5(aUS	US$3-
nU$S%U;GaIS&n/nUS%RS'5GHnURS(5(aQ[R"S)U5n
U
(a3U
R	S
5nU(d
S*U35eUR!U5 URS+5(a-UR#U5nU(aUR!U5 M�M�URS,5(aS-nM�U(dM�SnU(a8USS.:Xa/UR#U5nU(aUR!U5 GMGMS&nGM U(aS	R%U5$g![a GN�f=f)/aPGet a signature string for a crash.

This is suitable for identifying duplicates.

For signal crashes this the concatenation of ExecutablePath, Signal
number, and StacktraceTop function names, separated by a colon. If
StacktraceTop has unknown functions or the report lacks any of those
fields, return None. In this case, you can use
crash_signature_addresses() to get a less precise duplicate signature
based on addresses instead of symbol names.

For assertion failures, it is the concatenation of ExecutablePath
and assertion message, separated by colons.

For Python crashes, this concatenates the ExecutablePath, exception
name, and Traceback function names, again separated by a colon.

For suspend/resume failures, this concatenates whether it was a suspend
or resume failure with the hardware identifier and the BIOS version, if
it exists.
rr>r�rNr�r�kernelz^\s*\#\d+\s\[\w+\]\s(\w+)rzr�rJr�r�z0x[0-9a-f]{6,}�ADDRrz.^(?:([\w:~]+).*|(<signal handler called>)\s*)$r1rwr�z(\w+): rrfz)^\s+File "([^"]+).*line (\d+).*\sin (.*)$r|�@ryr	�_PythonExceptionQualifierrr�r��suspend�resumer�zdmi.bios.versionr�Fr�zBUG: unable to handlez^BUG: unable to handle (.*) at z,could not parse expected problem type line: zIP: zCall Trace:Tr�)rir~ror�r9r��subrpr7r0�islinkrtr�rtr)r�r#�_extract_function_and_addressr�)r��sig�regexr-r;r�linesr��loc_rer&�exc_name�
in_trace_bodyr��parsedr�s               r�crash_signature�Report.crash_signature6s���2�4�'��
�&�*G�G���4��D��$7�=�$H��C��J�J�;�<�E��\�*�5�5�7���K�K��%���1��3�!�'�'�!�*�-�-�C�8��J��8�8�H���$�);�t�)C��'�(�3�.��6H�1I�I�C��6�6�+�V�S�9�9��d�"�x�4�'7��*�+�,�A�d�8�n�-=�>�C��z�z�"S�T�H���)�4�4�6�E��5�z�A�~�����N�N�4�(����3�!�'�'�!�*�":�����
�;�;�C� �
��J��$����%�0�0�2�E��C��5�z�Q���H�H�Z��q��2�����,�-��3�a�g�g�a�j�@�@��5�z�A�~���Z�Z� L�M�F����L�L��&���1��w�w�q�z�Z�/��s�Q�W�W�Q�Z�/�/���G�G�A�J���7�7�>�>�!�,�,� "��� 0� 0�� 3�A���1�#�Q�q�w�w�q�z�l�3�3����R�y���s�+�A�.�H�
��a��%@� A�B�!�D�D���(�)�C�/�(�:�S�@�@��
��,�.�9��3D��D��O�+�x�4�	�?�/J��9�o���8�8�M�*�*��Q�t�M�2�3�4�4�C��8�8�.�/�/��Q�t�$6�7�8�9�9�C��
����!�M��E��Z�(�.�.�t�4���?�?�#:�;�;��Y�Y�'H�$�O�F�� &���Q���!�Q�I�$��P�Q�!����U�+��?�?�6�*�*� �>�>�t�D�E�����U�+���_�_�]�3�3�$(�M�"�]� �E���Q��3�� $� B� B�4� H�� �!�L�L��/�!�).�
�35�4��x�x���&���]�
��
�s�R%�%
R3�2R3r-c��[R"SU5nU(a-URS5nU(d
SU35eUSS:waU$g)Nz\[.*\] (.*)$r�z*could not parse expected call trace line: r�?)rir�r9)r-r�r�s   rr��$Report._extract_function_and_address�sJ�����?�D�1����L�L��O�E��M�F�t�f�M�M�5��Q�x�3����r:c��SU;dSU;dSU;agSUS;ag/nSnUSR5H�nURS5(a~UR5SnURS	5(dMD[US
5nUS:aMXUR	U5nU(a"URUR
SS
55 OUS-
n[U5S:�dM� O US:�a[U5U-S:agUS:Xa[U5S:dUS:�a[U5S:agUSSUSSSRU53$)a*Compute heuristic duplicate signature for a signal crash.

This should be used if crash_signature() fails, i. e. Stacktrace does
not have enough symbols.

This approach only uses addresses in the stack trace and does not rely
on symbol resolution. As we can't unwind these stack traces, we cannot
limit them to the top five frames and thus will end up with several or
many different signatures for a particular crash. But these can be
computed and synchronously checked with a crash database at the client
side, which avoids having to upload and process the full report. So on
the server-side crash database we will only have to deal with all the
equivalence classes (i. e. same crash producing a number of possible
signatures) instead of every single report.

Return None when signature cannot be determined.
r�r�rJNzErrno 13rr#r��0x�irzz..�r@rf�r)	ror)r�r��_address_to_offsetr#r>rpr�)r��stack�failedr-�addr�offsets      rr�� Report.crash_signature_addresses�sI��$�T�!�\��%=��QU�AU����j�)�)��������&�1�1�3�D����s�#�#��z�z�|�A������t�,�,���4��}���&�=���0�0��6����L�L�����T�!:�;��a�K�F�
�5�z�R���-4�4�A�:�#�e�*�v�-��1��
�a�K�C��J��N���
�s�5�z�A�~���'�(�)��4��>�*:�!�C�H�H�U�O�;L�M�Mr:c
��/n[R"5S:�Ga:[R"[R"55n[US5S:�aBUR
[R"S[R"US5S35S45 UR
[R"S[R"US5S35S45 USRS5HcnUR5n[U5S:�dM$UR
[R"S	[R"U5S35S
45 Me [R"5Sn[U5S:�a?UR
[R"S[R"U5S35S45 US
	UH�nURS5=(a US;nU(dSU;dUS;dM5[XS5(dMJUHgupx[!X["5(a5UR%X�UR'SSS95R)S5X'MQUR%X�U5X'Mi M� g![a N�f=f)z�Remove user identifying strings from the report.

This particularly removes the user name, host name, and IPs
from attributes which contain data read from the environment, and
removes the ProcCwd attribute completely.
rr1z\b�usernamerz/home/usernamer@�,z(\b|\s)z\1User Namer��hostnamerj�Proc)�ProcCpuinfor�ra�ProcInterrupts�ProcModulesr�>�Titlerw�
PythonArgs�
JournalErrors�isspacer=r>r?N)r7r�rLrMrNrpr#rir~r�r�r(rCrtr)r�rxr}r�rFr|)	r��replacementsr:rr�rv�
is_proc_fieldr��repls	         r�	anonymize�Report.anonymizes����
�9�9�;��?����R�Z�Z�\�*�A��1�Q�4�y�A�~��#�#�R�Z�Z�2�b�i�i��!��o�5F�b�0I�%J�J�$W�X�������r�"�)�)�A�a�D�/�!2�"�5�6�8H�I�
��q�T�Z�Z��_���G�G�I���q�6�A�:� �'�'����w�r�y�y��|�n�B�$?�@�.�Q��%��8�8�:�a�=���x�=�A��������r�"�)�)�H�2E�1F�b�,I�!J�J� W�X�	��Y���A��L�L��0��Q�?�6�M���1�$��M�M��t�w�	�2�2��%1�M�G�!�$�'�5�1�1�")�+�+� �q�'�.�.���.�"K�#� �&��/���#*�+�+�d��G�"<���
&2����	��	�s�>I?�?
J�Jc��USn[U[5(ae[U[5(ai[R"SS9up#[
R"[RU5 [R"X!5 [R"U5 U$[U[R5(ay[R"SS9up#[
R"[RU5 [R"U5 [US5nURU5 SSS5 U$USnU$!,(df   U$=f)Nr��apport_core_r��wbr)rxrGr}r��mkstemp�atexit�registerr7r�r�r?ryrzr')r��coredumpr,r�r&s     r�#_provide_uncompressed_coredump_file�*Report._provide_uncompressed_coredump_fileEs����
�#���h��,�,�,�,��h��&�&�!�)�)��@�J�R��O�O�B�I�I�t�,��H�H�R�"��H�H�R�L�����.�"@�"@�
A�
A�!�)�)��@�J�R��O�O�B�I�I�t�,��H�H�R�L��d�D�!�Q����q�!�"�
���A�;�D���"�!�
��s�D:�:
E	�sandboxc���SU;deURSUS5nSnSU;aUS[R"5:XaSn[X$5/n0nU(a�[R"5nUSSUS3SS	U-SS
U-SSUSUS
USU3/-
nU(a:USUSUS
USUS
US3nUS3n	UUUU	USUS3S.-nS/USS&USSUS3/-
n[
RRX-5(dDURS5(a.[
RRXSS-5(aUSSnX-nUSSUS3/-
nSU;aUR5n
USSU
-/-
nXV4$)a�Build gdb command for this report.

This builds a gdb command for processing the given report, by setting
the file to the ExecutablePath/InterpreterPath, unpacking the core dump
and pointing "core-file" to it (if the report has a core dump), and
setting up the paths when calling gdb in a package sandbox.

When available, this calls "gdb-multiarch" instead of "gdb", for
processing crash reports from foreign architectures.

Return argv list for gdb and any environment variables.
rrgFrATr�zset debug-file-directory z/usr/lib/debugzset solib-absolute-prefix zadd-auto-load-safe-path zset solib-search-path z/lib/rzz	/usr/lib/z/lib:z/usr/libz/usrz/gconv)r�r��
PYTHONHOME�
GCONV_PATHzld-linux-x86-64.so.2Nrzset data-directory z/usr/share/gdbrfzfile "�"r�z
core-file )
r�rrDr��get_native_multiarch_tripletr7r0r�r)r�)r�r�r��
executabler�rTr��native_multiarch�ld_lib_path�pyhomer�s           rr��Report.gdb_commandXs�� �4�'�'�'��X�X�/��6F�1G�H�
��	��d�"��^�$�	�(I�(I�(K�K��I� ��8�9��"$���(�E�E�G����+�G�9�N�C��,�w�6��*�W�4��(��	��7G�6H��G�9�I�&6�%7�9��
�G��"�m�$�#�}�E�*:�);���}�I�.>�-?���}�H�.��(�=��-���'2�'�"(�%0�M��;K�:L�F�"S�	��� 6�6������F�&9�+��n�$U�V�V���7�7�>�>�'�"6�7�7��(�(��0�0��w�w�~�~�g�1�2��&>�?�?�%/���^�
� �-�J��F�f�Z�L��2�3�3������;�;�=�D����t� 3�4�4�G���r:c��UR5 URH"up#nX!s=::aU::dMO MUSX-
S3s $ g)aResolve a memory address to an ELF name and offset.

This can be used for building duplicate signatures from non-symbolic
stack traces. These often do not have enough symbols available to
resolve function names, but taking the raw addresses also is not
suitable due to ASLR. But the offsets within a library should be
constant between crashes (assuming the same version of all libraries).

This needs and uses the "ProcMaps" field to resolve addresses.

Return 'path+offset' when found, or None if address is not in any
mapped range.
�+�xN)�_build_proc_maps_cacher�)r�r��start�end�elfs     rr��Report._address_to_offset�sM��	
�#�#�%�#�4�4�O�E���#��#�#���a���Q�/�0�0� 5�r:c	�@�UR(agSU;de/Ul[R"S5n[R"S5nUSR5H�nUR	5(dMURU5nU(d)URU5(aMJU(d
SU-5eURR
[URS5S5[URS5S5URS	545 M� g)
zOGenerate self._proc_maps_cache from ProcMaps field.

This only gets done once.
Nr�z-^([0-9a-fA-F]+)-([0-9a-fA-F]+).*\s{2,}(\S.*$)z ^([0-9a-fA-F]+)-([0-9a-fA-F]+)\szcannot parse ProcMaps line: r�r�r1rf)	r�rir~ror(r�r#r�r9)r��fmt�fmt_unknownr-r;s     rr��Report._build_proc_maps_cache�s���
� � ���T�!�!�!� "����j�j�I�J���j�j�!D�E����$�/�/�1�D��:�:�<�<���	�	�$��A���$�$�T�*�*���?�8�4�?�?�q��!�!�(�(��Q�W�W�Q�Z��$�c�!�'�'�!�*�b�&9�1�7�7�1�:�F�
�2r:r��coredump_keyrjc�x�URU5n[U[5(deUR5X'gr\)r�rxrGra)r�r�r�rjr�s     r�_add_str_from_coredump�Report._add_str_from_coredump�s2�����\�*���%��%�%�%�%��L�L�N��	r:c�t�URS5nU(a[U[5(deX S'gURS5nU(a2[U[5(de[R
"U5US'gg![a- [R"[5RSU5 gf=f)N�COREDUMPr��COREDUMP_FILENAMEz:Ignoring COREDUMP_FILENAME '%s' because it does not exist.)r�rxr}rGry�CompressedFiler�r��	getLoggerr��warning)r�r��dump�filenames    r�#_add_coredump_from_systemd_coredump�*Report._add_coredump_from_systemd_coredump�s����|�|�J�'����d�E�*�*�*�*�#�����<�<� 3�4����h��,�,�,�,�
�#1�#@�#@��#J��Z� ���%�
��!�!�(�+�3�3�P���
�s�%B�4B7�6B7c�j�URS5n[U[R5(deU"[R"UR55S9nURS5n[U[5(deXClURS5n[U[5(de[U5US'URUSS5 URUSS	5 URUS
S5 URUSS
5 URUSS5 URUSS5 URS5n[U[5(deUR[RU55 UR5 URS5S:waURU5 U$)a�Convert the givin systemd coredump into a problem report.

The following keys are not used:
 * COREDUMP_CGROUP (str)
 * COREDUMP_COMM (str)
 * COREDUMP_CONTAINER_CMDLINE (str)
 * COREDUMP_GID (int)
 * COREDUMP_HOSTNAME (str)
 * COREDUMP_OPEN_FDS (str)
 * COREDUMP_OWNER_UID (str)
 * COREDUMP_PACKAGE_JSON (str)
 * COREDUMP_PACKAGE_NAME
 * COREDUMP_PACKAGE_VERSION
 * COREDUMP_PROC_AUXV (bytes)
 * COREDUMP_PROC_CGROUP (str)
 * COREDUMP_PROC_LIMITS (str)
 * COREDUMP_PROC_MOUNTINFO (str)
 * COREDUMP_RLIMIT (str)
 * COREDUMP_ROOT (str)
 * COREDUMP_SESSION
 * COREDUMP_SLICE (str)
 * COREDUMP_UID (int)
 * COREDUMP_UNIT (str)
 * COREDUMP_USER_UNIT (str)
 * MESSAGE (str)
�COREDUMP_TIMESTAMP)r��COREDUMP_PID�COREDUMP_SIGNALrJ�COREDUMP_SIGNAL_NAMErK�COREDUMP_CMDLINErc�COREDUMP_EXEr�COREDUMP_CWDrj�COREDUMP_PROC_MAPSr��COREDUMP_PROC_STATUSra�COREDUMP_ENVIRON�COREDUMP_TRUNCATED�1)r�rx�datetime�time�asctime�	timetupler�r1rGr�r�r�r�r�r)r�r�r�r�r1rNr�s       r�from_systemd_coredump�Report.from_systemd_coredump�sz��8�|�|�0�1���$�� 1� 1�2�2�2�2��$�,�,�t�~�~�'7�8�9���l�l�>�*���#�s�#�#�#�#��
� ���%6�7�
��-��-�-�-�-��}�-��x���%�%�h�0F��U��%�%�h�0B�M�R��%�%�h��@P�Q��%�%�h��	�J��%�%�h�0D�j�Q��%�%�h�0F��U��,�,�1�2���'�3�'�'�'�'����L�4�4�W�=�>��(�(�*��:�:�*�+�s�2��6�6�x�@��
r:)r�r1)�CrashNr\r�)NNN�NN)=r�r�r�r�r�rGr��staticmethodr�r�rrr,r$rHrXr{rurqr�rr�r�r�r�r��boolr�r�r�rr rr4rGrPr^rjrprtr�r�r��listr�r�r�r�r�r��tuple�dictr�r�r��objectr�rr�rr�r�r:rr�r�ms5���H�S�H�#��*�H�PT�H���C��C����.�3��3��:��*�C��C��&$N��d�
�$N�d�$N�L(<�T,�#�,�$�,�4G�$'�4RV�h�C�$�J��0��C��C�$�J�����"&�)-�	\�
�4�Z�\��4�Z�\��3�-�$�&�	\�

�\�|Y�
�)-�"&�	-�
�4�Z�-��3�-�$�&�-��4�Z�	-�

�-�>GK�&
�#�&
�/7��}�t�/C�&
�	
�&
�P�t��BEI�~D��T�z�~D�7:�T�z�~D�	
�~D�@M<�b!�"�!%�	��T�M���t����$�J�	�

��.B��B�#&��:�B�;>��:�B�	
�B�H)�s�T�z�)�c�D�j�)�V�.��.�`-�#�-�5�t�5�n+�Z?�t�?�"��t���-�S�4�Z�-�^
��t��
�,9��d�
�9�v�4��9��&N��t��N�`��C��C�$�J����:N�3��:�:N�x7=�r�S��(>B�H ��T�z�H �03�d�
�H �	�t�C�y�$�s�C�x�.�(�	)�H �T�,�B#��S�&�[�)�#�9<�#�CF�#�	
�#��D��f��<M��RV��$�6��6r:r�r)Ni)Or�r�rr�r]r*rP�importlib.utilr�rDr�r7r$rLrir�rLr�r\r�r�rr��urllib.errorr6�urllib.parse�urllib.request�xml.domrn�xml.dom.minidom�xml.parsers.expat�collections.abcrr�apport.fileutilsr��apport.loggingry�apport.hookutilsr�apport.packaging_implrr�	apport.uirrr�r��	_data_dirr+r%r&r9rVrXrWrYrnrrGr/r�r9rJrSrrr[rfr�r�r�rr�r�r�r�r�r�r�r:r�<module>r/s��A������
��	��	��
�	�
�
���
����������.����,�3�2��J�J�N�N�,�.A�B�	��[��0���[��0�����z�z�~�~�2�4J�K��,�
�*��0��1����&	5�

�S�

�X�c�]�

�"=A�
.�

�
.��$�J�
.�/2�T�z�
.��
.�=A�&�

�&��$�J�&�/2�T�z�&��&�&�*MQ�#�
�#�Y�#�!�#�s�(�^�d�2�#�DI�#��#�L!/�H�!��s�T�z��d��s��.�:,� 
�4��S��>� 
�P|�^�
)�
)�|r:

Filemanager

Name Type Size Permission Actions
REThread.cpython-313.pyc File 2.85 KB 0644
__init__.cpython-313.pyc File 954 B 0644
crashdb.cpython-313.pyc File 34.04 KB 0644
fileutils.cpython-313.pyc File 31.92 KB 0644
hookutils.cpython-313.pyc File 47.15 KB 0644
logging.cpython-313.pyc File 2.97 KB 0644
packaging.cpython-313.pyc File 14.2 KB 0644
report.cpython-313.pyc File 82.55 KB 0644
sandboxutils.cpython-313.pyc File 12.43 KB 0644
ui.cpython-313.pyc File 87.14 KB 0644
user_group.cpython-313.pyc File 1.81 KB 0644
Filemanager