+
    Gj                        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HtHt ^ RIt^ RIHt ^ RIHt ]P0                  ! R4      tRsR tR<R	 ltR=R
 ltR<R ltR>R ltR t R t!R t"R t#R R lt$R t%R t&R t'R t(R]
PR                  RR3R lt*R t+R t,R t-R]
PR                  R3R lt.R R lt/R R lt0R  t1R?R!R/R" llt2R?R# lt3^t4^t5^t6^t7^t8^t9^t:^t;^	t<^
t=^t>^t?R$ t@R% tAR?R& ltBR' tCR( tDR) tER@R* R+ lltFR, tGR- R. ltHR/ tIR0 tJR?R1 R2 lltKR3 tLR4 tMR5 tNRAR6 ltOR7 tPR8 tQR9 tRR?R: ltSR; tT]P                  P                  tV]P                  P                  tWR# )Bz/Convenience functions for use in package hooks.N)IterableMapping)impl)ProblemReportz[^0-9a-zA-Z_.-]c                    \        V \        4      '       d   V P                  R4      p \        P	                  RV P                  RR4      4      # )zsGenerate a valid report key name from a file path.

This will replace invalid punctuation symbols with valid ones.
UTF-8. _)
isinstancebytesdecode_invalid_key_chars_resubreplace)paths   &2/usr/lib/python3/dist-packages/apport/hookutils.pypath_to_keyr   (   s=    
 ${{7# $$S$,,sC*@AA    TFc                    RV9   d   R# V'       g   \        V4      p\        P                  P                  V4      '       d   \	        WW#V4       R# R# )av  Attach file contents if file exists.

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

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

If the contents is valid UTF-8, or force_unicode is True, then the value
will be a string, otherwise it will be bytes.
../N)r   osr   existsattach_filereportr   key	overwriteforce_unicodes   &&&&&r   attach_file_if_existsr   2   s?     }$	ww~~dF#-@ r   c                    RV 9   d   R# \         P                  ! V \         P                  \         P                  ,          \         P                  ,          4      p\         P
                  ! V4      p\         P                  P                  V 4      pVP                  \         P                  ! V4      P                  8w  g   W8w  d   \         P                  ! V4       R# \        P                  ! VP                  4      '       g   \         P                  ! V4       R# \         P                  ! VR4      ;_uu_ 4       pVP                  4       P                  4       pRRR4       T'       d   XP%                  RR	R
7      #  XP%                  R4      #   + '       g   i     L=; i  \          d   pR\#        T4       2u Rp?# Rp?ii ; i  \&         d    Xu # i ; i)zReturn the contents of the specified path.

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

Upon error, this will deliver a text representation of the error,
instead of failing.
r   zError: invalid path.zError: path contained symlinks.z#Error: path was not a regular file.rbNError: r   r   errors)r   open
O_NOFOLLOWO_RDONLY
O_NONBLOCKfstatr   realpathst_inostatcloseS_ISREGst_modefdopenreadstripOSErrorstrr   UnicodeDecodeError)r   r   fdst	real_pathfcontentserrors   &&      r   	read_filer<   K   s;   &D=)WWT2==2;;6FGXXb\GG$$T*	99	*111T5FHHRL4||BJJ''HHRL8YYr4  Avvx~~'H !
 wy99w'' !  &U%%&  se   F  CF  %F  F  F  9FF  <G F	F  F   G+F>8G>GGGc                z    V'       g   \        V4      pV'       g   W 9   d   VR,          pK  \        WR7      W&   R# )ak  Attach a file to the report.

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

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

If the contents is valid UTF-8, or force_unicode is True, then the value
will a string, otherwise it will be bytes.
r
   )r   N)r   r<   r   s   &&&&&r   r   r   p   s0     $ m3JCD>FKr   c                2   \         P                  ! V4      pVP                  4        F  w  rVV'       d	   WR9  d   K  R\        V4       2p\	        V\
        4      '       d%   VR8X  g   VP                  R4      '       d   W`V&   K]  V'       d(   VP                  RV R24      pV'       d   W`V&   M	RW&   MRW&   \        P                  P                  \        P                  ! V4      P                  4      p	V	P                  4       V R\        V4       2&   K  	  R# )	a  Attach information about any modified or deleted conffiles.

If conffiles is given, only this subset will be attached. If ui is given,
ask whether the contents of the file may be added to the report; if this is
denied, or there is no UI, just mark it as "modified" in the report.
zmodified.conffile.z	[deleted]z[inaccessiblez,It seems you have modified the contents of "z@".  Would you like to add the contents of it to your bug report?z
[modified]zmtime.conffile.N)	packagingget_modified_conffilesitemsr   r   r4   
startswithyesnodatetimefromtimestampr   r,   st_mtime	isoformat)
r   package	conffilesuimodifiedr   r:   r   responsemtimes
   &&&&      r   attach_conffilesrN      s     //8H"..*.";t#4"56h$$#x':':?'K'K"3Kxx>tf EO PH &s*&FK!!//0F0FG8=8IT!2 3451 +r   c                @    \         P                  ! R\        ^R7       R# )z4Attach information about any Upstart override files.z`apport.hookutils.attach_upstart_overrides() is obsolete. Upstart is dead. Please drop this call.
