+
    oFj8                        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H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#H$t% Rt&]PN                  PQ                  R	4      t)R
 t*R t+ ! R R]PX                  PZ                  4      t-Rs. ! R R]P^                  P`                  4      t1 ! R R]Pd                  Pf                  4      t4RR lt5R#   ] d    Rt Li ; i)z,Crash database implementation for Launchpad.N)IOAny)FailedToDecompressContent)	HTTPErrorRestfulError	Launchpad)lookup_web_root)impl
productionz%~/.cache/apport/launchpad.credentialsc              #   r  "   V  Fu  p VP                   P                  4       pTP                  pTP                  R4      '       g1   TP                  R4      '       g   TP                  R4      '       g   Kq  Tx  Kw  	  R#   \        \        3 d$    \        P
                  P                  R 4        K  i ; i5i)z"Broken attachment on bug, ignoring.txt.gz.zstN)	dataopenr   r   apportloggingerrorfilenameendswith)attachments
attachmentfnames   &   ?/usr/lib/python3/dist-packages/apport/crashdb_impl/launchpad.pyfilter_filenamer   3   s     !
	$$&A zz==  DMM%$8$8DMM&<Q<QG " 45 	NN  !EF	s9   B7B "B7B7B76
B7 0B40B73B44B7c                 &    \        R  V  4       4      # )c              3      "   T F7  p\        VP                  P                  R 4      P                  4       4      x  K9  	  R# 5i)/N)int	self_linksplitpop).0is   & r   	<genexpr>id_set.<locals>.<genexpr>A   s0     @%Qs1;;$$S)--/00%s   ?A)set)taskss   &r   id_setr*   ?   s    @%@@@    c                     a  ] tR t^Dt o RtV 3R lR lt]V 3R lR l4       tR t]R 4       t	R6R	 lt
V 3R
 lR ltR tV 3R lR ltR tR7R ltR8R 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V 3R lR ltR  tV 3R! lR" ltV 3R# lR$ ltR% tV 3R& lR' ltV 3R( lR) ltR9V 3R* lR+ lltR, tR- t R. t!V 3R/ lR0 lt"V 3R1 lR2 lt#]$V 3R3 lR4 l4       t%R5t&V t'R# ):CrashDatabasez5Launchpad implementation of crash database interface.c                N   < V ^8  d   QhRS[ R,          RS[S[ S[3,          RR/# )   	auth_fileNoptionsreturn)strdictr   )format__classdict__s   "r   __annotate__CrashDatabase.__annotate__G   s8     FO FO#* FOtCH~ FO$ FOr+   c                   \         P                  ! R4      '       d   \         P                  ! R4      VR&   V'       gO   VP                  R4      pV'       d0   RP                  \        VP                  R^4      R,          34      pM\        p\        P                  P                  P                  WV4       VP                  R4      V n
        V P                  '       d   RV9  g   Q R4       hMRV9   g   Q R4       hR	V9   d   R
VR	,           R2V n        MR
\        P                  ! 4        R2V n        W n        Wn        V P                  '       g   Q hRV n        RV n        \         P                  ! RVP                  R4      4      V n        V P$                  '       gP   \&        P(                  ! RR7      V n        \*        P,                  ! \.        P0                  V P$                  RR7       R# R# )a_  Initialize Launchpad crash database.

You need to specify a launchpadlib-style credentials file to
access launchpad. If you supply None, it will use
DEFAULT_CREDENTIALS_PATH (~/.cache/apport/launchpad.credentials).

Recognized options are:
- distro: Name of the distribution in Launchpad
- project: Name of the project in Launchpad
  (Note that exactly one of "distro" or "project" must be given.)
- launchpad_instance: If set, this uses the given launchpad instance
  instead of production (optional). This can be overridden or set by
  $APPORT_LAUNCHPAD_INSTANCE environment. For example: "qastaging" or
  "staging".
- cache_dir: Path to a permanent cache directory; by default it uses a
  temporary one. (optional). This can be overridden or set by
  $APPORT_LAUNCHPAD_CACHE environment.
- escalation_subscription: This subscribes the given person or team to
  a bug once it gets the 10th duplicate.
- escalation_tag: This adds the given tag to a bug once it gets more
  than 10 duplicates.
- initial_subscriber: The Launchpad user which gets subscribed to newly
  filed bugs (default: "apport"). It should be a bot user which the
  crash-digger instance runs as, as this will get to see all bug
  details immediately.
- triaging_team: The Launchpad user/team which gets subscribed after
  updating a crash report bug by the retracer (default:
  "ubuntu-crashes-universe")
- architecture: If set, this sets and watches out for needs-*-retrace
  tags of this architecture. This is useful when being used with
  apport-retrace and crash-digger to process crash reports of foreign
  architectures. Defaults to system architecture.
APPORT_LAUNCHPAD_INSTANCElaunchpad_instance.z://distroprojectz/Must not set both "project" and "distro" optionz0Need to have either "project" or "distro" optionarchitecturezneed--retraceNAPPORT_LAUNCHPAD_CACHE	cache_dirzlaunchpadlib.cache.)prefixT)ignore_errors)osgetenvgetjoinDEFAULT_CREDENTIALS_PATHr"   r   crashdbr-   __init__r=   arch_tag	packagingget_system_architecturer1   auth_CrashDatabase__launchpad_CrashDatabase__lp_distro_CrashDatabase__lpcachetempfilemkdtempatexitregistershutilrmtree)selfr0   r1   lp_instances   &&& r   rL   CrashDatabase.__init__G   s   D 99011,.II6Q,RG()!++&:;KHH-{/@/@/J2/NO	 5	$$--dwGkk(+;;;(A@A( W$BAB$ W$#GN$;#<HEDM#I$E$E$G#HQDM	yyyy-1#;W[[=UV~~~%--5JKDNOOFMM4>>N r+   c                    < V ^8  d   QhRS[ /# r/   r2   r   )r5   r6   s   "r   r7   r8      s     (  ( 9 ( r+   c                   V P                   '       d   V P                   # \        fO   \        P                  P	                  R\        P
                  ^ ,           R24       \        P                  ! ^4       V P                  P                  R4      '       d   V P                  P                  R4      pM\        p\        P                  P                  V P                  4      pV'       d<   \        P                  P                  V4      '       g   \        P                  ! V4        \        P                   ! RVV P"                  R.V P                  RR7      V n         V P                   #   \$        \&        \(        3 dk   p\*        P,                  P/                  R	\1        TR
\3        T4      4      T P                  4       \        P                  ! ^c4        Rp?T P                   # Rp?ii ; i)zReturn Launchpad instance.NzERROR: The launchpadlib Python zK module is not installed. Please install the python3-launchpadlib package!
r;   zapport-collectWRITE_PRIVATEz1.0)launchpadlib_dirallow_access_levelscredentials_fileversionzZconnecting to Launchpad failed: %s
You can reset the credentials by removing the file "%s"content)rQ   r   sysstderrwriterd   exitr1   rH   DEFAULT_LAUNCHPAD_INSTANCErF   pathdirnamerP   isdirmakedirs
login_withrS   r   OSError
ValueErrorr   r   r   getattrr3   )rZ   r;   auth_dirr   s   &   r   	launchpadCrashDatabase.launchpad   sm    ###JJ1#++a.1A BF G
 HHQK<<011!%!1!12F!G!;77??499-BGGMM(33KK!	(33 "!%%4$5!% D"  gz2 	NN  Jy#e*5			 HHRLL	s   %6E' 'G'=AG""G'c              #  ,  "   V P                   '       g   R # V Fu  pVP                  P                  4       V P                   8X  gF   \        P                  ! RV P                    R2VP                  P                  4       4      '       g   Kq  Vx  Kw  	  R # 5i)Nz^.+\(z.*\)$)r=   bug_target_namelowerrematch)rZ   r)   ts   && r   _get_distro_tasksCrashDatabase._get_distro_tasks   sn     {{{A  &&(DKK7288U+Q->->-D-D-F< < 	 s   BB

Bc                   V P                   f   V P                  '       d9   V P                  P                  V P                  ,          V n         V P                   # RV P                  9   d@   V P                  P
                  V P                  R,          ,          V n         V P                   # \        R4      hV P                   # )z,Return Launchpad distribution (e.g. ubuntu).r>   z:distro or project needs to be specified in crashdb options)rR   r=   rt   distributionsr1   projectsSystemError)rZ   s   &r   	lp_distroCrashDatabase.lp_distro   s     #{{{#'>>#?#?#L   dll*#'>>#:#:4<<	;R#S  	 "P  r+   Nc                    V P                  V4      '       g   Q hV P                  V4      p\        WBV P                  4       R7      pVP	                  4        V'       g   Q hV# )ao  Upload given problem report return a handle for it.

This should happen noninteractively.

If the implementation supports it, and a function progress_callback is
passed, that is called repeatedly with two arguments: the number of
bytes already sent, and the total number of bytes to send. This can be
used to provide a proper upload progress indication on frontends.
)hostname)accepts_generate_upload_blobupload_blobget_hostnameclose)rZ   reportprogress_callbackuser_message_callback	blob_filetickets   &&&&  r   uploadCrashDatabase.upload   sT     ||F####..v6	YDDUDUDWXvr+   c                    < V ^8  d   QhRS[ /# r^   r3   )r5   r6   s   "r   r7   r8      s      c r+   c                    V P                   P                  R\        4      p\        P                  P                  \        V4      4      pVP                  # )z/Return the hostname for the Launchpad instance.r;   )r1   rH   rj   urllibparseurlparser	   netloc)rZ   r;   urls   &  r   r   CrashDatabase.get_hostname   sC    !\\-- "<
 ll##O4F$GHzzr+   c                2   / pVP                  RVP                  4       4      pV'       d   WCR&   V P                  4       pRV9   d   VR,          pMV P                  P                  R4      pV'       d,   RV RV RV R\        P
                  P                  V4       2# R	V9   d@   RV RV P                   R
VR	,           RV R\        P
                  P                  V4       2
# RV RV P                   RV R\        P
                  P                  V4       2# )a  Return an URL that should be opened after report has been uploaded
and upload() returned handle.

Should return None if no URL should be opened (anonymous filing without
user comments); in that case this function should do whichever
interactive steps it wants to perform.
Titlezfield.title
SnapSourcer>   https://bugs.r   z
/+filebug/?SourcePackagez	/+source/)rH   standard_titler   r1   r   r   	urlencoder=   )rZ   r   handleargstitler   r>   s   &&&    r   get_comment_urlCrashDatabase.get_comment_url   s$    

7F$9$9$;<"'$$&6!\*Gll&&y1Gz7):fXFLL**4013
 f$z4;;- 8?+,JvhFLL**4013 H:Qt{{m:fX&&t,-/	
r+   c                T   < V ^8  d   QhRS[ P                  P                  RS[RS[/# )r/   r   crash_idr2   )r   r   Reportr    r3   )r5   r6   s   "r   r7   r8     s1     E E!5!5 E E Er+   c                .    RV P                  4        RV 2# )zReturn URL for a given report ID.

The report is passed in case building the URL needs additional
information from it, such as the SourcePackage name.

Return None if URL is not available or cannot be determined.
r   z/bugs/)r   )rZ   r   r   s   &&&r   
get_id_urlCrashDatabase.get_id_url  s!     t00236(DDr+   c                   \         P                  P                  4       pV P                  P                  V,          p\
        P                  ! RVP                  \
        P                  4      pV'       gF   \
        P                  ! RVP                  \
        P                  \
        P                  ,          4      pV'       g   Q R4       hVP                  ^4      P                  R4      P                  RR4      P                  RR4      pR	V9   dm   R
V9   dM   VP                  R
^4      w  rgVP                  R	R4      R
,           VP                  R	^4      ^ ,          ,           pMVP                  R	^4      ^ ,          pVP                  \        P                   ! V4      4       RV9  d    VP"                  P%                  4       VR&   RV9  d~   RVP(                  9   d   RVR&   MfRVP(                  9   d   RVR&   MORVP(                  9   d   RVR&   M8RVP(                  9   d   RVR&   M!\+        R\-        VP(                  4       24      hVP/                  VP(                  4       RV9   d   VR,          VR&   VP0                  VR&   \3        VP4                  4       F  p\6        P8                  P;                  VP<                  4      w  r RW)&   T
R8X  d/   TPC                  4       Y)&    Y),          PE                  R4      Y)&   Kh  T
R8X  d>    \H        PJ                  ! TR7      ;_uu_ 4       pTPC                  4       Y)&   RRR4       K  T
R8X  d*   \P        PR                  ! YPC                  4       R7      Y)&   K  \U        R TP<                   24      h	  V#   \&         d    TP"                  TR&    ELi ; i  \>        \@        \*        3 d     EK3  i ; i  \F         d     EKF  i ; i  + '       g   i     EK\  ; i  \L         dA   pR\-        T4      9  d   h TPO                  ^ 4       TPC                  4       Y)&    Rp?EK  Rp?ii ; i)!z>Download the problem report from given ID and return a Report.z(ProblemType:.*)$z^--- \r?$[\r\n]*(.*)z8bug description must contain standard apport format dataUTF-8s        s   
   
s   

s   Uname:DateProblemTypez
apport-bugBugapport-crashCrashzapport-kernelcrashKernelCrashzapport-packagePackagez(cannot determine ProblemType from tags: r   OriginalTitle r   r   )fileobjNz
Not a gzipr   )r   compressed_valuezUnknown attachment type: )+r   r   r   rt   bugsry   searchdescriptionSMgroupencodereplacer"   loadioBytesIOdate_createdctimeAttributeErrortagsrq   r3   add_tagsr   r   r   rF   rk   splitextr   AssertionError	TypeErrorreaddecodeUnicodeDecodeErrorgzipGzipFilerp   seekproblem_reportCompressedValueNotImplementedError)rZ   r   r   bmr   part1part2r   keyextgzr   s   &&           r   downloadCrashDatabase.download  s    %%'NN) II*AMM244@		11=="$$+NALLLq GGAJVG_W[$'WWe$	 	 k! K'  +00A>MM'51 kk'1-a01  *//;A>BJJ{+,
0!"!5!5!7v &qvv%(-}%166)(/}%%/(5}%!QVV+(1}% >s166{mL  	f&,WoF?#''w)!--8Jww''
(;(;<HC  f}(oo/"(+"4"4W"=FK 	4z::b&(ggi ;: ,<</@ */
0C0C/DE ; 9@ q " 0!"v0: #Iz:  *  ;:: 4 $3u:5OOA&",//"3FKK4sl   (N 
N4(OO:*O%=O:N10N14OOO"!O"%O70O:7O::Q4Q  Qc                V   V P                   P                  V,          pV'       d+   \        VP                  4       4      \        V4      ,
          pMRp\        P
                  ! 4       ;_uu_ 4       p	VP                  WR7       V	P                  4        V	P                  ^ 4       \        P                  ! V	4      p
V
P                  4       p\        V4      pVP                  4       '       g   Q h\        V4      pVP                  4       '       d   Q hVP                  4       R8X  g   Q hV'       g   VP                  R,          pVP!                  R4       RV9   d-   WP#                  VR,          4      P%                  4       ,          pWn        VP'                  4        V P                   P                  V,          pVP)                  RR7      P+                  R	R
4      pV'       dV   V'       d(   VP,                   RV 2Vn        VP'                  4        M&V'       g   VP.                  pVP1                  WR7       V FP  pTP3                  T;'       g    RVP5                  4       RVP)                  RR7      VP5                  4       RR7       KR  	  RRR4       R#   + '       g   i     R# ; i)a  Update the given report ID with all data from report.

This creates a text comment with the "short" data (see
ProblemReport.write_mime()), and creates attachments for all the
bulk/binary data.

If change_description is True, and the crash db implementation supports
it, the short data will be put into the description instead (like in a
new bug).

comment will be added to the "short" data. If attachment_comment is
given, it will be added to the attachment uploads.

If key_filter is a list or set, then only those keys will be added.
N)	skip_keysz
text/plainNNNzapport-collectedTagsT)r   r   r   z
--- 
re   subjectr   F)commentr   content_typer   r   is_patch)rt   r   r(   keysrT   TemporaryFile
write_mimeflushr   emailmessage_from_binary_filewalknextis_multipartget_content_typer   append_filter_tag_namesr"   lp_saveget_payloadr   r   r   
newMessageaddAttachmentget_filename)rZ   r   r   r   change_descriptionattachment_comment
key_filterbugr   mimemsgmsg_iterpartxtexts   &&&&&&&        r   updateCrashDatabase.update  s   0 nn!!(+ FKKM*S_<II
 ##%%d8JJLIIaL006CxxzH >D$$&&&& >D((****((*l::: HHQK+,V#//v?EEGGAnn))(3 ##4#077KD%),(9$&HCOKKM""%))NN4NA !!!.44" $ 1 1 3!%)))6!..0" "  !W &%%%s,   /B>J.B3J"J*.J6J=JJ(	c                   \         P                  P                  P                  WW#4       V P                  P
                  V,          pRV9   d   VP                   F  pVP                  P                  P                  R4      '       g   K0  V P                  P                  VR,          R7      Vn        VP                  4        V P                  P
                  V,          p M	  VP                  4       '       Ed?   VP                   F'  pVP                  R9   g   K   VP!                  4        K)  	   V P%                  VP                  4      p\'        V4      pVP(                  R8X  d   RVn        VP                  4        TP-                  4       pT'       d   \.        P0                  ! RTP                  4      pT'       dx   TP3                  ^4      T8w  db   TP3                  ^4      T,           TP3                  ^4      ,           Tn         TP                  4        T P                  P
                  T,          pV P5                  WB4       R#   \"         d     EKT  i ; i  \*         d     Li ; i  \"         d     Lai ; i)	zUpdate the given report ID for retracing results.

This updates Stacktrace, ThreadStacktrace, StacktraceTop,
and StacktraceSource. You can also supply an additional comment.
r   #distributionr   	UndecidedMediumz,^(.*crashed with SIG.* in )([^( ]+)(\(\).*$)N   CoreDump.gzCoreDump.zst)r   rK   r-   update_tracesrt   r   	bug_taskstargetresource_type_linkr   r   getSourcePackager   has_useful_stacktracer   r   removeFromBugr   r|   r   
importanceStopIterationstacktrace_top_functionry   rz   r   _subscribe_triaging_team)	rZ   r   r   r   r   taskafnr   s	   &&&&     r   r  CrashDatabase.update_traces  s    	$$2246Snn!!(+f$;;11::?KK"&.."A"A#O4 #B #DK LLN..--h7C & ''))__77==) %--cmm<Dz??k1&.DOLLN
 //1BHHLciiXr) !
R!''!* <CI ..--h7C%%c2/ %  !  % s7   I3AI I0 III-,I-0I>=I>c                &   < V ^8  d   QhRS[ RS[/# r/   r   r2   r    r3   )r5   r6   s   "r   r7   r8     s     F F3 F3 Fr+   c                    V P                   P                  V,          p\        P                  ! RVP                  4      pV'       d   VP                  ^4      # \        R4      h)zFGet 'DistroRelease: <release>' from the given report ID and return
it.z"DistroRelease: ([-a-zA-Z0-9.+/ ]+)z)URL does not contain DistroRelease: field)rt   r   ry   r   r   r   rq   )rZ   r   r   r   s   &&  r   get_distro_release CrashDatabase.get_distro_release  sJ     nn!!(+II:COOL771:DEEr+   c                6   < V ^8  d   QhRS[ RS[S[,          /# r   )r    listr3   )r5   r6   s   "r   r7   r8     s      c d3i r+   c                v   \         P                  ! RV P                   R24      pV P                  P                  V,          p. pVP
                   Fe  pVP                  VP                  P                  4      pV'       g   K2  VP                  R9   d   KE  VP                  VP                  R4      4       Kg  	  V# )z5Return list of affected source packages for given ID.r   z2/(?:(?P<suite>[^/]+)/)?\+source/(?P<source>[^/]+)$source>   Invalid	Won't FixFix Released)ry   compiler=   rt   r   r  r   r  r!   statusr   r   )rZ   r   bug_target_rer   resultr  rz   s   &&     r   get_affected_packages#CrashDatabase.get_affected_packages  s    

TU
 nn!!(+MMD!(()>)>?E{{FFMM%++h/0 " r+   c                &   < V ^8  d   QhRS[ RS[/# r   r    bool)r5   r6   s   "r   r7   r8   -  s     8 8C 8D 8r+   c                    V P                   P                  V,          pVP                  P                  V P                   P                  P                  8H  # )z3Check whether the user is the reporter of given ID.)rt   r   ownerr   me)rZ   r   r   s   && r   is_reporterCrashDatabase.is_reporter-  s9    nn!!(+yy~~!2!2!7!777r+   c                &   < V ^8  d   QhRS[ RS[/# r   r3  )r5   r6   s   "r   r7   r8   2  s      3 4 r+   c                z   V P                   P                  V,          pVP                  '       d   R# VP                  P                  V P                   P
                  P                  8X  d   R# V P                   P
                  P                  pVP                  P                   F  pVR,          V8X  g   K   R# 	  R# )a  Check whether the user is eligible to update a report.

A user should add additional information to an existing ID if (s)he is
the reporter or subscribed, the bug is open, not a duplicate, etc. The
exact policy and checks should be done according to the particular
implementation.
FTperson_link)	rt   r   duplicate_ofr6  r   r7  r!   subscriptionsentries)rZ   r   r   r7  subs   &&   r   
can_updateCrashDatabase.can_update2  s     nn!!(+99>>T^^..333 ^^(($$,,C=!R' - r+   c                0   < V ^8  d   QhRS[ S[,          /# r^   r(   r    )r5   r6   s   "r   r7   r8   I  s     
 
C 
r+   c                    V P                   P                  V P                  RR7      p\        V4      #   \         dK   p\
        P                  P                  R\        T4      4       \        P                  ! ^c4        Rp?R# Rp?ii ; i)zuReturn an ID set of all crashes which have not been retraced yet and
which happened on the current host architecture.
2011-08-01r   created_since"connecting to Launchpad failed: %sN)r   searchTasksrM   r*   r   r   r   r   r3   rf   ri   rZ   r   r   s   &  r   get_unretracedCrashDatabase.get_unretracedI  sk    	>>--]], . D $< 	NN  !Es5zRHHRLL	s   14 B	?BB	c                0   < V ^8  d   QhRS[ S[,          /# r^   rD  )r5   r6   s   "r   r7   r8   U  s      3s8 r+   c                    V P                   P                  RRR7      p\        V4      #   \         dK   p\        P
                  P                  R\        T4      4       \        P                  ! ^c4        Rp?R# Rp?ii ; i)a  Return an ID set of all crashes which have not been checked for
being a duplicate.

This is mainly useful for crashes of scripting languages such as
Python, since they do not need to be retraced. It should not return
bugs that are covered by get_unretraced().
need-duplicate-checkrF  rG  rI  N)
r   rJ  r*   r   r   r   r   r3   rf   ri   rK  s   &  r   get_dup_uncheckedCrashDatabase.get_dup_uncheckedU  sg    	>>--+< . D $< 	NN  !Es5zRHHRLL	s   '* A??A::A?c                0   < V ^8  d   QhRS[ S[,          /# r^   rD  )r5   r6   s   "r   r7   r8   f  s     
 
SX 
r+   c                P    V P                   P                  RR7      p\        V4      # )a0  Return an ID set of all crashes which are not yet fixed.

The list must not contain bugs which were rejected or duplicate.

This function should make sure that the returned list is correct. If
there are any errors with connecting to the crash database, it should
raise an exception (preferably OSError).
r   )r   )r   rJ  r*   )rZ   r   s   & r   get_unfixedCrashDatabase.get_unfixedf  s%     ~~))~)>d|r+   c                    V P                   P                  P                  RVV P                   P                  R7      pV^ ,          P                  # )zReturn the version of given source package in the latest release of
given distribution.

If 'distro' is None, we will look for a launchpad project .
T)exact_matchsource_namedistro_series)r   main_archivegetPublishedSourcescurrent_seriessource_package_version)rZ   packagesourcess   && r   _get_source_version!CrashDatabase._get_source_versionr  sI     ..--AA..77 B 
 qz000r+   c                4   < V ^8  d   QhRS[ RS[R,          /# r/   r   r2   Nr!  )r5   r6   s   "r   r7   r8     s#     a a# a#* ar+   c                B  a  V P                   P                  V,          pTP                  '       d   R# \	        TP
                  4      pT P                  '       Edb   RT P                  P                  4        R2o\	        \        T3R lT4      4      pT'       gW   T FP  pTP                  R8X  g   K  TP                  P                  4       T P                  P                  4       8X  g   KO   R# 	  \        T4      ^8  d.   \        P                  P                  RT P                  T4       R# T'       dB   TP                  4       p T P!                  TP"                  P%                  4       ^ ,          4      # \	        \        T3R lT4      4      pT'       d$   \	        \        T3R	 lT4      4      pT'       g   R# R# \	        \        R
 T4      4      pT'       d   R# \	        \        R T4      4      '       d   R# R#   \         d     R# i ; i  \&         d     R# i ; i)a  Return the package version that fixes a given crash.

Return None if the crash is not yet fixed, or an empty string if the
crash is fixed, but it cannot be determined by which version. Return
'invalid' if the crash report got invalidated, such as closed a
duplicate or rejected.

This function should make sure that the returned result is correct. If
there are any errors with connecting to the crash database, it should
raise an exception (preferably OSError).
invalid()c                 l   < V P                   R 8H  ;'       d    SV P                  P                  4       9   # r+  r-  bug_target_display_namerx   r  distro_identifiers   &r   <lambda>1CrashDatabase.get_fixed_version.<locals>.<lambda>  s7    !> "R "R)T-I-I-O-O-QQ"Rr+   r+  r   zVThere is more than one task fixed in %s %s, using first one to determine fixed versionc                 l   < V P                   R9   ;'       d    SV P                  P                  4       9   # )r)  >   Expiredr)  r*  rk  rm  s   &r   ro  rp    s8    T[[4W%W &V &V-1M1M1S1S1UU&Vr+   c                 l   < V P                   R9  ;'       d    SV P                  P                  4       9   # )r)  )r)  r*  rr  rk  rm  s   &r   ro  rp    s?    #F*G *D *D 1#;;AAC!D*Dr+   c                      V P                   R 8H  # rj  r-  r  s   &r   ro  rp    s    DKK>$Ar+   c                      V P                   R 8H  # )r)  ru  rv  s   &r   ro  rp    s    y(@r+   N)rt   r   KeyErrorr=  r&  r  r=   rx   filterr-  rw   lenr   r   warningr#   ra  rl  r"   
IndexError)	rZ   r   r   r)   fixed_tasksr  invalid_tasksnon_invalid_tasksrn  s	   &&      @r   get_fixed_versionCrashDatabase.get_fixed_version  s   $	##H-A >>>Q[[!;;;"#DKK$5$5$7#8 :RK !D~5 00668DKK<M<M<OO  " " ;!#&&BKK	 "(%3344::<Q?  !%V! !(,D ")% -(  A5IK F@%HII [  		T " %$%s#   G= /H =HHHHc                4   < V ^8  d   QhRS[ RS[ R,          /# rd  r    )r5   r6   s   "r   r7   r8     s      S S4Z r+   c                |    V P                   P                  V,          P                  pV'       d   VP                  # R# )zSReturn master ID for a duplicate bug.

If the bug is not a duplicate, return None.
N)rt   r   r=  id)rZ   r   r   s   && r   r=  CrashDatabase.duplicate_of  s-    
 NN)6644Kr+   c                   V P                   P                  V,          pV'       Ed   W#8w  g   Q R\        V4       R24       hV P                   P                  V,          pVP                  '       dM   VP                  pVP                  pVP                  V8X  d$   \
        P                  P                  RVV4       R# VP                   F'  pVP                  R9   g   K   VP                  4        K)  	  V P                   P                  V,          pVP                  RV R2RR7       V P                   P                  V,          pVP                  '       d   R	Vn        VP                  '       g   WTn        VP                  p\        VP                   4      ^
8X  d   R
V P"                  9   dj   V P"                  R
,          V9  dR   V P"                  P%                  RR4      V9  d1   VV P"                  R
,          .,           Vn        VP'                  4        RV P"                  9   db   V P"                  P%                  RR4      V9  dA   V P                   P(                  V P"                  R,          ,          pVP+                  VR7       VP-                  4       '       d   RV9   g   RV9   d   V P/                  VVRV 2. ROR7       V P                   P                  V,          pVP                  R,          p	 V	P1                  R4        V	P1                  R4       Wn         VP'                  4        R.p
V P4                  P6                   F1  pVP8                  R9  d   K  V
P;                  VP<                  4       K3  	  \?        VP                  4      pVP                  pVPA                  V4      pV F  pW9   g   K  VP;                  V4       K  	  Wun        VP'                  4        MVP                  '       d   RVn        VPB                  '       d   VP'                  4        R# R#   \         d     EKo  i ; i  \2         d     ELBi ; i  \2         d     ELBi ; i  \         d     EL=i ; i)z\Mark a crash id as duplicate of given master ID.

If master is None, id gets un-duplicated.
zcannot mark bug z as a duplicate of itselfzNBug %i was manually marked as a dupe of newer bug %i, not closing as duplicateNzThank you for taking the time to report this crash and helping to make this software better.  This particular crash has already been reported and is a duplicate of bug #aE  , so is being marked as such.  Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug.  Additionally, any further discussion regarding the bug should occur in the other report.  Please continue to report any other bugs you may find.zThis bug is a duplicater   Fescalation_tagescalated_tagz	 invalid escalation_subscriptionpersonzapport-request-retraceapport-failed-retracez'Updated stack trace from duplicate bug )r   r   zbugpattern-needed>   r  r  ProcMaps.txtRegisters.txtProcStatus.txtStacktrace.txtDisassembly.txtThreadStacktrace.txt)
StacktraceThreadStacktracer   DependenciesProcMapsProcCmdline)zActive DevelopmentzCurrent Stable Release	SupportedzPre-release Freeze)"rt   r   r3   r=  r  r   r   r{  r   r   r  r   r   privater   rz  
duplicatesr1   rH   r   people	subscriber  r  removerq   r   seriesr-  r   r   r(   
difference_dirty_attributes)rZ   r   r   	master_idr   masterr  master_tagspr  tags_to_copyr  	dupe_tagsmissing_tagstags   &&&&           r   close_duplicateCrashDatabase.close_duplicate  s    nn!!(+9%K!#h-0IJK% ^^((3F""",,"II	99(NN**4 !	 __77 	 	) %" ..%%h/CNN K  	 2   ..%%h/C{{{# ####)  !++K6$$%+$4%56kI((+F&' #.%561 #FK NN$ .=((+F&' --dll;T.UVA$$A$. ++--(K7*k9=hZH 	   ,,Y7KKNHH45HH56  NN$
 00L..//== )  ##FKK0 0 CHHI ++K$//<L#&&&s+ $ &KNN#C    KKM !g % V "  " 
 ! sH   P(6P; Q  Q (P87P8;Q
	Q
QQQ.-Q.c                *   < V ^8  d   QhRS[ RS[ RR/# )r/   r   r  r2   Nr  )r5   r6   s   "r   r7   r8     s"       S T r+   c                    V P                   P                  V,          pVP                  RV R2RR7       V P                   P                  V,          pVP                  R.,           Vn        VP	                  4        R# )ziMark a crash id as reintroducing an earlier crash which is
already marked as fixed (having ID 'master').
z<This crash has the same stack trace characteristics as bug #z. However, the latter was already fixed in an earlier package version than the one in this report. This might be a regression or because the problem is in a dependent package.zPossible regression detectedr   zregression-retracerN)rt   r   r   r   r   )rZ   r   r  r   s   &&& r   mark_regressionCrashDatabase.mark_regression  su     nn!!(+H 
 3 	 	
 nn!!(+88455r+   c                $   < V ^8  d   QhRS[ RR/# rd  r  )r5   r6   s   "r   r7   r8     s     
 
c 
d 
r+   c                (   V P                   P                  V,          pV P                  VP                  9   dH   VP                  R,          pVP	                  V P                  4       W2n         VP                  4        R# R#   \         d     R# i ; i)zMark crash id as retraced.r   N)rt   r   rM   r   r  r   r   )rZ   r   r   r  s   &&  r   mark_retracedCrashDatabase.mark_retraced  so    nn!!(+==CHH$AHHT]]#H %  s   .B BBc                8   < V ^8  d   QhRS[ RS[R,          RR/# )r/   r   invalid_msgNr2   r!  )r5   r6   s   "r   r7   r8     s)      *-*	r+   c                H   V P                   P                  V,          pV'       d    V P                  VP                  4      p\	        V4      pRVn        VP                  4        VP                  VRR7       VP                   F'  pVP                  R9   g   K   VP                  4        K)  	  R# RVP                  9  d,   VP                  R.,           Vn        VP                  4        R# R#   \
         d    TP                  ^ ,          p Li ; i  \         d     K  i ; i)z%Mark crash id as 'failed to retrace'.r)  z Crash report cannot be processedr   r  Nr  )rt   r   r|   r  r   r  r-  r   r   r   r   r  r   r   )rZ   r   r  r   r  r  s   &&&   r   mark_retrace_failed!CrashDatabase.mark_retrace_failed  s     nn!!(+(--cmm<Dz $DKLLNNN#-O   __77==) % %CHH4xx#:";;CHKKM 5 ! (}}Q'( % s#   &C. D.DDD! D!c                   V P                   P                  V,          pRV9   d   VP                   F  pVP                  P                  P                  R4      '       g   K0  V P                  P                  VR,          R7      Vn         VP                  4        V P                   P                  V,          p M	  RVP                  9   d   VP                  R,          pVP                  R4       WSn
        VP                  4        RV9   d[   VP                   FJ  pRVP                  P                  9   g   K   VP                  R8X  g   K3  RVn        VP                  4        KL  	  V P                  W24       R	#   \         d     Li ; i)
z/Mark crash id as checked for being a duplicate.r   r	  r
  rP  r   	Tracebackr  r  N)rt   r   r  r  r  r   r   r  r   r   r   r  r  r  )rZ   r   r   r   r  r  s   &&&   r   _mark_dup_checkedCrashDatabase._mark_dup_checked  s4   nn!!(+ f$;;11::?KK"&.."A"A#O4 #B #DK"nn11(;
  & "SXX-AHH+,HKKMf$MMD&$++*H*HH??k9.6DO LLN	 *
 	%%c2# %  s   
-E::FFc                4   \         P                  P                  P                  W4      pV'       g   V# W!R&    \        P
                  P                  V R24      ;_uu_ 4       pVP                  4       pVP                  R4      '       g    RRR4       R# V FM  pVP                  R4      '       d   RV9   g   RV9   d    RRR4       R#  MVP                  4       '       d   KM   M	  RRR4       V#   + '       g   i     T# ; i  \         d    Tu # i ; i)	a>  Check if the crash db already knows about the crash signature.

Check if the report has a DuplicateSignature, crash_signature(), or
StacktraceAddressSignature, and ask the database whether the problem is
already known. If so, return an URL where the user can check the status
or subscribe (if available), or just return True if the report is known
but there is no public URL. In that case the report will not be
uploaded (i. e. upload() will not be called).

Return None if the report does not have any signature or the crash
database does not support checking for duplicates on the client side.

The default implementation uses a text file format generated by
duplicate_db_publish() at an URL specified by the "dupdb_url" option.
Subclasses are free to override this with a custom implementation, such
as a real database lookup.
DuplicateOfz/+texts   bug:NTs   tags:s   apport-failed-retraces   apport-request-retrace)r   rK   r-   knownr   requesturlopenreadline
startswithstriprp   )rZ   r   r   r   lines   &&   r   r  CrashDatabase.known  s    * nn**00>J !$}	''3%v771zz|w//   87 Dx004<8D@#' 87   ::<<  82 
3 872 
  	 J	sM   *D #)C3D +C3D C3%C3)D 3D	>D D DDc           	        RV9   d&   VR,          P                  4       ^ ,          R8w  d   R# V P                  P                  RR4      pV P                  P                   RV 2pVP                  \        V P                  P                  4      R4      P                  R4      VP                   Uu. uF&  p\        V4      P                  R^R	7      R,          NK(  	  up9  d   VP                  VR
7       R# R# u upi )z-Subscribe the right triaging team to the bug.DistroReleaseUbuntuNtriaging_teamzubuntu-crashes-universe~r   r   )maxsplitr  rE   )
r"   r1   rH   rt   	_root_urir   r3   r  r>  r  )rZ   r   r   teamr  r@  s   &&&   r   r  &CrashDatabase._subscribe_triaging_team"  s    
 f$)@)F)F)H)Kx)W ||1JKNN,,-Qtf5>>#dnn667<BB3G;>;L;LP
;LCCHNN3N+B//;LP
 
 MMM(
 P
s   /,C8c                d   < V ^8  d   QhRS[ P                  P                  RS[S[S[3,          /# r/   r   r2   )r   r   r   r4   r3   )r5   r6   s   "r   r7   r8   3  s.     % %v}}/C/C %SRUX %r+   c                   RRVR,          P                  4        2/pVP                  R4      pV'       d   VR8X  d   VP                  R4      pV'       d   VR;;,          RV 2,          uu&   RV9   d/   VR;;,          RV P                  VR,          4       2,          uu&   RV9   d   R	V9   d   R
VR&   V'       d]   RV9   g   RV9   dO   R
VR&   VP                  RV P                  P                  RR4      4      VR&   VR;;,          RV R2,          uu&   M&RV9   d    R
VR&   RVR&   VR;;,          R,          uu&   RV9   d$   RVR,          9  d   VR;;,          R,          uu&   RV9   d   VR,          VR&   V# )z;Generate the headers for the multipart/MIME temporary file.r   zapport-r   PackageArchitectureallArchitecture r  LaunchpadPrivateyesPrivateVmCoreCoreDumpLaunchpadSubscribeinitial_subscriberr   Subscribersz need-r@   r  z need-duplicate-checkDuplicateSignaturerP  CheckboxSubmissionzHWDB-Submission)rx   rH   r   r1   )rZ   r   hdrarchs   &&  r   _generate_upload_headers&CrashDatabase._generate_upload_headers3  su    !6!<!<!> ?@Azz/0tu}::n-DKQtf:%KVKQt55fVnEFGGK f$!V+!&IV+zV/C!&I%+ZZ(LL$$%98D&M" FvX66&!&I%-M"F666).DCPVK.WK22K  6)%+,@%AC!"
r+   c                ^   < V ^8  d   QhRS[ P                  P                  RS[S[,          /# r  )r   r   r   r   bytes)r5   r6   s   "r   r7   r8   Z  s)      FMM,@,@ RY r+   c                    V P                  V4      p. ROp\        P                  ! 4       pVP                  VV. ROVR7       VP	                  4        VP                  ^ 4       V# )zGenerate a multipart/MIME temporary file for uploading.

You have to close the returned file object after you are done with it.
)extra_headersr   priority_fields)	r   r  r   
RegressionReproducibleTestedUpstreamProcVersionSignatureUnameNonfreeKernelModules)r   r  r  )r  rT   r   r   r   r   )rZ   r   r  orderr   s   &&   r   r   #CrashDatabase._generate_upload_blobZ  se    
 ++F3

 %%'H!	 	 	
 	

		!r+   c                &   < V ^8  d   QhRS[ RS[ /# )r/   r   r2   r   )r5   r6   s   "r   r7   r8   {  s        r+   c                    RpV P                  4       P                  RRR7       F>  pVR9   g   \        V4      ^ 8  d   VR9   d   V\        V4      ,          pK5  VR,          pK@  	  V# )zBReplace characters from tags which are not palatable to
Launchpad.r   ASCIIignore)errorss%   abcdefghijklmnopqrstuvwxyz0123456789 s   +-.r<   )rx   r   rz  chr)r   reschs   &  r   r   CrashDatabase._filter_tag_namesz  sa     **,%%gh%?B==C1vs2ws
 @ 
r+   )__launchpad__lp_distro	__lpcacherM   rP   r=   r1   )NN)FNN)r   N)(__name__
__module____qualname____firstlineno____doc__rL   propertyrt   r|   r   r   r   r   r   r   r  r  r#  r0  r8  rA  rL  rQ  rU  ra  r  r=  r  r  r  r  r  r  r  r  r   staticmethodr   __static_attributes____classdictcell__r6   s   @r   r-   r-   D   s>    ?FO FOP (  ( T    $ $
LE EePVt13fF F $8 8
 .
 
 "
 
1a aF ^@ $
 
 :3B7r)"% %N @  r+   r-   c                   *   a  ] tR tRt o RtR tRtV tR# )HTTPSProgressConnectioni  zSImplement a HTTPSConnection with an optional callback function for
upload progress.c                   \         '       g,   \        P                  P                  P	                  W4       R # ^ p\        V4      pRpW#8  d   \        W#4       \        P                  ! 4       p\        P                  P                  P	                  WW"V,            4       W$,          p\        P                  ! 4       V,
          pVR8  d   V^,          pK  V^8  g   K  VR8  g   K  V^,          pK  R # )Ni   g      ?)_https_upload_callbackhttpclientHTTPSConnectionsendrz  time)rZ   r   senttotal	chunksizet1durations   &&     r   r  HTTPSProgressConnection.send  s    %%KK'',,T8D		l"4/BKK'',,Ty@P3RSDyy{R'H #~a	A)d"2a	 r+    N)r  r   r  r  r  r  r  r  r  s   @r   r
  r
    s        r+   r
  c                   *   a  ] tR tRt o RtR tRtV tR# )HTTPSProgressHandleri  zPImplement a HTTPSHandler with an optional callback function for
upload progress.c                .    V P                  \        V4      # r  )do_openr
  )rZ   reqs   &&r   
https_openHTTPSProgressHandler.https_open  s    ||3S99r+   r  N)r  r   r  r  r  r  r  r  r  s   @r   r  r    s     : :r+   r  c                   RpRV R2pVs \        P                  P                  P	                  4       p\        P                  P
                  P                  R4      pVP                  RR4       VP                  V4       \        P                  P                  P                  RR4      pVP                  RR	4       VP                  V P                  4       P                  R
4      4       VP                  V4       \        P                  ! 4       p\        P                   P#                  VRR7      p	V	P%                  VRR7       \&        P(                  P+                  WHP-                  4       4      p
V
P                  RRVP/                  4        24       \&        P(                  P1                  \2        4      pVP5                  V
4      pVP7                  4       P9                  R4      pV'       g   Q hV# )a  Upload blob (file-like object) to Launchpad.

progress_callback can be set to a function(sent, total) which is regularly
called with the number of bytes already sent and total number of bytes to
send. It is called every 0.5 to 2 seconds (dynamically adapted to upload
bandwidth).

Return None on error, or the ticket number on success.

By default this uses the production Launchpad hostname. Set
hostname to 'launchpad.dev', 'qastaging.launchpad.net', or
'staging.launchpad.net' to use another instance for testing.
Nzhttps://z/+storeblob1zContent-Dispositionzform-data; name="FORM_SUBMIT"applicationzoctet-streamz*form-data; name="field.blob"; filename="x"asciiF)mangle_from_
)linesepzContent-Typezmultipart/form-data; boundary=zX-Launchpad-Blob-Token)r  r   r   	multipartMIMEMultipartr  MIMEText
add_headerattachbaseMIMEBaseset_payloadr   r   r   r   	generatorBytesGeneratorflattenr   r  Requestgetvalueget_boundarybuild_openerr  r   inforH   )blobr   r   r   r   r   submit	form_blob	data_flatgenr  openerr/  s   &&&          r   r   r     s    FXJk
*C / ::--/DZZ__%%c*F
+-LMKK

((GIK $))+,,W56KK	

I
//
(
(
(
GCKKdK# ..
 
 &8&8&:
;CNN89J9J9L8MN ^^(()=>F[[F[[]78FM6Mr+   )Nzlaunchpad.net)6r  rV   r   r   http.clientr  r   os.pathrF   ry   rX   rf   rT   r  urllib.parser   urllib.requesttypingr   r   httplib2r   launchpadlib.errorsr   r   launchpadlib.launchpadr   launchpadlib.urisr	   ImportErrorapport.crashdbr   apport.loggingapport.reportr   apport.packaging_implr
   rN   rj   rk   
expanduserrJ   r   r*   rK   r-   r  r  r  r
  r  HTTPSHandlerr  r   r  r+   r   <module>rM     s    2      	  	  
     2;01
     3) 77--.UV 	A
CFNN00 CV"   dkk99  8:6>>66 :2k$  Is    C9 9	DD