+
    oFj:,                    .   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI H!t! ^ RI"t#^ RI$t#^ RI%t#^ RI&t#^ RI't#^ RI(H)t)H*t* ^ RI+H,t- ^ RI.H/t/ Rt0]Pb                  Pe                  R	R
4      t3Rt4R t5RR R llt6R R lt7R R lt8R R lt9RR/R R llt:R t;R R lt<]Pz                   ! R R4      4       t> ! R R4      t?R# )!zAbstract Apport user interface.

This encapsulates the workflow and common code for any user interface
implementation (like GTK, Qt, or CLI).
N)CallableSequence)gettext)Any)HookUINoninteractiveHookUI)impl)get_process_user_and_groupz2.34.1APPORT_SYMPTOMS_DIRz/usr/share/apport/symptomsi    c                     \         P                  ! RV P                  RR4      4      P                  ^4      p\	        V4      #   \
        \        3 d     R# i ; i)zExtract 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    ii

<(DEKKAN3x' s   A A AAc                X    V ^8  d   QhR\         R\        R,          R\        R,          /# )   keydefaultNreturnstrr   )formats   "r   __annotate__r!   H   s)     	 	c 	C$J 	#* 	    c                v     \        \        P                  V ,          4      #   \        \        3 d    Tu # i ; i)zGet 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)r   r   s   &&r   _get_env_intr(   H   s3    2::c?##j! s   " 88c                J    V ^8  d   QhR\         R\        R\        R,          /# )r   nameuidr   Nr   )r    s   "r   r!   r!   T   s%     	' 	's 	' 	't 	'r"   c           	          \         P                  ! R RRR\        V4      V .RRRR7      pVP                  ^ 8w  g   VP                  '       g   R# \        VP                  P                  4       4      # )pgrepz-nz-x-uTF)capture_outputchecktextN)
subprocessrunr   
returncodestdoutr   strip)r*   r+   processs   && r   _get_newest_process_for_userr8   T   s`    nn	$dCHd3	G Qgnnnw~~##%&&r"   c                R    V ^8  d   QhR\         R\        \        \        3,          /# )r   r+   r   )r   dictr   )r    s   "r   r!   r!   `   s"      C DcN r"   c                   \        RV 4      pVf   / # \        P                  ! RV 2\        P                  \        P                  ,          \        P
                  ,          4      p \        P                  P                  V4      p \        P                  ! T4       R Uu/ uF  pYC9   g   K  YCT,          bK  	  up#   \         d    / u \        P                  ! T4       # i ; i  \        P                  ! T4       i ; iu upi )zFind 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)r8   r$   openO_RDONLYO_PATHO_DIRECTORYapport	fileutilsget_process_environOSErrorclose)r+   	gvfsd_pidgvfsd_pid_fd	gvfsd_envr   s   &    r   _get_users_environrL   `   s     -Wc:I	77
bkkBII5FL$$88F	 	 A@C 	s^@   	
 	s0   &B=  D-D=C#
C& "C##C& &C>c                $    V ^8  d   QhR\         /# r   r   bool)r    s   "r   r!   r!   |   s     P PT Pr"   c                     \        \        P                  P                  R4      ;'       g     \        P                  P                  R4      4      # )z:Check if a display server is specified in the environment.DISPLAYWAYLAND_DISPLAY)rP   r$   r%   r    r"   r   has_displayrU   |   s0    

y)NNRZZ^^<M-NOOr"   get_user_envFc                V    V ^8  d   QhR\         \        ,          R\        R\        RR/# )r   argsrV   kwargsr   N)listr   rP   r   )r    s   "r   r!   r!      s0     % %
s)%&*%>A%	%r"   c                  \        R\        R4      4      pVe   \        4       P                  4       '       g   \        P                  ! V 3RR/VB  R# \
        P                  ! V4      p\        R4      pVf   VP                  p\        P                  P                  4        UUu/ uF)  w  rgVP                  R4      '       d   K  VR8w  g   K'  WgbK+  	  pppV'       d   V\        V4      ,          pVP                  VR&   \        P                  ! V 3RRR	VR
VRVR\        P                  ! VP                  V4      /VB  R# u uppi )aL  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_UIDNr0   FSUDO_GIDSUDO_HOMEenvuserr   extra_groups)r(   r	   is_rootr2   r3   pwdgetpwuidpw_gidr$   r%   items
startswithrL   pw_dirgetgrouplistpw_name)	rX   rV   rY   r+   pwuidgidkvra   s	   &$,      r   run_as_real_userrq      s8    z<#=
>C
{46>>@@t353F3LLE
z
"C
{ll JJ$$&&DA||G$ 	)*l): 	&  
 !#&&,,CKNN  	
  __U]]C8 s   %EEEc                     \         P                  ! \        V 4      ^ 4       R#   \         d1   pTP                  \        P
                  8X  d    Rp?R#  Rp?R# Rp?ii ; i)z8Check if the process with the given ID is still running.NFT)r$   killr   rG   errnoESRCHr   errors   & r   still_runningrx      sK    
C!   ;;%++% &s    $ AAAc           	     
   \        V\        4      '       g   Q h V P                  4        V P	                  4        V'       d   / p \        VRR7      ;_uu_ 4       p\        \        VP                  4       VR4      V4       RRR4       VR,          ! W4      pV'       g#   \        P                  P                  RV4       R# \        P                  P                  \        P                  P                  V4      4      ^ ,          V R&   V'       g:   R	V 9   d(   \        P,                  P/                  V R	,          4      pM\1        R
4      h\        P,                  P3                  V4      pV'       d   V P5                  V4        V P7                  V4       RV 9  Ed	   V P?                  V4      '       d   \"        P$                  ! ^ 4        RV 9  d   R\        P@                  9  d   RV 9  d   RV 9  d   \C        R4      V R&   M\D        PF                  ! V R,          PI                  4       ^ ,          4      '       gj   \D        PJ                  ! V R,          PI                  4       ^ ,          4      '       g2   \C        R4      V R,          PI                  4       ^ ,          ,          V R&   RV 9  d   V PM                  4       p
V
'       d   WR&   V PO                  R4      R8X  dR   R\        P@                  9  d=   V PQ                  4       pV'       d%   \C        R4      RPS                  V4      ,          V R&   V'       d    \        VR4      ;_uu_ 4       p\        PT                  ! V^ 4       V PW                  VRR7       RRR4       \        P,                  PY                  T4       \        PT                  ! TR4       R# R#   \         d     ELi ; i  + '       g   i     ELQ; i  \          d    \"        P$                  ! ^ 4        EL\&         dP    \        P                  P                  RT4       \(        P*                  ! 4        \"        P$                  ! ^ 4        ELQi ; i  \8         d    T'       g	   RT 9  d   h  EL\:         d   p	\=        T	4      T R&    Rp	?	ELRp	?	ii ; i  \8         d    T'       g	   RT 9  d   h  ELi ; i  + '       g   i     ELW; i  \         d,   p	\        P                  P                  RY4        Rp	?	ELRp	?	ii ; i)aa  Collect 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execNr3   z8symptom script %s did not determine the affected packageSymptomzsymptom 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 correctlyzThis 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_PACKAGESzYou have some obsolete package versions installed. Please upgrade the following packages and check if the problem still occurs:

%sz, abT)only_newzCannot update %s: %si  )-
isinstancer   add_gdb_inforG   add_os_infor@   r}   compilereadrD   loggingrw   r$   pathsplitextbasenameStopIterationsysexit	Exception	traceback	print_excrE   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snaprw   titleold_pkgss   &&&&&&      r   thread_collect_infor      s     b&!!!!
 	nw771WQVVX~v>E 8 5k&-G$$N"  " 0 01A1A.1Q RST UF9 v%&&88@P9QRGS 
 %%g.DT"
2( 6)  $$HHQK	'1CF*vV/C34N4F/0 #449%++-a0 #<<9%++-a0 
 . !1779!<= /0& f%%'#7O 	