stacklevelNwarningswarnPendingDeprecationWarningr   rH   s   &&r   attach_upstart_overridesrW          MM	3!	r   c                @    \         P                  ! R\        ^R7       R# )z:Attach information about a package's session upstart logs.z[apport.hookutils.attach_upstart_logs() is obsolete. Upstart is dead. Please drop this call.rP   NrR   rV   s   &&r   attach_upstart_logsrZ      rX   r   c                t    V P                  RR4      P                  4       '       g   \        R.4      V R&   R# R# )zoAttach information from the kernel ring buffer (dmesg).

This will not overwrite already existing information.
CurrentDmesg dmesgN)getr2   root_command_outputr   s   &r   attach_dmesgrb      s4    
 ::nb)//11!4gY!?~ 2r   c                f   Rp\         P                  P                  V4      '       d   \         P                  ! V4       F  pVR9   d   K  \         P                  P	                  V RV 24      p\         P
                  ! V4      p\
        P                  ! VP                  4      '       d   VP                  ^,          ^ 8X  d   K   \        V4      pT'       g   K  YPRTP                  RR4       2&   K  	  RV 9   d$   RV 9   d   V R,           RV R,           2V R	&   R
# R
# R
#   \         d     K  i ; i)zDAttach Desktop Management Interface (DMI) information to the report.z/sys/class/dmi/id/zdmi.r
   r   zdmi.sys.vendorzdmi.product.namer	   MachineTypeN>   uevent	subsystem)r   r   isdirlistdirr*   r,   r.   r/   r<   r3   r   )r   dmi_dirr9   pr7   values   &     r   
attach_dmirm      s   !G	ww}}WG$A++  G9AaS!12AB<<

++

Q!0C!! u7<aiiS1234 %" 6!&8F&B&'(&1C*D)EF 	} 'C!  s   D!!D0/D0c                0    V ^8  d   QhR\         R\         /# )   udevdbreturn)r4   )formats   "r   __annotate__rs      s      c c r   c                    \         P                  ! RRV 4      p \         P                  ! RRV 4      p \         P                  ! RRV 4      p V # )zWTake the output of udevadm info -e and return a string with redacted
filesystem labels.zID_FS_LABEL=(.*)zID_FS_LABEL=<hidden>zID_FS_LABEL_ENC=(.*)zID_FS_LABEL_ENC=<hidden>zby-label/[^ /\n]*zby-label/<hidden>)rer   )rp   s   &r   anonymized_udevdbrv      sG    
 VV')?HFVV+-GPF VV(*=vFFMr   c                   \        V 4       \        V RR4       \        V RR4       \        V RR4       \        P                  P	                  R4      '       d!   \        RR	.4      V R
&   \        RR.4      V R&   \        R.4      V R&   \        RR.4      V R&   \        RR.4      V R&   \        RR.4      V R&   \        \        . R!O4      4      V R&   \        R.4      V R&   \        V 4       \        R4      '       d   \        R.4      V R&   \        R4      '       dS   \        RR.4      P                  4       pV'       d   WR&   \        RR.4      P                  4       pV'       d   WR&   R # R # R # )"aB  Attach a standard set of hardware-related data to the report, including:

