StacktraceSource contains errors instead of source code

Bug #1462491 reported by Brian Murray
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Apport
Fix Released
Undecided
Unassigned
apport (Ubuntu)
Fix Released
Medium
Martin Pitt

Bug Description

The StacktraceSource information being added by apport-retrace contains Error messages see the attachment in bug 1459716.
Here's part of it:

#0 0xb7751be0 in __kernel_vsyscall ()
#1 0xb6813057 in __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:55
  [Error: ../sysdeps/unix/sysv/linux/raise.c was not found in source tree]
#2 0xb6814699 in __GI_abort () at abort.c:89
  [Error: abort.c was not found in source tree]
#3 0xb685119e in __libc_message (do_abort=1, fmt=0xb694b444 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
  [Error: ../sysdeps/posix/libc_fatal.c was not found in source tree]

I think part of the issue is that apport-retrace only ever searches the srcdir returned by get_source_tree (which is a temporary directory) and doesn't search the sandbox for the filename. Another problem is that find_file_dir is being passed a filename like "../sysdeps/unix/sysv/linux/raise.c" which won't be found even if that were in the srcdir.

Revision history for this message
Brian Murray (brian-murray) wrote :

I fixed the filename being searched for via the following.

@@ -178,7 +185,8 @@
         for frame in report['Stacktrace'].splitlines():
             m = src_frame.match(frame)
             if m:
- result += frame + '\n' + get_code(srcdir, m.group(1), int(m.group(2)))
+ filename = m.group(1).split("/")[-1]
+ result += frame + '\n' + get_code(srcdir, cache, filename, int(m.group(2)))

Then a StacktraceSource looked like this:

 #3 0x00007ffff776889d in XtAppMainLoop (app=0x6090e0) at ../../src/Event.c:1554
   [Error: Event.c was not found in source tree]
 #4 0x000000000040198f in main (argc=1, argv=<optimized out>) at ../xeyes/xeyes.c:137
   132:
   133: (void) XtCreateManagedWidget ("eyes", eyesWidgetClass, toplevel, NULL, 0);
   134: XtRealizeWidget (toplevel);
   135: (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
   136: &wm_delete_window, 1);
   137: XtAppMainLoop(app_context);
   138:
   139: return 0;
   140: }

Revision history for this message
Brian Murray (brian-murray) wrote :

Examples of bugs with good StacktraceSources include:

bug 1297212
bug 1061026
bug 1225365
bug 1415515
bug 1304003
bug 1351558

So it seems to work some of the time.

Revision history for this message
Brian Murray (brian-murray) wrote :

Looking in my stash of bug report attachments for foundations-bugs it seems that about only 10% don't contain an error in the StacktraceSource.

Changed in apport (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Brian Murray (brian-murray) wrote :

Also when working with the xeyes crash I found the missing NextEvent.c file in the source for libx11-1.6.3.

Changed in apport (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in trunk: http://bazaar.launchpad.net/~apport-hackers/apport/trunk/revision/2992

Thanks Brian, nicely spotted! I tested this with the usual bash -c 'kill -SEGV $$' and StacktraceSource went from "useless" to "OMG real code!".

Changed in apport:
status: New → Fix Released
Changed in apport (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.18-0ubuntu9

---------------
apport (2.18-0ubuntu9) wily; urgency=medium

  * Revert changes to data/package_hook to include the package version. This
    just hides the problem that somewhere during whoopsie add_package_info()
    is not called. (See LP #1485787)
  * packaging-apt-dpkg.py, is_distro_package(): If there is no origin and
    /etc/system-image/channel.ini exists, assume the package is from a
    read-only system image and accept it as distro package. With this we don't
    need /var/lib/apt/lists/ indexes any more just to confirm the origin.
    (LP: #1489410)
  * Merge fixes from trunk:
    - whoopsie-upload-all: Intercept OSError too (e. g. "No space left on
      device"). (LP: #1476258)
    - apport-retrace: Only consider the file name of a source file, not its
      path; the latter often contains parts like "../" or directories which are
      specific to a build machine. This fixes most broken StacktraceSource
      results. (LP: #1462491)

 -- Martin Pitt <email address hidden> Mon, 31 Aug 2015 11:35:54 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.