=!W,-RZZ?++-+,@, 		(#	,$F'( 		Lj$''1Q'Q. ( 	))*5
U# ]   	 877  	HHQK 	NN  !=~N!HHQK	(  
 "fF&: 2'*5z#$2D  	
 &&*>	: (''  	L
 NN  !7KK	Ls   N6 O &O ?O AO Q 8R  7R  97R  11R  5S 	+S4S 6OOO		O !Q Q	AQQR/R:RRRR R?3R?>R?S	S S T! TTc                   D   a  ] tR tRt o RtRtRtRtRtRt	V 3R lt
RtV tR# )ActioniD  zAction 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').
Fc                V   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   # )r   examineignorerememberr   restartrO   )r    __classdict__s   "r   r!   Action.__annotate__D  sF               r"   rT   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   __annotate_func____static_attributes____classdictcell__r   s   @r   r   r   D  s,      GFHFG  r"   r   c                     a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR lt]V 3R	 lR
 l4       t	V 3R lR lt
]V 3R lR l4       t]V 3R lR l4       tRaV 3R lR lltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR lt]V 3R lR l4       tV 3R lR lt]V 3R  lR! l4       tV 3R" lR# ltV 3R$ lR% ltV 3R& lR' ltV 3R( lR) ltV 3R* lR+ ltV 3R, lR- ltV 3R. lR/ ltRbV 3R0 lR1 lltV 3R2 lR3 ltV 3R4 lR5 ltV 3R6 lR7 ltV 3R8 lR9 lt V 3R: lR; lt!V 3R< lR= lt"V 3R> lR? lt#V 3R@ lRA lt$RcV 3RB lRC llt%V 3RD lRE lt&V 3RF lRG lt'V 3RH lRI lt(V 3RJ lRK lt)V 3RL lRM lt*V 3RN lRO lt+V 3RP lRQ lt,V 3RR lRS lt-V 3RT lRU lt.V 3RV lRW lt/V 3RX lRY lt0V 3RZ lR[ lt1V 3R\ lR] lt2V 3R^ lR_ lt3R`t4V t5R# )dUserInterfaceiT  zApport 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.
c                4   < V ^8  d   QhRS[ S[,          RR/# )r   argvr   N)rZ   r   )r    r   s   "r   r!   UserInterface.__annotate___  s     * *T#Y *4 *r"   c                   RV n         RV n        RV n        RV n        RV n        RV n        RV n         \        P                  P                  R4      V n        \        P                   ! V P                   4       V P#                  V4      V n        R#   \         d4   p\        P                  P                  R\        T4      4        Rp?LqRp?i\         d#    \        P                  P                  R4        Li ; i)z8Initialize program state and parse command line options.rD   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_progressrD   crashdbget_crashdbImportErrorr   fatalr   r&   r   
textdomain
parse_argvrX   )selfr   rw   s   && r   __init__UserInterface.__init___  s    &37'+'+"$-1	!>>55d;DL 	4../OOD)	  	NN  E
 
  	NN  J	s#   $B C8)CC8 C87C8c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r   ~  s     " "T "r"   c                   RpRV n         \        P                  ! 4       ^ 8X  d    \        P                  P                  4       pM\        P                  P                  4       pV Fm  pV P                  V4      '       g   K  V P                  '       g   Q hV P                  R,          R8X  d   V P                  V4       MV P                  V4       RpKo  	  V# )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.
FTr   Hang)r   r$   geteuidrD   rE   get_new_system_reportsget_new_reportsload_reportr   finish_hang	run_crash)r   resultreportsr   s   &   r   run_crashesUserInterface.run_crashes~  s      "::<1&&==?G&&668GA##A&&;;;;{{=)V3  #q!F  r"   c                $   < V ^8  d   QhRS[ RR/# )r   r   r   Nr   )r    r   s   "r   r!   r     s     x xS xT xr"   c                ~	   Wn           \        P                  P                  V4       V P
                  '       g   V P                  V4      '       g   R# V P
                  '       g   Q hRV P
                  9   d   R# V P
                  P                  R4      R8X  d   RV P
                  9   d   RV P
                  9  d   RV P
                  9  d   \        P                  P                  V P
                  P                  R\        R	4      4      4      p\        R
4      V,          p\        R4      pV P                  \        R4      V,          V RV 24       R# \        P                  P                  4       pV P                  V4      pVP
                  '       g   VP                  '       d"   RV P
                  9  d   V P!                  4        V P
                  f   R# VP                  '       d   V P                  4        R# VP"                  '       d   V P#                  4        VP$                  '       d   V P
                  P'                  4         VP(                  '       d   V P+                  VP
                  4       TP
                  '       g   R# RT P
                  9   d8   T P
                  R,          R8w  d    \        P                  P/                  T4       T P0                  P3                  T P
                  4      '       dC   T P5                  4       '       d   R# T P7                  4       '       d   R# T P9                  4        R# R#   \         d     EL*i ; i  \,         d     Li ; i  \:         d?    T P                  \        R4      \        R4      4       \<        P>                  ! ^4        R# \         Ed   pTP@                  \@        PB                  8X  d!   \        PD                  PG                  R4       h TP@                  \@        PH                  8X  d<   T P                  \        R4      \        R4      4       \<        P>                  ! ^4       h TP@                  \@        PJ                  8X  dE   T P                  \        R4      \M        TPN                  4      4       \<        P>                  ! ^4       h Rp?ii ; i)zPresent 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Ignorer   r   SignalCoreDump
Stacktracer   zunknown 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.zOut of memory, abortingErrorz@There is not enough disk space available to process this report.)(r   rD   rE   r   rG   r   r   r   r$   r   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   rt   ENOMEMr   r   ENOSPCEIOr   strerror)r   r   subjectheadingfooterr   responserw   s   &&      r   r   UserInterface.run_crash  s    'j	  11+>
 ;;;t'7'7'D'D;;;;4;;& .'9+dkk1 3''**KKOO$4a8I6JK IJWT;
 %%o&0WIT&2J  & 0 0 B B D556GHH("2"2"2#4;;6%%'{{"'')$$$--hoo> ??? !DKK/KK 01W<  33K@ ||##DKK00 ((****,,  " 1O   n  6  	!!*+FG HHQK 	{{ell*$$%>?  ,%%gJ=   		)%%a(@&A3u~~CVW	s   M M' M' M' %M' :CM' A M' M' (/M' M' +M' =M' !M' 1M' M M 9M' A2M'  M' M' 0M' MM' MM' M$!M' #M$$M' 'AR</	R<9R<:C=R77R<c                $   < V ^8  d   QhRS[ RR/# )r   r   r   Nr   )r    r   s   "r   r!   r     s     - -s -t -r"   c                    \         P                  P                  V 4       \         P                  P                  V 4       R# )zFinish 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)rD   rE   r   r   )r   s   &r   r   UserInterface.finish_hang  s,     	++A.))!,r"   c                &   < V ^8  d   QhRS[ RS[/# )r   r   r   )r   rP   )r    r   s   "r   r!   r   &  s     + +C +D +r"   c                   \         P                  P                  R4      V n         V P                  P                  V4       V P                  P                  4        V P                  P                  R	R