- kernel dmesg (boot and current)
- /proc/interrupts
- /proc/cpuinfo
- /proc/cmdline
- /proc/modules
- lspci -vvnn
- lscpi -vt
- lsusb
- lsusb -v
- lsusb -t
- devices from udev
- DMI information from /sys
- prtconf (sparc)
- pccardctl status/ident
z/proc/interruptsProcInterrupts/proc/cpuinfoProcCpuinfo/proc/cmdlineProcKernelCmdLinez/sys/bus/pcilspci-vvnnLspciz-vtzLspci-vtlsusbLsusb-vzLsusb-vz-tzLsusb-tsort/proc/modulesProcModulesUdevDbz%/usr/share/apport/dump_acpi_tables.pyacpidumpprtconfPrtconf	pccardctlstatusPccardctlStatusidentPccardctlIdentN)udevadminfoz--export-db)rb   r   r   r   r   command_outputrv   r`   rm   command_availabler2   )r   outs   & r   attach_hardwarer      se   $ *,<=7)<=	ww~~n%%('7);<w+We,<=z$gY/F7O&7F9&7F9*FO+DEF=(9:F8 -.U-VWF:v##*I;7y%%k845;;=(+$%k734::<'*#$  &r   c                   \        V \        P                  P                  R4      R4       \        V \        P                  P                  R4      R4       \        V R4       \        V RR4       \	        V RR	4       \        . R!O4      V R&   \        RR
.4      V R&   \        RR
.4      V R&   \        \        4      V R&   . p\        P                  P                  R4      '       dp   \        RRR7      ;_uu_ 4       pV FK  pRV9   g   K  VP                  4       P                  4       pVP                  \        V^ ,          4      4       KM  	  RRR4       V EFu  pRV R2p\        RR\        V4      R.4      W&   RV R2p\        RR\        V4      .4      W&   \        P                  ! RV R24       EF  p\        P                  P!                  V4      '       d@   \        P                  P#                  V4      pRV R\%        V4       2p\	        WVR7       Kh  \        P                  P'                  V4      '       g   K  \        P                  P#                  V4      p\        P(                  ! V4       FK  p	\        P                  P+                  Wy4      p
RV R\%        V4       R \%        V	4       2p\	        W
V4       KM  	  EK  	  EKx  	  R#   + '       g   i     EL; i)"z(loosely based on http://www.alsa-project.org/alsa-info.sh)
for systems where alsa-info is not installed
(i e, *buntu 12.04 and earlier)
z~/.asoundrcUserAsoundrcz~/.asoundrc.asoundconfUserAsoundrcAsoundconfz/etc/asound.confz/proc/asound/versionAlsaVersionry   rz   -lAlsaDevicesaplayAplayDevicesarecordArecordDevicesPciMultimediaz/proc/asound/cardsutf-8encodingz]:NCardz.Amixer.infoamixerz-cr   z.Amixer.valuesz/proc/asound/cardz/codec*z.Codecs.r   r   )lsr   z	/dev/snd/)r   r   r   
expanduserr   r   pci_devicesPCI_MULTIMEDIAr   r%   lstripsplitappendintr4   globisfilebasenamer   rh   ri   join)r   cardsr6   linefieldscardr   	codecpathcodecnamer   s   &          r   attach_alsa_oldr   '  sd   
 &"''"4"4]"C^T""#;<>V &"45&"8-H7*+DEF=+WdO<F>-y$.?@F).9F?E	ww~~*++&99R4<![[]002FLLVAY0  : TF,'$hc$i%HITF.)$hc$i%@A%6tfG#DEIww~~i((((3TF(;u+=*>?F37y))((3JJy1D77<<	8Dtf %'./qT1B0CE   c2 2 F  :99s   9
KAKK"	c                   \         P                  P                  R4      '       d   \        . RO4      V R&   MA\         P                  P                  R4      '       d   \        . RO4      V R&   M\	        V 4       \        RR.\
        P
                  ! R4      ,           \
        P
                  ! R4      ,           \
        P
                  ! R4      ,           4      V R	&   \         P                  P                  R
4      '       d   \        RR.4      V R&   \         P                  P                  R4      '       d   \        R.4      V R&   \        V 4       \        V 4       R# )z0Attach ALSA subsystem information to the report./usr/sbin/alsa-infoAlsaInfo!/usr/share/alsa-base/alsa-info.shfuserr   z	/dev/dsp*z
/dev/snd/*z	/dev/seq*AudioDevicesInUsez/usr/bin/pacmdpacmdlist	PulseListz/usr/bin/pa-infoPaInfoN)r   --stdout--no-upload)r   r   r   )r   r   r   r   r   r   rm   rb   ra   s   &r   attach_alsar   X  s   	ww~~+,,+>
z 
;	<	<+L
z 	"0	$
))K
 	!
))L
!	" ))K
 	!#F 
ww~~&'',gv->?{	ww~~()))+=*>?xvr   c                   R\         P                  9  d   R# \         P                  R,          pVP                  \         P                  4       F  pV'       g   K  \         P                  P                  W 4      p\         P                  P                  V4      '       g   KS  \         P                  ! V\         P                  4      '       g   K   R# 	  R# )z/Is given command on the executable search path?PATHFT)	r   environr   pathsepr   r   r   accessX_OK)commandr   elementfilenames   &   r   r   r   v  s}    RZZ::fD::bjj)77<<177>>(##		(BGG(D(D * r   c           	     Z   \         P                  P                  4       pV'       g   RVR&    \        P                  ! V RV\        P
                  VVR7      pTP                  ^ 8X  d   TP                  P                  4       pMgR\        T 4      P                  4       ,           R,           \        TP                  4      P                  4       ,           R	,           TP                  ,           pT'       d   TP                  R
RR7      pT#   \         d   pR\        T4       2u Rp?# Rp?ii ; i)a'  Try to execute given command (list) and return its stdout.

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

If decode_utf8 is True (default), the output will be converted to a string,
otherwise left as bytes.
CLC_MESSAGESF)checkinputstdoutstderrenvr"   Ns   Error: command s    failed with exit code s   : r   r   r#   )r   r   copy
subprocessrunPIPEr3   r4   
returncoder   r2   encoder   )	r   r   r   keep_localedecode_utf8r   spr;   ress	   &&&&&    r   r   r     s    **//
C M
&^^??
 
}}iioo 'l!!#$() "-- '')* 	
 ii 	 jjj3J#  &U%%&s   *D D*D%D*%D*c                  L   \         e   R # \        P                  ! 4       ^ 8X  d   R # \        P                  P                  4       '       g   R # \        P                  P                  R4      '       g   R #  \        P                  ! ^ 4      w  r\        P                  ! RR\        T4      R.R\        P                  \        P                  R7      s \        P                  ! T4       \        P                   ! 4       ;_uu_ 4       p TP#                  T \        P$                  4       TP'                  4       pT FC  w  rET\        P(                  ,          '       g   K$  \        P                  ! T 4        R R R 4       R # 	  K|    \         d     R # i ; i  + '       g   i     R # ; i)Nz/usr/bin/pkttyagent
pkttyagentz--notify-fdz
--fallbackF)	close_fdsstdinr   )_AGENTr   geteuidsysr   isattyr   r   pipe2r3   r   Popenr4   r   r-   selectepollregisterEPOLLINpollEPOLLHUP)rwr   eventsr
   
event_types         r   _spawn_pkttyagentr     s    	zz|q9977>>/00xx{
 	}c!fl;oo	F HHQK	5NN1fnn-ZZ\F!'//HHQK 
 "(#   
s+   5F  AFF<F FFF#	c                 n    \         f   R# \         P                  4        \         P                  4        Rs R# )z=Kill pkttyagent (from PolicyKit) if it was started by Apport.N)r   	terminatewait r   r   kill_pkttyagentr     s&     ~

KKMFr   c                      \         P                  ! 4       ^ 8X  d   . # \         P                  P                  R4      '       d   \	        4        R.# . # )    z/usr/bin/pkexecpkexec)r   getuidr   r   r   r   r   r   _root_command_prefixr     s<    	yy{a		ww~~'((zIr   c                ~    \        V \        4      '       g   Q R4       h\        \        4       V ,           VVRVR7      pV# )a)  Try to execute given command (list) as root and return its stdout.

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

In case of failure, a textual error gets returned.

If decode_utf8 is True (default), the output will be converted to a string,
otherwise left as bytes.
zcommand must be a listT)r   r   )r   r   r   r   )r   r   r   r   outputs   &&&& r   r`   r`     sE     gt$$>&>>$(F Mr   c                    V ^8  d   QhR\         \        \        3,          R\        \        \        \        ,          3,          /# )ro   command_maprq   )r   r4   dictr   )rr   s   "r   rs   rs     s3     ; ;c";	#sU{
;r   c                   V '       g   / # / p\         P                  P                  \         P                  P                  \         P                  P                  RR4      4      R4      p\        P                  ! 4       p \         P                  P                  VR4      p\        VRRR7      ;_uu_ 4       pV P                  4        FR  w  rg\        VR4      '       g   Q R	4       hVP                  V R
\         P                  P                  W64       R24       KT  	  RRR4       \        P                  ! \        4       W$.,           RR7       V  Fz  p \        \         P                  P                  W64      R4      ;_uu_ 4       pVP                  4       P!                  4       p	RRR4       X	'       g   Kf   T	P%                  R4      Y&   K|  	  V\(        P*                  ! V4       #   + '       g   i     L; i  + '       g   i     L]; i  \"         d     K  i ; i  \&         d	    YT&    K  i ; i  \(        P*                  ! T4       i ; i)a  Execute multiple commands as root and return their respective outputs.

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

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

This is preferable to using root_command_output() multiple times, as that
will ask for the password every time.
APPORT_DATA_DIRz/usr/share/apportroot_info_wrapperz:script:r   r   r   r2   z(command must be a string (shell command)z	 | cat > 
NF)r   r!   r   )r   r   r   abspathr   r_   tempfilemkdtempr%   rA   hasattrwriter   r   r   r1   r2   r3   r   r5   shutilrmtree)
r  r  wrapper_pathworkdirscript_pathscriptkeynamer   r9   bufs
   &         r   execute_multiple_root_commandsr    s     	%'F77<<


'8:MNOL  G"ggll7J7+sW55$/$5$5$7 W  >=> 
 y	"'',,w2P1QQSTU %8 6 	 "l%@@	

 #G"'',,w8$??1&&(..*C @ s*&)jj&9FO # g? 65" @?   * *&)7O* 	gs   >6H1 4A'G#5H1 1H	G6!H	)H1 4HH1 #G3	.H1 6HH	H1 H		HH1 HH1 H.*H1 -H..H1 1I	c                V    V ^8  d   QhR\         R\        \        \        3,          RR/# )ro   r   r  rq   N)r   r   r4   )rr   s   "r   rs   rs   C  s-      (/S(9	r   c                R    \        V4      P                  4        F	  w  r#W0V&   K  	  R# )a  Execute multiple commands as root and put their outputs into report.

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

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

This is preferable to using root_command_output() multiple times, as that
will ask for the password every time.
N)r  rA   )r   r  kvs   &&  r   attach_root_command_outputsr  C  s&      /{;AACq	 Dr   c                    R pVP                  4       fJ   VP                   F7  pVP                  RRR7      pV P                  V4      '       g   K/  W#,          pK9  	  K[  VP                   F7  pVP                  RRR7      pV P                  V4      '       g   K/  W#,          pK9  	  VP                  P	                  4        VP                  4        VP                  ^ 8X  d   V# R # )r]   r   r   r#   )r   r   r   searchr-   r   r   )patternprocesslinesr   s   &&  r   __filter_re_processr"  W  s    E
,,.
 NND;;wy;9D~~d## #
 {{79{5>>$ME  NNLLNQr   journald_only_systemc                  V'       d   RRRV.pMu\         P                  P                  R4      '       d   . R
OpV'       d   VP                  R4       M2\         P                  ! R\         P
                  4      '       d   . ROpMR# \        P                  ! V\        P                  R7      ;_uu_ 4       p\        W4      uuR	R	R	4       #   + '       g   i     R	# ; i)a  Extract recent system messages which match a regex.

pattern should be a "re" object. By default, messages are read from
the systemd journal, or /var/log/syslog; but when giving "path", messages
are read from there instead.
The journald_only_system parameter controls the scope of messages that are
extracted when reading from the systemd journal. If set to True (the
default), only messages from the system services are extracted. If set to
False, all messages that the current user can see are extracted.
tail-n10000/run/systemd/systemz--system/var/log/syslogr]   r   N)
journalctlz--quiet-bz-a)r%  r&  r'  r)  )
r   r   r   r   r   R_OKr   r   r   r"  )r  r   r#  r   r   s   &&$  r   recent_syslogr.  k  s     4$/	-	.	.7NN:&	$bgg	.	.<			'*//	:	:g"74 
;	:	:	:s   3C		C	c                   \         P                  P                  R4      p\         P                  P                  V4      '       d,   \         P                  ! V\         P
                  4      '       g   R# V '       g   \        P                  ! R4      p Rp\        VR4      ;_uu_ 4       pV F7  pVP                  RRR7      pV P                  V4      '       g   K/  W$,          pK9  	  RRR4       V#   + '       g   i     T# ; i)	aT  Extract messages from ~/.xsession-errors.

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

Please note that you should avoid attaching the whole file to reports, as
it can, and often does, contain sensitive and private data.
z~/.xsession-errorsr]   z^(\(.*:\d+\): \w+-(WARNING|CRITICAL|ERROR))|(Error: .*No Symbols named)|([^ ]+\[\d+\]: ([A-Z]+):)|([^ ]-[A-Z]+ \*\*:)|(received an X Window System error)|(^The error was \')|(^  \(Details: serial \d+ error_code)r!   r   r   r#   N)r   r   r   r   r   r-  ru   compiler%   r   r  )r  r   r!  r9   r   s   &    r   xsession_errorsr1    s     7723D77>>$ryyrww'?'?**6
 E	dD		QD;;wy;9D~~d##  

 L 
	
 Ls   &-C.C..C?	c                 J   V '       g   \        RR.4      # Rp\        RR.4      pVP                  R4       F  pRpRpVP                  R4       Fk  p VP                  R^4      w  rxTP                  4       pTP                  4       pTR	8X  d"   \	        TRR ^4      p	T	R
,          ^,	          pK`  TR8X  g   Ki  TpKm  	  V'       g   K  V'       g   K  W@9   g   K  V'       d
   VR,          pV\        RRV.4      P                  4       ,          pK  	  V#   \         d     K  i ; i)z9Return a text dump of PCI devices attached to the system.r}   r~   r]   z-vvmmnnz

