Current File : //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/coredump.cpython-312.pyc
�

-�_g���@�ddlZddlZddlmZmZmZGd�dee�Zy)�N)�Plugin�IndependentPlugin�	PluginOptc�R�eZdZdZdZdZdZdZeddd�	�ed
dd�	�gZ	d
�Z
y)�Coredumpaa
    This plugin collects from the systemd-coredump service, which is leveraged
    via the coredumpctl command.

    Beyond basic configuration of the service, the plugin will also attempt to
    collect information on available coredumps. For any coredumps reported by
    coredumpctl for which the core is present, this plugin will collect that
    coredump file. The number of dump files collects is controlled by the
    `dumps` option, defaulting to 3. Note that core collection is performed
    based on the most recent cores generated. The summary information provided
    by `coredumpctl info` is also collected.

    The coredump files will be at their canonical location in the sos archive,
    usually under var/lib/systemd/coredump. Symlinks are dropped in the plugin
    directory to assist in identifying which coredump aligns to which entry in
    the provided `coredumpctl list` output collection.

    Users may leverage the `executable` option to control which coredumps the
    plugin will collect. This option takes a case-insensitive python regex
    string. If provided, only coredump entries for which the EXE field in
    `coredumpctl list` output matches will be collected.

    The dump files collected are compressed, and users should be aware that
    when inflated these files can be orders of magnitude larger than their
    collected sizes.
    z3systemd-coredump related information and dump files�coredump)�system�debug)zsystemd-udevzsystemd-coredump�dumps�znumber of dump files to collect)�default�desc�
executable�zEonly collect info and dump output for executables matching this regexc���|jgd��|jd�}|ddk7ryd}|dj�ddD�]�}|j�}|d}|d}|j	d	�x}r&tj||t
j�s�W|jd
|���}|ddk7r�t|d}	||j	d�ks��tjd|	t
j�}
	|
j�dj�}tj|�jd
kDr|jd|�d����|j|dd��|j|j d|j#�d|�d|j%|����}tj&j)|j*j-�|�}
tj&j/|
|�}|j1ddd�}|j*j3||�|dz
}���y#t4$rY��t6$r"}|jd|�d|���Yd}~��&d}~wwxYw)N)z/etc/systemd/coredump.confz/etc/systemd/coredump.conf.d/z/run/systemd/coredump.conf.d/z!/usr/lib/systemd/coredump.conf.d/z!/usr/lib/systemd/systemd-coredumpzcoredumpctl list --reverse�statusr�output�����rzcoredumpctl info rz(^\s*Storage:(.*)(\(present\)))i�zSkipping core dump file z due to sizeF��)�tailit�	sizelimit�cmddir�	coredump_�_z../rzCould not collect coredump for z : )�
add_copy_spec�collect_cmd_output�
splitlines�split�
get_option�re�search�I�M�groups�strip�os�stat�st_size�	_log_info�	path_join�commons�name�_mangle_command�path�join�archive�get_archive_path�relpath�replace�add_link�AttributeError�	Exception)�self�
coredump_list�cores_collected�line�cdump�pid�exe�regex�cinfo�res�core�	core_path�plugpath�arcpath�linkpath�errs                �=/usr/lib/python3/dist-packages/sos/report/plugins/coredump.py�setupzCoredump.setup9sU�����
�	��/�/�0L�M�
���"�a�'����!�(�+�6�6�8���<�-	�D��J�J�L�E���(�C���)�C�����5�5�u�5��y�y���R�T�T�2���+�+�.?��u�,E�F�E��X��!�#����/�C������!9�9��y�y�!C�S�"�$�$�O�� � $���
�a� 0� 6� 6� 8�I��w�w�y�)�1�1�I�=����6�y�k��N��!��&�&�y��#�&�N�#�~�~����X�.��	�	��#�C�5��$�*>�*>�s�*C�)D�E� �H�!�g�g�l�l�4�<�<�+H�+H�+J�+4�6�G�!�w�w���w��A�H�'�/�/��r�1�=�H��L�L�)�)�(�H�=�#�q�(�O�M-	��N&��� ���N�N�9�#��c�#��G�����s&�:AH;�C#H;�;	I1�I1�I,�,I1N)�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�profiles�packagesr�option_listrJ��rIrrsJ���6G�J��K�"�H�3�H�	�'�1�+L�M��,��.�	0��K�;rUr)r(r"�sos.report.pluginsrrrrrTrUrI�<module>rWs$��
�	�C�C�d�v�(�drU