4      p\         P                  P                  V4      V n        V P                  P                  4        \         P                  P!                  4       pV P#                  WAR7      pVP                  '       dQ   \         P                  P%                  V P                  V4       \&        P(                  ! V\*        P,                  4       M%\&        P(                  ! V\*        P.                  4       VP0                  '       d"   V P3                  V4       V P1                  4        R#   \         d   p\        T4      R8X  dA   T P                  \        R4      \        R4      4       \        P                  ! ^4        Rp?EL\        T4      R8X  d;   T P                  \        R4      \        R4      4       \        P                  ! ^4        Rp?ELRp?ii ; i)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   zinvalid processInvalid PIDz(The specified process ID does not exist.znot accessiblezNot your PIDz0The specified process ID does not belong to you.Nr   r   )	modal_forT)rD   r   Reportadd_proc_infor'   r   r   r   r   r   r   r   rE   r   r   r   r   r   mark_hanging_processr$   rs   signalSIGABRTSIGKILLr   wait_for_pid)r   r   rw   r   r   r  s   &&    r   run_hangUserInterface.run_hang&  s    mm**62	KK%%c* 	$$&{{/4!++==dC!",,>>@112C1S???11$++sCGGC(GGC(c"LLN7  	5z..%%m$a(R&S U//%%n%HI 	s   F! !I,A
I<A
IIc                $   < V ^8  d   QhRS[ RR/# r   r   r   Nr   )r    r   s   "r   r!   r   T  s      # $ r"   c                      \         P                  ! \        V 4      ^ 4       \        P                  ! ^4       K:    \         d,   pTP                  \        P
                  8X  d    Rp?R# h Rp?ii ; i)zswaitpid() does not work for non-child processes. Query the process
state in a loop, waiting for "no such process."
N)r$   rs   r   rG   rt   ru   timesleeprv   s   & r   r  UserInterface.wait_for_pidS  sS    
 C!$
 JJqM	  ;;%++-s    ; A1A,+A,,A1c                $   < V ^8  d   QhRS[ RR/# r  r  )r    r   s   "r   r!   r   b  s     * *s *t *r"   c                b    \         P                  ! \        V 4      \        P                  4       R# )z!Kill process with signal SIGSEGV.N)r$   rs   r   r  SIGSEGV)r   s   &r   	kill_segvUserInterface.kill_segva  s     	C&..)r"   Nc                4   < V ^8  d   QhRS[ R,          RS[/# )r   r   Nr   r   rP   )r    r   s   "r   r!   r   f  s#     } }S4Z }4 }r"   c                p   V P                   P                  '       gc   V P                   P                  '       gG   V'       g?   V P                  4       '       d   R# V P	                  \        R4      \        R4      4       R# \        P                  P                  R4      V n        V P                   P                  '       Ed?    \        P                  ! RV P                   P                   2\        P                  \        P                  ,          \        P                  ,          4      p\        P                  ! R\        P                  VR7      p\        P                  ! VR	R
7      ;_uu_ 4       pVP                  4       P!                  4       pRRR4       \#        X^,          4      pV\$        ,          '       d   RV P                   n        MLV P                  P'                  V P                   P                  VR7       MV P                  P5                  4        V P                   P                  '       d4   V P                   P                  P7                  4       V P                   n        V P                   P                  R8X  d   \8        P:                  ! 4       V n        MV P                   P                  V n         V P?                  V4       T PC                  4       '       d   R# T PE                  4        T PG                  4       '       d   R#  T P                  R T P                   PJ                  '       d    \        PL                  PO                  T P                   PJ                  4      pTPQ                  R4      '       dF   \R        P                  ! TR4      ;_uu_ 4       pT P                  PU                  T4       RRR4       R# \        \        PL                  PO                  T P                   PJ                  4      R4      ;_uu_ 4       pT P                  PU                  T4       RRR4       R# Rp	T PW                  T	4      p
T
P                  '       d   T PY                  4        R#   + '       g   i     EL; i  \(         d)    T P	                  \        R4      \        R4      4        R# \*        \,        3 dV   p\/        TRR4      \0        P2                  8X  d    Rp?R# T P	                  \        R4      \        R4      4        Rp?R# Rp?ii ; i  \*         d   pR\A        T4      9   d   R\A        T4      9   dz   T P<                  '       g-   T P	                  \        R4      \        R4      T,          4       M5T P	                  \        R4      \        R4      T P<                  ,          4        Rp?R# h Rp?ii ; i  \H         d     ELi ; i  + '       g   i     R# ; i  + '       g   i     R# ; i  \,         d0   pT P	                  \        R4      \A        T4      4        Rp?R# Rp?ii ; i)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()).
TzNo package specifiedzHYou need to specify a package or a PID. See --help for more information.FBugr=   stat)dir_fdrz   r{   Nlinux)r   proc_pid_fdzPermission deniedzfThe specified process does not belong to you. Please run this program as the process owner or as root.rt   r  z6The specified process ID does not belong to a program.r   zdoes not existr   z7Symptom script %s did not determine an affected packagezPackage %s does not existProcCmdlinez.gzwbCannot create report)-rX   r   r   run_symptomsr   r   rD   r   r  r$   r@   rA   rB   rC   ior   r   r   
PF_KTHREADr  r  r'   rG   getattrrt   ENOENTadd_proc_environr6   r   get_kernel_packager   r   r   r  add_extra_tagsr   r&   saver   
expanduserendswithgzipr   r   r  )r   r   r0  	stat_filer   r-  flagsrw   savefiler   r  s   &&         r   run_report_bugUserInterface.run_report_bugf  s    yy   ~  ""!!()8 mm**51 99===! ggTYY]]O,bkkBII.E.V GGFBKKL	WWY99Q668>>+D :DG:%%(/DII%KK-- IIMM{ . . KK((*99 $		 1 1 7 7 9DII99'(;;=D#yy00D	n-" ""$$  ""	M* 99>>>	M77--diinn=$$U++8T22a))!, 3  bgg00@$GG1))!, H  !%556GHH  "u :99 # %%)*M ( 	5'40ELL@ !%%m$NO 	.  	CJ&+;s5z+I'''))23ST() ))23569I9II 	6  		 32  HG   M%%a(>&?ULL Ms   B-Q: .Q&>Q: 1Q: 9T W 5A	W; ?W; W:W; AW; 	W'%W; &Q7	1	Q: :/T,T;T< T"$TTV>1V9A!V98V99V>WWW$	W; $W; 'W8	2W; 8W; ;X5$X00X5c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r     s     ] ]4 ]r"   c           
        V P                   P                  V P                  P                  4      '       g'   V P	                  \        R4      \        R4      4       R# V P                   P                  V P                  P                  4      pV'       g%   V P                  \        R4      4      pV'       g   R# \        P                  P                  R4      V n	        V P                  P                  '       d'   V P                  P                  P                  4       .pM/V P                   P                  V P                  P                  4      pRpV FP  pWPn        WPP                  R&   WPP                  R&    \        P                   ! V4       V P1                  RR7       RpKR  	  V'       g'   V P3                  \        R4      \        R4      4       R# V P                  P5                  4        V P                  P7                  4        V P9                  4        V P                  R  V P                  R \=        V P                  4      ^ 8X  d'   V P3                  \        R4      \        R4      4       R# RpV P?                  V4      pVP                  '       dA   V P                   PA                  V P                  P                  V P                  RVRR7       R# R#   \"         dw    \$        P&                  P)                  \$        P&                  P+                  \        P                  P,                  RT R	24      4      '       g   \/        R
T R24        EK   ELi ; i  \:         d     EL9i ; i)z:Update an existing bug with locally collected information.zUpdating problem reportzYou 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".FaH  You 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,  SourcePackager   source_.pyzPackage z. not installed and no hook available, ignoringT)r   z$No additional information collected.Datezapport information)change_descriptionattachment_comment)!r   
can_updaterX   update_reportr   r   is_reporterui_question_yesnorD   r   r  r   r6   get_affected_packagesr   r   get_versionr'   r$   r   existsr   PACKAGE_HOOK_DIRprintr   ui_info_messageadd_user_infor9  r;  r&   lenr   update)r   rO  rpkgsinfo_collectedpr   r  s   &       r   run_update_reportUserInterface.run_update_report  s    ||&&tyy'>'>??!!+,P ll..tyy/F/FG&&P	A  mm**5199II%%++-.D<<55dii6M6MNDA +,KK(%&KK	"%%a( 6!N# &   +,a0V.W !!#$$& KK	O, t{{q   +,a0V.W  !112CD???LL		''$#.#7    [  ww~~GGLL!?!?71#SAQR  HQC'UVW	.  		s+   6K$M A)MMMM+*M+c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r   F  s     1 1d 1r"   c           
        \         P                   ! \        P                  P                  \        R4      4      p. pV EF  p\        P                  P                  V4      P                  R4      '       d   K:  / p \        VRR7      ;_uu_ 4       p\        \        VP                  4       VR4      V4       RRR4       RT9  d#   \        P                  P                  R	T4       K  \        P                  P#                  \        P                  P                  T4      4      ^ ,          pTP%                  TP'                  R
T4      T34       EK  	  V'       g   R# VP)                  4        VP%                  R4       T P+                  \-        R4      V UUu. uF  w  rxVNK	  	  uppR4      p	V	e]   W)^ ,          ,          ^,          p
V
'       d=   V P/                  \        P                  P                  \        V
R,           4      4       R# R# R#   + '       g   i     ELb; i  \         d;    \        P                  P                  RT4       \        P                   ! 4         EK)  i ; iu uppi )z\Report a bug from a list of available symptoms.

Return False if no symptoms are available.
z*.pyr   rz   r{   r}   Nzsymptom script %s is invalidr3   z0symptom script %s does not define run() functiondescriptionFz+What kind of problem do you want to report?rI  T)zOther problemN)globr$   r   r   symptom_script_dirr   ri   r@   r}   r   r   r   rD   r   rw   r   r   r   appendr   sortui_question_choicer   rC  )r   scriptssymptomsscriptr   r   symptom_namerb  r*   chsymptoms   &          r   r4  UserInterface.run_symptomsF  s   
 ))BGGLL);VDE 24Fww'22377#%D&733q66:DA 4 D $$F 77++BGG,<,<V,DEaHLOOTXXm\BLQR' * /0$$;<2:;(.[[(;
 >!uoa(G##BGGLL1CWu_$UV  E 433  $$%CVL##%( <s7   :H"&H5H"I*HH"H""A I'&I'c                   < V ^8  d   QhRR/# r   r   NrT   )r    r   s   "r   r!   r   y  s     
$ 
$T 
$r"   c                r   \         P                  P                  \        V P                  P
                  R,           4      p\         P                  P                  V4      '       gB   V P                  \        R4      \        R4      V P                  P
                  ,          4       R# V P                  V4       R# )z#Report a bug with a symptom script.rI  zUnknown symptomzThe symptom "%s" is not known.N)
r$   r   r   rd  rX   rm  rS  r   r   rC  )r   rj  s   & r   run_symptomUserInterface.run_symptomy  s{    0$))2C2Ce2KLww~~f%%!!#$23dii6G6GG F#r"   c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r     s     R" R"$ R"r"   c                   V P                   P                  '       d   V P                  4        R# V P                   P                  '       dq   V P                   P                  '       g'   V P                  \        R4      \        R4      4       R# V P                  \        V P                   P                  4      4      # V P                   P                  '       d   V P                  4       # V P                   P                  e   V P                  4       # V P                   P                  '       d   \        \        4       R# V P                   P                   '       d)    V P#                  V P                   P                   4       R# V P                   P(                  '       Ed<   \*        P,                  ! R4      R8X  d'   V P                  \        R	4      \        R
4      4       R# V P/                  R\        R4      4       \0        P2                  ! RR.R\0        P4                  \0        P4                  R7      pVP6                  ^ 8X  dK    \        VP8                  P;                  4       R,          4      V P                   n        V P                  4       # V P                  \        R	4      \        R4      R,           VP>                  PA                  4       ,           4       R# V PC                  4       #   \$         d0   pT P                  \        R4      \'        T4      4        Rp?R# Rp?ii ; i  \<         d)    T P                  \        R	4      \        R4      4        R# i ; i)zCall appropriate run_* method according to command line arguments.

Return True if at least one report has been processed, and False
otherwise.
TzNo PID specifiedz;You need to specify a PID. See --help for more information.FNr   XDG_SESSION_TYPEwaylandr3  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.r   z^After closing this message please click on an application window to report a problem about it.xprop_NET_WM_PID)r0   r5   stderrz2xprop failed to determine process ID of the windowr   )"rX   rm  rr  hangingr   r   r   r  r   filebugrC  rN  r^  versionrU  __version__
crash_filer   rG   r   windowr$   getenvrV  r2   r3   PIPEr4   r5   r   r'   rz  decoder   )r   rw   rx  s   &  r   run_argvUserInterface.run_argv  s    999999===%%()ST ==TYY]]!34499&&((99"".))++99+99Otyy334 99yy+,	9%%,-D
   H NN-(!!	E 1$ $'(:(:(<R(@$ADIIM **,,!!()FG,,%%'( !!k  O%%a(@&A3u:NNOJ "  ))01NO   s*   %K( 9L% (L"3$LL"%/MMc                J   < V ^8  d   QhRS[ S[,          RS[P                  /# r   r   r   )r   r   argparse	Namespace)r    r   s   "r   r!   r     s%       (2D2D r"   c           	     d   \         P                  ! \        R4      R7      pVP                  RR\        R4      R7       VP                  RR. R	\        R
4      R7       VP                  RR\        R7       VP                  V R,          4      pRVn        RVn        RVn        RVn	        RVn
        V# )z=Parse command line options when being invoked in update mode.z%(prog)s <report number>usage-p	--packagezSpecify package name.help--tagre  tags@Add an extra tag to the report. Can be specified multiple times.actionr   destr  rN  report_number)metavartype   NNNF)r  ArgumentParserr   add_argumentr   
parse_argsrm  r}  r  r~  r|  )r   parserrX   s   &  r   parse_argv_updateUserInterface.parse_argv_update  s     ((q1K/LMD+A6M4NOUV 	 	
 	O_3O  b*r"   c                J   < V ^8  d   QhRS[ S[,          RS[P                  /# r  )rZ   r   r  r  )r    r   s   "r   r!   r     s)     S StCy SX-?-? Sr"   c           	        Rp\        V4      ^ 8  d   R\        P                  9   dz   \        P                  P	                  \        P                  P                  V^ ,          4      \        P                  P                  \        P                  R,          4      4      V^ &   V^ ,          pVP                  R4      '       g   VP                  R4      '       d   V P                  V4      # VP                  R4      '       d   \        P                  p\        P                  ! \        R4      R7      pTP                  RR	R
RT;'       g    \        R4      R7       VP                  RRR
\        R4      R7       TP                  RR\        RT;'       g    \        R4      R7       TP                  RRRT;'       g    \        R4      R7       TP                  RRT;'       g    \        R4      R7       TP                  R R!\        T;'       g    \        R"4      R#7       VP                  R$R
\        R%4      R7       TP                  R&R'R(T;'       g+    \        R)4      \        P                   P"                  ,          R7       VP                  R*R(\        R+4      R7       VP                  R,R-. R.\        R/4      R07       VP                  R1R2R
\        R34      R7       VP                  R4R5\        P                  R67       VP%                  VR7,          4      pVP&                  pV=VP(                  '       dg   VP*                  VP,                  VP.                  VP0                  VP2                  VP4                  .p\7        V4      '       d   VP9                  R84       \        V4      ^8X  d!   XP                  R4      '       d
   R9Vn        V# Vf   V# \        P                  P;                  \        P                  P	                  \<        VR:,           4      4      '       d   R9Vn        Wen        V# VP                  R;4      '       g   VP                  R<4      '       d	   Wen        V# VP?                  4       '       d   R9Vn        Wen        V# R=V9   Ed8   VPA                  R>4      '       d   \        P                   PC                  VPE                  R=4      RH,          4      pV'       g   VP9                  V R?24       M_VPG                  R@RA4      '       d*   VP9                  V RBVRC,           RDVR@,           RE24       MVP9                  V RBVRC,           RF24       \H        PJ                  ! ^4       MH\L        PN                  ! V4      p	V	'       g+   VP9                  V RG24       \H        PJ                  ! ^4       R9Vn        X	Vn(        V# R9Vn        R9V n)        Wen(        V# )IzpParse command line options.

If a single argument is given without any options, this tries to "do
what I mean".
NAPPORT_INVOKED_ASz-update-bugz-collectz-bugzI%(prog)s [options] [symptom|pid|package|program path|.apport/.crash file]r  z-fz
--file-bug
store_truer}  zStart 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  r  z-wz--windowz7Click a window as a target for filing a problem report.)r  r  r.   z--update-bugrN  z;Start in bug updating mode. Can take an optional --package.)r  r  r  z-sz	--symptomSYMPTOMzWFile a bug report about a symptom. (Implied if symptom name is given as only argument.))r  r  r  r  zSpecify package name in --file-bug mode. This is optional if a --pid is specified. (Implied if package name is given as only argument.)r  z-Pz--pidzSpecify 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.))r  r  z	--hangingz*The provided pid is a hanging application.-cz--crash-filePATHzReport the crash from given .apport or .crash file instead of the pending ones in %s. (Implied if file is given as only argument.)z--savezIn 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.r  re  r  r  r  z-vz	--versionz Print the Apport version number.issue?)nargsr  r  zL-u/--update-bug option cannot be used together with options for a new reportTrI  z.crashz.apport/z	/snap/binzv is provided by a snap. No contact address has been provided; visit the forum at https://forum.snapcraft.io/ for help.contactr   z$ 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{  )*rX  r$   r%   r   r   dirnamer   r>  r  r  SUPPRESSr  r   r  r   rD   rE   
report_dirr  r  rN  r}  r  rm  r   r  r<  anyrw   rS  rd  isdigitri   r   r   r   r   r   r   get_file_packager   r   )
r   r   suppresscmdr  rX   r  args_only_for_new_reportsr   pkgs
   &&        r   r   UserInterface.parse_argv  s    t9q="bjj0'',,GGOODG,GG$$RZZ0C%DEQ q'C||M**cll:.F.F--d33||F###,,((J
 	  O 	 	
 	LM	 	 	
 	  P PNO 	 	
 	  / 	 		
 	  /	 	 		
 	  @ 	 
	
 	?@ 	 	

 	 * *@
 ))* 	 	
 	? 	 	
 	UV 	 	
 	56	 	 	
 	G3X5F5FG  b*

J 		)% ,--5 t9>cll622DLK =K 77>>"'',,'955=IJJDL Ld _ ^^H%%	)B)B#O\ W ]]__DLHR M E\,,''11%++c2B22FGLL ' "A B
 XXi,,LL ' " -. /  $Y0
< LL ' " -. /DE 007LLE7*H!IJHHQKDLDL 	  DL#'D  Lr"   c                &   < V ^8  d   QhRS[ RS[/# )r   sizer   )r   r   )r    r   s   "r   r!   r     s     I Ic Ic Ir"   c                    V R8  d   \         P                  ! RV R,          4      # V R8  d   \         P                  ! RV R,          4      # \         P                  ! RV \        R4      ,          4      # )zCFormat the given integer as humanly readable and i18n'ed file
size.i@B z%.1f KBg     @@i ʚ;z%.1f MBg    .Az%.1f GB)localeformat_stringfloat)r  s   &r   format_filesizeUserInterface.format_filesize  s_     '>''	4&=AA*''	4)3CDD##IteJ6G/GHHr"   c                    < V ^8  d   QhRS[ /# rN   r  )r    r   s   "r   r!   r     s     
 
3 
r"   c                   V P                   '       g   Q h^ pV P                    F+  p WP                   V,          P                  4       ,          pK-  	  V#   \         d(    T\        T P                   T,          4      ,          p Kb  i ; i)z'Return the size of the complete report.r   get_on_disk_sizer   rX  r   r  ro   s   &  r   get_complete_sizeUserInterface.get_complete_size  sp    {{{{A,A7799 
  " ,DKKN++,s   'A.BBc                    < V ^8  d   QhRS[ /# rN   r  )r    r   s   "r   r!   r     s      # r"   c                $   V P                   '       g   Q h^ pV P                    F4  pVR8w  g   K   WP                   V,          P                  4       ,          pK6  	  V#   \         d(    T\        T P                   T,          4      ,          p Kk  i ; i)z&Return the size of the reduced report.r   r  r  s   &  r   get_reduced_sizeUserInterface.get_reduced_size  sw    {{{{AJ0KKN;;==D   & 0CA//D0s   'A.BBc                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r     s     & &T &r"   c                    V P                   '       d   RV P                   9  d   R# \        P                  ! R4      f   R# V P                  4       # )zCheck 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   Fzapport-retrace)r   shutilwhichui_has_terminalr   s   &r   can_examine_locally!UserInterface.can_examine_locally  s=     {{{j;<<()1##%%r"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s       r"   c           
     f   V P                   '       d   RV P                   9   g   Q h\        P                  ! 4       ^ 8X  dr   \        P                  ! 4        \        P                  ! RRRV P                   P                  RV P                   R,          4      4       \        P                  ! ^4       R# R# )zReopen the crashed application.r1  shr  RespawnCommandN)r   r$   forksetsidexeclpr   r   r   r  s   &r   r   UserInterface.restart  su    {{{};;;779>IIKII 0$++m2LM	 HHQK r"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     0 0 0r"   c                .   V P                   '       g   Q hV P                  \        R4      \        R4      \        R4      \        R4      V P                   ,          .R4      pVf   R# \        P                  P                  R4      pRV R	2pR
pRV P                   P                  RR4      ,           R,           p^ VR,           V,           ^VR,           V,           ^VR,           V,           R,           V,           /pV P                  Wa^ ,          ,          4       R# )zLocally examine crash report.zJThis will launch apport-retrace in a terminal window to examine the crash.zRun gdb sessionz1Run gdb session without downloading debug symbolsz)Update %s with fully symbolic stack traceFNz~/.cache/apport/retracezapport-retrace -S system -C z -v zapport-retrace 'z'\''z--gdb z	--output  )r   rg  r   r$   r   r=  replaceui_run_terminal)r   r  	cache_dirretrace_with_downloadretrace_no_downloadfileargcmdss   &      r   r   UserInterface.examine  s   **)
 #$EF=>AQAQQ	 
 GG&&'@A	">yk N/((00g>>D $x/'9"X-7${2W<sBWL
 	T1+./r"   c                $   < V ^8  d   QhRS[ RR/# )r   send_reportr   NrO   )r    r   s   "r   r!   r   (  s     ' ' ' 'r"   c                `    \         P                  ! RRRRRRRRR	\        V4      P                  4       .
4       \         P                  ! . RO4       R#   \        \         P
                  3 d@   p\        R
4      pT P                  \        R4      T R\        T4       24        Rp?R# Rp?ii ; i)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.SetReportCrasheszLSaving crash reporting state failed. Can't set auto or never reporting mode.z*Can't remember send report status settingsr   N)
r  r  r  r  r  r  r  r  z<com.ubuntu.WhoopsiePreferences.SetAutomaticallyReportCrashestrue)r2   check_outputr   lowerrG   CalledProcessErrorr   r   )r   r  rw   msgs   &&  r   r   "UserInterface.remember_send_report(  s    %	##$45E$**, ## 667 	;C !!>?%tCJ<( 	s   AA B-.4B((B-c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r   Q  s     & &d &r"   c                   V P                   e   RV P                   9  d   R# V P                   R,          P                  4       P                  R4      '       ds    \        P                  ! V P                   R,          4      p\        V\        4      '       g   Q hRV9   g   Q h  \        P                  P                  RT4      T n        R#  \        P                  P                  RV P                   R,          4      V n        R#   \        \        \        3 d2   pRT P                   R,           RT 2T P                   R&    Rp?R	# Rp?ii ; i  \        \        3 d)    R
T P                   R,           R2T P                   R&    R# i ; i  \        \        3 d)    R
T P                   R,           R2T P                   R&    R	# i ; i)z+Process reports' CrashDB field, if present.Nr   T{r   z=A package hook defines an invalid crash database definition:

r   Fz@A package hook wants to send this report to the crash database "z" which does not exist.)r   lstripri   astliteral_evalr   r:   AssertionErrorSyntaxErrorr'   rD   r   load_crashdbr   r&   r   )r   specrw   s   &  r   check_report_crashdb"UserInterface.check_report_crashdbQ  s   ;;)4;;"> ;;y!((*55c::	''I(>?!$----~%~%~~::4F( %~~99$I@VW 7 #K< %%)[[%;$<BugG 01   * ""&++i"8!9 :-. 01$ '  * ""&++i"8!9 :-. 01
 s=   AD #%E 6F	 E
&EE
5FF	5GGc                ^   < V ^8  d   QhRS[ R,          RS[RS[. R3,          R,          RR/# )r   r   Nr   on_finishedr   )r   rP   r   )r    r   s   "r   r!   r   y  sK     o od
o !o b$h'$.	o
 
or"   c           
     6   V P                   '       g   Q hRV P                   R&   V P                   P                  R4      R8X  d   RV P                   9   g2   V P                   P                  R4      R8w  d#   RV P                   9   d   V'       d   V! 4        R# V P                   P                  R4      R8X  Ed   V P                   P                  RR	4      p\        P                  P	                  V4      '       gL   \        R
4      pV'       d   V RV P                   R,           R2pWPP                   R&   V'       d   V! 4        R# RV P                   9   dy   \        P                  P	                  V P                   R,          4      '       gC   \        R
4      pV RV P                   R,           R2V P                   R&   V'       d   V! 4        R# V P                   P                  4       pVe   V P                   R \        \        P                  ! V P                   R,          4      P                  4      pWg8w  dB   RV P                   R&   \        R4      V P                   R,          ,          V P                   R&   R# V P                  '       g6   RV P                   9  d%   V'       g   V P                   P                  4        EM)V P                  4        V P                  P                  V P                   4      '       d   \        V 4      pM
\!        4       pRV P                   9  Ed   \        P"                  P%                  4       p	\&        P(                  P)                  \*        RV P                   V P,                  V P                  VVV3R7      p
V
P/                  4        V
P1                  4       '       d$   V P3                  4         VP5                  4        K9  V
P=                  4        \        P"                  P?                  4        \        P"                  PA                  V	4        V
PC                  4        RV P                   9   EdY   RV P                   9   EdG   RV P                   R,          9   d   ^ .pM`V PW                  \        R4      \        R4      V P                   R,          ,          \        R4      V P                   R,          ,          .R4      pV^ .8X  dK   V P                   R R V P                   9   d   V P                   R  R!V P                   9   d   V P                   R! MxV^.8X  dK   V P                   R R"V P                   9   d   V P                   R" R#V P                   9   d   V P                   R# M&V PY                  4        \8        P:                  ! ^ 4       RV P                   9   dU   R#V P                   9   dD   V P                   P[                  V P                   P]                  R#4      P_                  R$4      4       RV P                   9   d   R"V P                   9  d   R%V P                   9  d   RV P                   9  d   V P`                  '       d   \&        Pb                  Pe                  V P                  4      pVP                  R&R	4      '       d9   \        R'4      VR(,          VR),          VR&,          3,          V P                   R&   M/\        R*4      VR(,          VR),          3,          V P                   R&   RV P                   R&   RV P                   9   g   V Pg                  4       '       g"   V PY                  4        V'       d   V! 4        R# V P                   P                  R4      R+8X  g2   V P                   P                  R4      R,8X  g   RV P                   9   d   \&        P(                  P)                  V P                   Ph                  V P                  Pk                  4       3R-7      pVP/                  4        VP1                  4       '       d%   V P3                  4         VP=                  R.4       K:   VPC                  4        VPm                  4       '       d   VPm                  4       V P                   R/&   V P                   P                  R4      R08w  d   \&        P(                  P)                  V P                  Pn                  V P                   3R-7      pVP/                  4        VP1                  4       '       d%   V P3                  4         VP=                  R.4       K:  VPC                  4        VPm                  4       pVe&   VR1J d   R2V P                   R/&   MVV P                   R/&   \&        P(                  P)                  V P                   Pp                  R37      pVP/                  4        VP1                  4       '       d%   V P3                  4         VP=                  R.4       K:  VPC                  4        V PY                  4        RV P                   9  d   R!V P                   9  d   RV P                   9  gC   V P                   P                  RR	4      Ps                  R44      '       gr   RV P                   9  da   V Pu                  4       '       gK   V Pw                  \        R54      \        R64      4       V Py                  4        \8        P:                  ! ^4       V'       d
   V! 4        R# R#   \6         d    \8        P:                  ! ^4        EK  i ; i  \D        \F        \H        PJ                  3 dC   p\        R4      pT R\M        T4       2T P                   R&   RT P                   R&    Rp?ELPRp?i\N         d=    RT P                   9  d(   \        R4      T P                   R&   RT P                   R&    EL\P         ds   p\&        PR                  PK                  R\M        T4      4       \        R4      R,           \U        T4      ,           T P                   R&   RT P                   R&    Rp?ELRp?ii ; i  \6         d    \8        P:                  ! ^4        EKj  i ; i  \D        \F        \H        PJ                  3 d4   p\        R4      pT R\M        T4       2T P                   R&    Rp?ELqRp?ii ; i  \6         d    \8        P:                  ! ^4        EK  i ; i  \6         d    \8        P:                  ! ^4        EK]  i ; i)7a  Collect 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   r   r   r   DependenciesNr   r   zIThis problem report applies to a program which is not installed any more.z ()r   InterpreterPathExecutableTimestampr   zPThe problem happened with the program %s which changed since the crash occurred.r   )targetr*   rX   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:r   r   z(not installed)zcYou have two versions of this application installed, which one do you want to report a bug against?z%s snapz%s deb packageFPackageArchitecturerG  
SnapSourceSnapTagsr  SnapGitNamer  zG%s is provided by a snap published by %s. Contact them via %s for help.r*   r  z%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  rX   皙?_KnownReportr,  T1)r  Kernelr   z7Could not determine the package or source package name.)=r   r   r$   r   rS  r   get_executable_timestampr   r-  st_mtimer   r   !ui_start_info_collection_progressr   r   r   r   r%   copyrD   REThreadr   r   startis_alive!ui_pulse_info_collection_progressprocess_eventKeyboardInterruptr   r   r   clearrY  	exc_raiserG   EOFErrorzlibrw   reprr'   r   r   r   rg   ui_stop_info_collection_progressadd_tagspopr   r   rE   r   r  search_bug_patternsget_bugpattern_baseurlreturn_valueknown	anonymizeri   _is_snapr   ui_shutdown)r   r   r   r	  exe_pathr  	orig_timecur_timehookuiorig_envicthreadrw   resr   bpthreadknown_threadvalanonymize_threads   &&&&              r   r   UserInterface.collect_infoy  sF
   ( {{{{(.$% KKOOM*g5,$++:UKKOOM*g5.DKK:W ;;??=)W4{{'7<H77>>(++8  EDKK0@$A#B!DC4701M DKK/ww~~dkk2C&DEE<C
 %r$++.?"@!AC KK 45 ## KK88:	 122774;;/?#@AJJKH$07,-C kk"23	4 01      3" KK##% 224 ||##DKK00-/4;;.::??,!??33..((((&* 4   ''))::<$,,.  

  "

!!(+<&&(2 $dkk)A$I(>> ./CC11. iL4;;v+>>./$++i2HH C 1#:I.,; KK(=>&$++5 KK8QCZF+#t{{2 KK5!T[[0 KK
399;HHQK $t{{)B$$T[[__Z%@%F%Fs%KL $++% 3T[[8X(;(((''11$2B2BC88Ir**8999 ftK'8$y/J9KDKK 45
 9:D9 ftK'89	9:DKK 45
 18,-#t{{2$:S:S:U:U557M .-?;;??=1\A+!??33;;::,,==?A 4   ''))::<$ c*R&&(
 ((**2:2G2G2IDKK/ {{}-6%77<<--T[[N  8   ""$"++--::<$$))#. &&("//1?d{69N369N3  &77t{{?T?T7U""$"++--668 $))#. &&(113 $4;;6 (t{{:*$++= !KKOOM2>II(SS%T[[8--//))23ST $$&HHQKM s - $$  4::6 <UVC;>%tDK=8QDKK 454;DKK 01! @+4;;><=S=$89 9@$45  
<NN((tE{;; !	!
 e*% KK 45 5<DKK 01
<B - $$  4::6 RUVC;>%tDK=8QDKK 45R" - $$$ )  HHQKK s   k< "l% ,q
  q3 s	 !s2 <!l"!l"% q7nq9qqqA'qq
!q0/q03 s(ss	!s/.s/2!ttc                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r     s     D D$ Dr"   c                v    V P                   '       g   Q hR V P                   9   ;'       g    RV P                   9   # )r  r   )r   r  s   &r   r4  UserInterface._is_snap  s0    {{{{t{{*CCf.CCr"   c                $   < V ^8  d   QhRS[ RR/# )r   urlr   Nr   )r    r   s   "r   r!   r     s     > >C >D >r"   c                :     \        RV.RR7       R#   \         d(    \        P                  ! T^RR7      '       d    R# Rp M!i ; i  \         d   pRT 2p Rp?MRp?ii ; i\        R4      p\        R	4      T,          pT P                  YET,           4       R# )
zZOpen the given URL in a new browser window.

Display an error dialog if everything fails.
zxdg-openT)rV   N)new	autoraiser   r  zUnable to start web browserz'Unable to start web browser to open %s.)rq   rG   
webbrowserr@   r   r   r   )r   rF  error_detailsrw   r   messages   &&    r   open_urlUserInterface.open_url  s    

	)# *c!2F #??3A>> "	#
  	) LM	) /0=>De}%<=s8    )AA	 AA	 AA	 	A#AA#c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     O OT Or"   c           	     T  a a S P                   '       g   Q hS P                  P                  S P                   4      '       g   R# S P                   P                  R4      S P                   P                  R4      8X  d    S P                   R  S P                   R RS n        V 3R lp\        P                  ! 4       oR V3R llp\        S P                   4       F)  pVP                  R4      '       g   K  S P                   V K+  	  S P                  4        \        P                  P                  S P                  P                  S P                   W3R	7      pVP                  4         VP                  4       '       df   S P!                  S P
                  4        SP                  R
RR7      w  rVpS P#                  WV4       VP%                  4        VP'                  4        K{  VP'                  4        TPA                  4       p
S PC                  4        S P                  PE                  S P                   T
4      pT'       d   S PG                  T4       R# R#   \         d     ELi ; i  \         d     ELi ; i  \        P(                   d     EK+  i ; i  \*         d    \,        P.                  ! ^4        L\0        P2                  \4        P6                  P8                  3 d@   p\;        R4      p	S P=                  \;        R4      T	 R\?        T4       24        Rp?R# Rp?ii ; i)zGUpload the current report and guide the user to the reporting
web page.Nr  ArchitectureStacktraceAddressSignaturec                 6   < \        V 4      V,          Sn        R # N)r  r   )senttotalr   s   &&r   progress_callback4UserInterface.file_report.<locals>.progress_callback  s    #(;#6D r"   c                4    V ^8  d   QhR\         R\         RR/# r   r   r1   r   Nr   )r    s   "r   r!   /UserInterface.file_report.<locals>.__annotate__  s!     	% 	%C 	%s 	%t 	%r"   c                 x   < \         P                  ! 4       pSP                  WV34       VP                  4        R # rT  )	threadingEventputwait)r   r1   message_displayedmessage_queues   && r   message_callback3UserInterface.file_report.<locals>.message_callback  s0     ) 1u,=>?""$r"   r   r  Tr  )blocktimeoutzHCannot connect to crash database, please check your Internet connection.zNetwork problemr   )$r   r   r   r   r&   r   queueSimpleQueuerZ   ri   ui_start_upload_progressrD   r!  uploadr"  r#  ui_set_upload_progressrV  setr(  Emptyr&  r   r   smtplibSMTPConnectErrorurllibrw   URLErrorr   r   r   r1  ui_stop_upload_progressget_comment_urlrM  )r   rW  rc  ro   upthreadr   r1   msg_displayedrw   r  ticketrF  rb  s   f           @r   r  UserInterface.file_report  s    {{{{ ||##DKK00;;??01T[[__^5TTKK 56	89  $	7  		% 	% dkk"A||C  KKN # 	%%'??++<<&&++0C , 
 		##%%++D,@,@A1>1B1B"C 2C 2.E ((5!%%'&&(   &&($$&ll**4;;?MM#     		L {{  ! 	HHQK((&,,*?*?@ 	:C !!!$5"63%tCJ<8PQ	ss   >I I( (J >J AI: !J I%$I%(I76I7:JJ JJ !L':,L''L'(4L""L'c                &   < V ^8  d   QhRS[ RS[/# )r   r   r   r*  )r    r   s   "r   r!   r     s     * * * *r"   c           	         \         P                  P                  4       V n        \        VR4      ;_uu_ 4       pV P                  P	                  VRR7       RRR4       RV P                  9  d   \        R4      h RT P                  9   d0   T P                  R,          P#                  4       ^ ,          T n        R# \         P&                  P)                  T P                  P+                  RR4      4      T n        R#   + '       g   i     L; i  \         d0    RT n        T P                  \        R4      \        R4      4        R	# \         dA   pRT n        T P                  \        R
4      \        TP                  4      4        Rp?R	# Rp?i\        \
        \        \        P                  3 dG   pRT n        \        R4      pT P                  \        R
4      T R\!        T4       24        Rp?R	# Rp?ii ; i)zLoad 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)binaryNr   z+Report does not contain "ProblemType" fieldzMemory exhaustionzEYour system does not have enough memory to process this crash report.Fr   r  r   r   r   r   T)rD   r   r  r@   loadr'   MemoryErrorr   r   rG   r   r  	TypeErrorr  r*  rw   r+  r   r   rE   r   r   )r   r   r   rw   r  s   &&   r   r   UserInterface.load_report  s   	 --..0DKdD!!Q  < 8 "DKK/ !NOO 00 ##{{95;;=a@D 	  &//AA 0"5 D C "!  		DK!!%&5  	DK!!!$<"=s5>>?RS:~tzzB 	DKMNC!!*+uDe-F 	sL   7D C<$D <D	D 6G;G;G;5F&G;4G;5;G66G;c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r   B  s      D r"   c                X   V P                   '       g   Q hV P                  P                  V P                   4      '       g   R# RV P                   9   d   \        V P                   R,          \        4      '       d0   V P                   R,          P                  R4      V P                   R&   RV P                   9   d:   \        R4      V P                   R,          P                  4       ^ ,          ,          pMRpV P                  V\        R4      V P                   R,          ,          4       R# R# )	z^Check if the current report is unreportable.

If so, display an info message and return True.
Fr   UTF-8r   r   r   z#The problem cannot be reported:

%sT)	r   r   r   r   bytesr  r   r   rV  )r   r   s   & r   r   UserInterface.check_unreportableB  s    
 {{{{||##DKK004;;.$++&:;UCC48KK(5&/ 01 DKK'/*T[[-C-I-I-KA-NN  9:++234
 r"   c                D   < V ^8  d   QhRS[ S[S[3,          R,          /# rp  )r:   r   )r    r   s   "r   r!   r   [  s!      4S>D#8 r"   c           	        V P                   '       g   Q hRV P                   9   dK   \        P                  P                  V P                   R,          4      '       d   V P                   R,          pM* \        P
                  P                  V P                  4      pV'       g   R# \        P                  ! RRR7      p VP                  VRR7       TP#                  R
4      '       g   R# \%        TP'                  R
4      4      pRT9  d   R# T#   \         d     R# i ; i  \        P                   d;   p\        P                  P                  RT R\!        T4       R	24        Rp?R# Rp?ii ; i)zzReturn a .desktop info dictionary for the current report.

Return None if report cannot be associated to a .desktop file.
DesktopFileNF)interpolationstrictr  r{   z	Warning! z is broken: r  zDesktop Entryr*   )r   r$   r   rS  rD   rE   find_package_desktopfiler   r'   configparserConfigParserr   r   r   rz  r   r   has_sectionr:   rh   )r   desktop_filecprw   r   s   &    r   get_desktop_entryUserInterface.get_desktop_entry[  s$   
 {{{{DKK'BGGNN4;;};U,V,V;;}5L%//HH$$  &&T%H	GGL7G3 ~~o..bhh/0#   !! 	JJyl3u:,bQR	s*   1)D =D  DD E/5/E**E/c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r   {  s        $  r"   c                   V P                   '       g   Q hV P                  P                  V P                   4      '       g   R# RV P                   9  d   R# V P                   R,          P                  R4      '       dI   V P	                  \        R4      \        R4      4       V P                  V P                   R,          4       R# V P	                  \        R4      \        R4      4       R# )zCheck 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  httpzProblem already knownzThis 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)r   r   r   ri   rV  r   rM  r  s   &r   r   UserInterface.handle_duplicate{  s     {{{{||##DKK00, ;;~&11&99  )*A MM$++n56    )*OP
 r"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     1 1 1r"   c                    V P                   '       g   Q hV P                  P                  '       d2   V P                   P                  V P                  P                  4       R# R# )z6Add extra tags to report specified with --tags on CLI.N)r   rX   r  r-  r  s   &r   r;  UserInterface.add_extra_tags  s<    {{{{99>>>KK  0 r"   c                :   < V ^8  d   QhRS[ RS[R,          RS[/# )r   r   r  Nr   )rP   r   r   )r    r   s   "r   r!   r     s.     T T!%T9<tT	Tr"   c                    \        R4      h)zShow 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   &&&r   r   'UserInterface.ui_present_report_details  s     ""RSSr"   c                *   < V ^8  d   QhRS[ RS[ RR/# rZ  r   )r    r   s   "r   r!   r     s'     T TS T T Tr"   c                    \        R4      h)z:Show an information message box with given title and text.r  r  r   r   r1   s   &&&r   rV  UserInterface.ui_info_message      !"RSSr"   c                *   < V ^8  d   QhRS[ RS[ RR/# rZ  r   )r    r   s   "r   r!   r     s'     T Tc T T Tr"   c                    \        R4      h)z4Show an error message box with given title and text.r  r  r  s   &&&r   r   UserInterface.ui_error_message  r  r"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     T T4 Tr"   c                    \        R4      h)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   &r   r  /UserInterface.ui_start_info_collection_progress       ""RSSr"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     T T4 Tr"   c                    \        R4      h)zQAdvance the data collection progress bar.

This function is called every 100 ms.
r  r  r  s   &r   r$  /UserInterface.ui_pulse_info_collection_progress      
 ""RSSr"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     T T$ Tr"   c                    \        R4      h)z,Close debug data collection progress window.r  r  r  s   &r   r,  .UserInterface.ui_stop_info_collection_progress  r  r"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     T T$ Tr"   c                    \        R4      h)zkOpen progress bar for data upload.

This tells the user to wait while debug information is being uploaded.
r  r  r  s   &r   ri  &UserInterface.ui_start_upload_progress  r  r"   c                2   < V ^8  d   QhRS[ R,          RR/# )r   progressNr   )r  )r    r   s   "r   r!   r     s#     T Tut| T Tr"   c                    \        R4      h)zUpdate 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   r  s   &&r   rk  $UserInterface.ui_set_upload_progress  s     ""RSSr"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s     T T Tr"   c                    \        R4      h)z(Close debug data upload progress window.r  r  r  s   &r   rr  %UserInterface.ui_stop_upload_progress  r  r"   c                   < V ^8  d   QhRR/# rp  rT   )r    r   s   "r   r!   r     s      T r"   c                    R# )zTCalled right before terminating the program.

This can be used for for cleaning up.
NrT   r  s   &r   r5  UserInterface.ui_shutdown  s    r"   c                    < V ^8  d   QhRS[ /# rN   rO   )r    r   s   "r   r!   r     s     T T Tr"   c                    \        R4      h)z`Check for a terminal window.

Check if a terminal application is available and can be launched.
r  r  r  s   &r   r  UserInterface.ui_has_terminal  r  r"   c                $   < V ^8  d   QhRS[ RR/# )r   commandr   Nr   )r    r   s   "r   r!   r     s     T Ts Tt Tr"   c                    \        R4      h)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   r  s   &&r   r  UserInterface.ui_run_terminal  r  r"   c                4   < V ^8  d   QhRS[ RS[R,          /# r   r1   r   Nr*  )r    r   s   "r   r!   r     s#     T Tc TdTk Tr"   c                    \        R4      h)z|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   r1   s   &&r   rP  UserInterface.ui_question_yesno  r  r"   c          	      `   < V ^8  d   QhRS[ RS[S[ ,          RS[RS[S[,          R,          /# )r   r1   optionsmultipler   N)r   rZ   rP   r   )r    r   s   "r   r!   r     s@     T TT"&s)T7;T	cT	Tr"   c                    \        R4      h)a=  Show 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   r1   r  r  s   &&&&r   rg   UserInterface.ui_question_choice  s     ""RSSr"   c                4   < V ^8  d   QhRS[ RS[ R,          /# r  r   )r    r   s   "r   r!   r     s#     T TS TS4Z Tr"   c                    \        R4      h)z]Show a file selector dialog.

Return path if the user selected a file, or None if cancelled.
r  r  r  s   &&r   ui_question_fileUserInterface.ui_question_file  r  r"   )	rX   r   r   r   r   r   r   r   r   rT  )NFN)TN)6r   r   r   r   r   r   r   r   staticmethodr   r  r  r'  rC  r^  r4  rr  r  r  r   r  r  r  r  r   r   r   r  r   r4  rM  r  r   r  r  r   r;  r   rV  r   r  r$  r,  ri  rk  rr  r5  r  r  rP  rg  r  r   r   r   s   @r   r   r   T  sF    * *>" "Hx xt - -+ +Z   * *} }B] ]~1 1f
$ 
$R" R"p  *S Sj I I
 
 & & 0 0B' 'R& &Po ob	D D> >.O Ob* *X 2 @   D1 1T TT TT TT TT TT TT TT TT T T TT TT TT TT Tr"   r   rT  )NF)@r   r  r   r  dataclassesrt   r   rc  r?  r5  r  os.pathr$   re   rg  r   r  r  rn  r2   r   r]  r!  r   urllib.errorrp  rJ  r*  collections.abcr   r   r   typingr   apport.crashdbrD   apport.fileutilsapport.loggingapport.reportapport.REThreadapport.hook_uir   r   apport.packaging_implr   r   apport.user_groupr	   r  r%   r   rd  r6  r   r(   r8   rL   rU   rq   rx   r   	dataclassr   r   rT   r"   r   <module>r     s   "  
       	   
  	     
       .         7 3 8 ZZ^^$9;WX 
		'8P
%-2%PN$b   ET ETr"   