Nr	  :Classi   Slotz-vvnns)r   r   
ValueErrorr2   r   )
pci_classesresultr  	paragraph	pci_classslotr   r   rl   ns
   *         r   r   r     s   w011FWi01F\\&)		OOD)D!ZZQ/
 KKME))+Cg~bb)ZA-	 * 9)":& ngx%>?EEGGF) *, M  s   DD"!D"c                     \        RR.4      # )z9Return a text dump of USB devices attached to the system.r   r   )r   r   r   r   usb_devicesr@    s     7D/**r   c                    \         P                  ! V 4      pV'       d;   V Uu. uF,  p\        P                  P                  W14      '       g   K*  VNK.  	  ppV# TpV# u upi )zGRetrieve a list of files owned by package, optionally matching
globpat.)r?   	get_filesr   fnmatch)rH   globpatfilesr9   r:  s   &&   r   files_in_packagerF    sW     (E"GUdll&:&:1&F!!UG M M Hs   'AAc                    R# )z	Obsolete.Nr   rV   s   &&r   attach_gconfrH    s    r   c           
        V P                  RR4      p/ p\        P                  P                  4       pRVR&   \        P
                  ! RRV.V\        P                  R7      ;_uu_ 4       pVP                  f   Q hVP                   F=  p VP                  R^4      w  rxp	V	P                  4       p	YP                  T/ 4      T&   K?  	  RRR4       \        P
                  ! RRV.\        P                  R	7      ;_uu_ 4       pVP                  f   Q hVP                   Fr  p VP                  R^4      w  rxp	V	P                  4       p	YP                  T/ 4      P                  TR4      8w  g   KQ  TR
8X  d
   TR9   d   Rp	Y' RT RT	 R2,          pKt  	  RRR4       W R&   R#   \         d     EK*  i ; i  + '       g   i     L; i  \         d     K  i ; i  + '       g   i     LN; i)z0Attach user-modified gsettings keys of a schema.GsettingsChangesr]   z/nonexistingXDG_CONFIG_HOME	gsettingszlist-recursively)r   r   Nr*  s   org.gnome.shellzredacted by apportr	   r	  >      favorite-apps   command-history)r_   r   r   r   r   r   r   r   r   rstripr8  
setdefault)
r   schema	cur_valuedefaultsr   rL  r   schema_namer   rl   s
   &&        r   attach_gsettings_schemarU    s   

-r2IH
**//
C+C				(&1s:??
 
	+++$$D*.**T1*='% 9>R05 %	
 
			(&1*//
 
	+++$$D*.**T1*='% ["599#rBB"44 A : 1E}AcU!E7"==	 %	
& "+/  
 
(  
 
sf   * F5%F"0F5 G"%G#G/%G"F2	-F51F2	2F55G	G	GG	GG*	c                    \        VR4       F0  p\        P                  P                  V4      RR p\	        W4       K2  	  R# )z@Attach user-modified gsettings keys of all schemas in a package.z)/usr/share/glib-2.0/schemas/*.gschema.xmlNi)rF  r   r   r   rU  )r   rH   schema_filerQ  s   &&  r   attach_gsettings_packagerX    s<    '< !!+.t4/	r   c                4    V ^8  d   QhR\         R\        RR/# )ro   r   time_windowrq   N)r   r   )rr   s   "r   rs   rs     s!      - c 4 r   c                    \         P                  P                  R4      '       g   R# V P                  4       pV'       d   W!,
          pW!,           pRV 2RV 2.pMRR.p\	        RR.V,           4      V R	&   R# )
zAttach journal warnings and errors.

If the report contains a date, get the journal logs around that
date (plus/minus the time_window in seconds). Otherwise attach the
latest 1000 journal logs since the last boot.
r(  Nz	--since=@z	--until=@r,  z--lines=1000r+  z--priority=warningJournalErrors)r   r   r   get_timestampr   )r   rZ  crash_timestampbefore_crashafter_crashargss   &&    r   attach_journal_errorsrb    s{     77>>/00**,O&4%3L>*i},EFn%,	+,t3F?r   c                    \        RR.4      V R&   \        RR.4      V R&   \        \        4      V R&   \        V RRR	7       R F3  pV\        P
                  9   g   K  \        P
                  V,          W&   K5  	  R
# )z5Attach generic network-related information to report.iprouteIpRouteaddrIpAddr
PciNetworkz/etc/network/interfacesIfupdownConfigr   N)
http_proxy	ftp_proxyno_proxy)r   r   PCI_NETWORKr   r   r   )r   vars   & r   attach_networkrp  2  sj    &g7F9%tVn5F8&{3F<&";AQR6"****S/FK 7r   c                :    V ^8  d   QhR\         \        ,          /# )ro   rq   )r   r4   )rr   s   "r   rs   rs   >  s     M MtCy Mr   c                     \         P                   ! R4       U u. uF  q P                  R4      ^,          NK  	  up # u up i )z.Return list of wireless devices on the system.z/sys/class/net/*/wirelessrd   )r   r   )rk   s    r   _get_wireless_devicesrs  >  s2    %)YY/J%KL%KGGCLOO%KLLLs    <c                   \        \        P                  ! R4      4      V R&   \        RR.4      V R&   \        P
                  P                  R4      '       dp   \        4        FS  p\        P                  ! RR\        P                  ! R	R
\        RRVR.4      4      4      V RVP                  4        R2&   KU  	  \        . RO4      pMRpW R&   \        V RRR7       R# )z5Attach wireless (WiFi) network information to report.zH(NetworkManager|modem-manager|dhclient|kernel|wpa_supplicant)(\[\d+\])?:
WifiSyslogrfkillr   RfKillz/sbin/iwz([0-9a-f]{2}:){5}[0-9a-f]{2}z<hidden-mac>z
SSID: (.*)zSSID: <hidden>iwdevlinkIwDevLinkN/ACRDAz/var/log/wpa_supplicant.logWpaSupplicantLogr   N)rx  regr_   )r.  ru   r0  r   r   r   r   rs  r   
capitalizer   )r   wireless_device	iw_outputs   &  r   attach_wifir  C  s    (


	
F< &x&89F8	ww~~j!!46OAC. $"D%&#IJBFU?5578=>  7 ##78		6N&"?EWXr   c                *   \        V RR4       \        V RR4       \        R.4      V R&   \        RR.4      V R	&   \        P                  ! R
4      pV'       d0   \        . ROV,           4      p\        P                  ! RRV4      V R&   \        R!  V R&   R# )zcAttach printing information to the report.

Based on http://wiki.ubuntu.com/PrintingBugInfoScript.
z/etc/papersize	Papersizez/var/log/cups/error_logCupsErrorLoglocaleLocalelpstatr   Lpstatz/etc/cups/ppd/*.ppdz*/etc/cups/ppd/(.*).ppd:\*NickName: *"(.*)"z\g<1>: \g<2>PpdFilesPrintingPackagesN)fgrepz-Hz	*NickName) foo2zjszfoomatic-dbzfoomatic-db-enginefoomatic-db-gutenprintzfoomatic-db-hpijszfoomatic-filterszfoomatic-guihpijshplipm2300wmin12xxwc2050hpojpxljrpnm2ppasplixzhp-ppdz
hpijs-ppdszlinuxprinting.org-ppdszopenprinting-ppdszopenprinting-ppds-extraghostscriptcupszcups-driver-gutenprintr  ijsgutenprintzcupsys-driver-gutenprintzgimp-gutenprintzgutenprint-doczgutenprint-localeszsystem-config-printer-commonkdeprint)r   r   r   ru   r   package_versions)r   ppds	nicknamess   &  r   attach_printingr  _  s    
 &"2K@&";^L%xj1F8%x&67F899*+D"#?$#FG	VV9?I
z "2 !"Fr   c                n    V ^8  d   QhR\         R\        \        ,          \        ,          R,          RR/# )ro   r   profilesNrq   )r   r   r4   )rr   s   "r   rs   rs     s2     4 44%-c]S%84%?4	4r   c           
     h   \        V\        4      '       d   V.pRp\        P                  ! V\        P                  4      pRp\        P                  ! V\        P                  4      p/ pRV 9  d   RVR&   RV 9  d/   \
        P                  P                  R4      '       d
   RV R2VR&   \        V4      pRV9   dJ   VR,          p\        V\        4      '       g   Q hR	P                  \        P                  ! W84      4      V R&   RV9   d   VR,          V R&   \        V R
R4       \        V RR4       \        P                  ! VR	P                  V P                  RR4      V P                  RR4      34      4       F  p	V'       g   V P                  R.4        R#  V	^ ,          R8X  d   V	^R p
M'\        P!                  V	4      P#                  RRR7      p
 V F9  p\        P(                  ! RV R2V
4      '       g   K&  V P                  R.4        K  	  K  	  R#   \$        \&        3 d     K  i ; i)z0Attach MAC information and events to the report.z'(?:audit\(|apparmor|selinux|security).*z'apparmor="DENIED".+?profile=([^ ]+?)[ ]KernLogr^   AuditLogz/var/run/auditd.pidzegrep "z" /var/log/audit/audit.logr	  z/proc/version_signatureProcVersionSignaturer{   ProcCmdliner]   apparmor"r   r   r#   ^$Nr7  )r   r4   ru   r0  
IGNORECASEr   r   r   r  r   findallr   r   r_   add_tagsr   fromhexr   
IndexErrorr8  match)r   r  	mac_regexmac_reaa_regexaa_reprivileged_commandsprivileged_outputsr  r  profilesearch_profiles   &&          r   attach_mac_eventsr    s   
 (C  ::IZZ	2==1F8HJJx/E'.G$BGGNN3H$I$Ii[ :; 	J' 88KL$$#G,&#&&&& IIbjj&@Ay''/
;z&";=ST7tyy&**Y3VZZ
B5OPQ OOZL)	Qx3"+--.55gi5P 'Nxx!N+1-w77- ' J' 		s   H0&HH10H1c                    \        V!  V R&   R# )zbAttach version information for related packages.

In the future, this might also run their hooks.
RelatedPackageVersionsN)r  )r   packagess   &&r   attach_related_packagesr    s    
 (8'BF#$r   c            
        V '       g   R# . pV  F  pV'       g   K  \         P                  ! V4      pV'       g   VP                  VR34       \        V4       F2  p \         P                  ! V4      pVf   RpVP                  WE34       K4  	  K  	  \        R V 4       4      pRP                  V UUu. uF  w  rxVRV R2 RV 2NK  	  upp4      #   \
         d    Rp Lpi ; iu uppi )zlReturn a text listing of package names and versions.

Arguments may be package names or globs, e. g. "foo*"
r]   r}  c              3   F   "   T F  p\        V^ ,          4      x  K  	  R# 5i)r   N)len).0versions   & r   	<genexpr>#package_versions.<locals>.<genexpr>  s     @xGGAJxs   !r	  <sr	   )r?   package_name_globr   sortedget_versionr8  maxr   )	r  versionspackage_patternmatching_packagesrH   r  package_widthrk   r  s	   *        r   r  r    s    
 H#%77H OO_e45/0G #//8 OOW./ 1 $$ @x@@M99Jv1]O1,-Qqc2JKK     Ks   C4C&
C#"C#c                    \         P                  ! RV .R\         P                  \         P                  R7      pVP                  ^ 8w  d   R#  TP
                  P                  R4      P                  4        FN  pTP                  R^4      p\        T4      ^8  d   K'  T^ ,          R8X  g   K7  T^,          P                  4       u # 	  R#   \         d     R# i ; i)	z-Return the license for a given kernel module.z/sbin/modinfoF)r   r   r   invalidNr   r3  license)r   r   r   r   r3   r   r   
splitlinesr   r  r2   )modulemodinfor   r   s   &   r   _get_module_licenser    s    
..f%????	
 " # %%g.99;C#v;?!9	!!9??$$ <   s   A	C CCc                    \        V RR7      ;_uu_ 4       pV Uu. uF  q"P                  4       ^ ,          NK  	  ppRRR4       . pX FM  p\        T4      pT'       g   K  RT9   d   K!  RT9   d   K*  RT9   d   K3  RT9   d   K<  TP	                  T4       KO  	  T# u upi   + '       g   i     Ll; i  \         d    . u # i ; i)zCCheck loaded modules and return a list of those which are not free.r   r   NGPLBSDMPLMIT)r%   r   r3   r  r   )module_listr9   r   modsnonfreemr  s   &      r   nonfree_kernel_modulesr  
  s    +00A012JJLOOD2 1
 G"1eqjEQJ%1*
NN1 
 N 3 10 	s=   B4 B!BB!B4 B!!B1	,B4 1B4 4CCc           	      6   R p\         P                  ! V 4       F  p\         P                  P                  W4      pVR8X  g&   \         P                  P	                  V4      '       g   KP  \        VR4      ;_uu_ 4       pVP                  4       P                  4       pRRR4       VR8X  d   XP                  RR4      pVR8X  d    \        P                  ! X4      pVR,          pW R	XP                  R
RR7       R2,          pK  	  V#   + '       g   i     Lt; i)r]   rf   r!   Nmodes   
    edidz-base64z: r   r   r#   r	  )r   ri   r   r   r   r%   r1   r2   r   base64	b64encoder   )conr   r9   r   con_info_filevals   &     r   __drm_con_infor    s    DZZ_ww||C#=t 4 4$$$&,,.C  <++eT*C;""3'CNA#R

79
=>bAA  K s   =DDc                   Rp\         P                  P                  V4      '       g   R# \         P                  ! V4       F  p\         P                  P	                  W4      p\         P                  P                  \         P                  P	                  VR4      4      '       g   Kg  \        V4      V R\        V4       2&   K  	  R# )zOAdd information about DRM hardware.

Collect information from /sys/class/drm/.
z/sys/class/drmNenabledzDRM.)r   r   rh   ri   r   r   r  r   )r   drm_dirr9   r  s   &   r   attach_drm_infor  -  s    
 G77==!!ZZ ggll7&77>>"'',,sI677.<S.AFT+a.)*+	 !r   c                P   \         P                  P                  R4      pV'       g   \        RRR7      ;_uu_ 4       pV FZ  pVP	                  4       pRV9   g   K  VP                  R4      '       g   K5  RV9   g   K>  VP                  R^4      ^,          RR
 p M	   RRR4       R#  RRR4        V P                  4       pTf   R#  \         P                  ! R	T 24      P                  pYT8*  #   + '       g   i     LO; i  \         d     R# i ; i  \         d     R# i ; i)zCheck if the problem happened in the currently running XDG session.

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

Return None if this cannot be determined.
XDG_SESSION_IDz/proc/self/cgroupr   r   zname=systemd:z.scopez	/session-Nz/run/systemd/sessions/i)r   r   r_   r%   r2   endswithr   r]  AttributeErrorr,   rF   r3   )r   
session_idr9   r   report_timesession_start_times   &     r   in_session_of_problemr  <  s     01J%88Azz|#t+h//#t+!%K!;A!>s!CJ   98  9**, WW'=j\%JKTT ,,5 98    sA   C1C15C1>!C13D 
#D 1D	DDD%$D%c                   RpV'       g   \        V4      p\        P                  P                  V4      '       dm   \	        VRRR7      ;_uu_ 4       pVP                  4        Uu. uF  pVP                  R4      '       g   TMRNK   	  ppRP                  V4      W&   RRR4       R# R# u upi   + '       g   i     R# ; i)	z<Attach /etc/default/grub after filtering out password lines.z/etc/default/grubr   r   r   passwordz### PASSWORD LINE REMOVED ###r]   N)r   r   r   r   r%   	readlinesrB   r   )r   r   r   r9   r   filtereds   &&    r   attach_default_grubr  d  s    D$	ww~~d$g..! KKM *D  ??:66 89 *   ''(+FK /.  /..s$   B.$B) B)B.)B..B?	c                ^   Rp. p\         P                  P                  V4      '       dR   \        V RRV R2/4       RV 9   d9   \        P
                  ! V R,          4      pVR,          pVP                  R. 4      pW R&   V'       d   RP                  V4      V R	&   V P                  RR
4       R
# )z;Attach the results of the casper md5check of install media.unknownCasperMD5jsonzcat ''r:  checksum_missmatchCasperMD5CheckResultr	   CasperMD5CheckMismatchesN)	r   r   r   r  jsonloadsr_   r   pop)r   locationr:  
mismatchesr   s   &&   r   attach_casper_md5checkr
  w  s    FJ	ww~~h#F_hZq>Q,RSf$JJvo67E8_F#7<J%+!"-0XXj-A)*
JJ%r   )NTF)F)NN)N)
   )r   )X__doc__r  rD   r   r  r   ru   r   r  r,   r   r   r  rS   collections.abcr   r   apport.fileutilsapportapport.packaging_implr   r?   problem_reportr   r0  r   r   r   r   r<   r   rN   rW   rZ   rb   rm   rv   r   r   r   r   STDOUTr   r   r   r   r`   r  r  r"  r.  r1  PCI_MASS_STORAGErn  PCI_DISPLAYr   
PCI_MEMORY
PCI_BRIDGEPCI_SIMPLE_COMMUNICATIONSPCI_BASE_SYSTEM_PERIPHERALSPCI_INPUT_DEVICESPCI_DOCKING_STATIONSPCI_PROCESSORSPCI_SERIAL_BUSr   r@  rF  rH  rU  rX  rb  rp  rs  r  r  r  r  r  r  r  r  r  r  r  r
  	fileutilsshared_librarieslinks_with_shared_libraryr   r   r   <module>r      s   5      	 	     
   -  3 (

#56 	BA2"J?,!JJ@
6"/+d.3b<  ,^"J	 
 1 1t.;|((5d 52D  

  "   @+
&+R0,	*M
Y82n4nCL<."$B%-P,&&$ ##44 ",,FF r   