diff -Nru /tmp/9hNJJQTTAH/apport-0.68/bin/apport /tmp/cwuWlFGveD/apport-0.69/bin/apport --- /tmp/9hNJJQTTAH/apport-0.68/bin/apport 2007-03-14 16:35:24.000000000 +0100 +++ /tmp/cwuWlFGveD/apport-0.69/bin/apport 2007-03-19 17:28:31.000000000 +0100 @@ -106,8 +106,7 @@ signal.signal(signal.SIGBUS, _log_signal_handler) def write_user_coredump(pid, cwd, limit): - '''Called for crashes of non-packaged programs; write the core into the - current directory if ulimit requests it.''' + '''Write the core into the current directory if ulimit requests it.''' # three cases: # limit == 0: do not write anything @@ -260,6 +259,11 @@ # ignore SIGABRT (we currently have no way of extracting abort() messages # or mono's stderr for stack traces). if signum == str(signal.SIGABRT): + # check if the user wants a core dump if we use the new-style piping + # method + if os.environ.has_key('CORE_PID'): + drop_privileges(pid) + write_user_coredump(pid, cwd, os.environ.get('CORE_REAL_RLIM')) sys.exit(0) # ignore blacklisted binaries @@ -293,6 +297,11 @@ # Totally drop privs before writing out the reportfile. drop_privileges(pid) + # check if the user wants a core dump if we use the new-style piping + # method + if os.environ.has_key('CORE_PID'): + write_user_coredump(pid, cwd, os.environ.get('CORE_REAL_RLIM')) + info.add_user_info() info.add_os_info() diff -Nru /tmp/9hNJJQTTAH/apport-0.68/bin/apport-chroot /tmp/cwuWlFGveD/apport-0.69/bin/apport-chroot --- /tmp/9hNJJQTTAH/apport-0.68/bin/apport-chroot 2007-03-15 00:06:51.000000000 +0100 +++ /tmp/cwuWlFGveD/apport-0.69/bin/apport-chroot 2007-03-15 12:17:25.000000000 +0100 @@ -26,6 +26,7 @@ optparser = optparse.OptionParser('''%prog [options] create %prog [options] upgrade ||all +%prog [options] installdeb | [...] %prog [options] login | %prog [options] retrace |''') @@ -196,7 +197,7 @@ if len(args) != 1: print >> sys.stderr, 'upgrade needs exactly one argument (use --help for a short online help)' sys.exit(1) - if not opts.chroot_map and not os.path.isdir(args[0]): + if not opts.chroot_map and not os.path.exists(args[0]): print >> sys.stderr, 'you must specify a chroot map with -m (use --help for a short online help)' sys.exit(1) @@ -213,13 +214,43 @@ else: print >> sys.stderr, 'invalid chroot' +def command_installdeb(opts, args): + '''Install a bunch of .debs into the chroot.''' + + if len(args) < 2: + print >> sys.stderr, 'installdeb needs more arguments (use --help for a short online help)' + sys.exit(1) + if not opts.chroot_map and not os.path.exists(args[0]): + print >> sys.stderr, 'you must specify a chroot map with -m (use --help for a short online help)' + sys.exit(1) + + if os.path.exists(args[0]): + chroot = Chroot(args[0]) + elif opts.chroot_map.has_key(args[0]): + c = opts.chroot_map[args[0]] + chroot = Chroot(c) + else: + print >> sys.stderr, 'invalid chroot' + + # symlink the debs into the chroot + chroot_deb_dir = os.path.join(chroot.root, 'installdebs') + os.makedirs(chroot_deb_dir) + for deb in args[1:]: + os.symlink(deb, os.path.join(chroot_deb_dir, os.path.basename(deb))) + + result = chroot.run(['dpkg', '-i'] + ['/installdebs/' + os.path.basename(d) for d in args[1:]]) + shutil.rmtree(chroot_deb_dir) + + if chroot.root_tarball and result == 0: + chroot.tar() + def command_login(opts, args): '''Start a shell in a chroot.''' if len(args) != 1: print >> sys.stderr, 'login needs exactly one argument (use --help for a short online help)' sys.exit(1) - if not opts.chroot_map and not os.path.isdir(args[0]): + if not opts.chroot_map and not os.path.exists(args[0]): print >> sys.stderr, 'you must specify a chroot map with -m (use --help for a short online help)' sys.exit(1) diff -Nru /tmp/9hNJJQTTAH/apport-0.68/debian/changelog /tmp/cwuWlFGveD/apport-0.69/debian/changelog --- /tmp/9hNJJQTTAH/apport-0.68/debian/changelog 2007-03-15 01:10:12.000000000 +0100 +++ /tmp/cwuWlFGveD/apport-0.69/debian/changelog 2007-03-19 17:40:12.000000000 +0100 @@ -1,3 +1,16 @@ +apport (0.69) feisty; urgency=low + + * apport-chroot: Add command 'installdeb' to conveniently install a bunch of + .debs into a chroot. + * apport-chroot: Fix 'login' and 'upgrade' commands to not require + specifying a chroot map when giving a chroot tarball path as argument. + * test-apport: Check that core dumps are written for packaged programs as + well, if ulimits want them. (Test for #92029) + * bin/apport: Call write_user_coredump() for packaged program crashes and + SIGABRT as well. (LP: #92029) + + -- Martin Pitt Mon, 19 Mar 2007 17:37:23 +0100 + apport (0.68) feisty; urgency=low [ Michael Hofmann ] diff -Nru /tmp/9hNJJQTTAH/apport-0.68/test-apport /tmp/cwuWlFGveD/apport-0.69/test-apport --- /tmp/9hNJJQTTAH/apport-0.68/test-apport 2007-03-14 16:31:07.000000000 +0100 +++ /tmp/cwuWlFGveD/apport-0.69/test-apport 2007-03-19 17:36:44.000000000 +0100 @@ -306,27 +306,61 @@ os.chmod(test_executable, 0755) resource.setrlimit(resource.RLIMIT_CORE, (1, -1)) check_crash(expect_corefile=False) + apport.fileutils.delete_report(report) resource.setrlimit(resource.RLIMIT_CORE, (10, -1)) check_crash(expect_corefile=False) + apport.fileutils.delete_report(report) resource.setrlimit(resource.RLIMIT_CORE, (10000, -1)) check_crash(expect_corefile=True) + apport.fileutils.delete_report(report) resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) check_crash(expect_corefile=True) + apport.fileutils.delete_report(report) print '* Check that non-packaged executables create core dumps on proper ulimits for SIGABRT' os.chmod(test_executable, 0755) resource.setrlimit(resource.RLIMIT_CORE, (1, -1)) check_crash(expect_corefile=False, sig=signal.SIGABRT) + apport.fileutils.delete_report(report) resource.setrlimit(resource.RLIMIT_CORE, (10, -1)) check_crash(expect_corefile=False, sig=signal.SIGABRT) + apport.fileutils.delete_report(report) resource.setrlimit(resource.RLIMIT_CORE, (10000, -1)) check_crash(expect_corefile=True, sig=signal.SIGABRT) + apport.fileutils.delete_report(report) resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) check_crash(expect_corefile=True, sig=signal.SIGABRT) + apport.fileutils.delete_report(report) os.unlink(test_executable) test_executable = orig_test_executable + print '* Check that packaged executables create core dumps on proper ulimits' + resource.setrlimit(resource.RLIMIT_CORE, (1, -1)) + check_crash(expect_corefile=False) + apport.fileutils.delete_report(report) + resource.setrlimit(resource.RLIMIT_CORE, (10, -1)) + check_crash(expect_corefile=False) + apport.fileutils.delete_report(report) + resource.setrlimit(resource.RLIMIT_CORE, (10000, -1)) + check_crash(expect_corefile=True) + apport.fileutils.delete_report(report) + resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) + check_crash(expect_corefile=True) + apport.fileutils.delete_report(report) + + print '* Check that packaged executables create core dumps on proper ulimits for SIGABRT' + resource.setrlimit(resource.RLIMIT_CORE, (1, -1)) + check_crash(expect_corefile=False, sig=signal.SIGABRT) + resource.setrlimit(resource.RLIMIT_CORE, (10, -1)) + check_crash(expect_corefile=False, sig=signal.SIGABRT) + resource.setrlimit(resource.RLIMIT_CORE, (10000, -1)) + check_crash(expect_corefile=True, sig=signal.SIGABRT) + apport.fileutils.delete_report(report) + resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) + check_crash(expect_corefile=True, sig=signal.SIGABRT) + apport.fileutils.delete_report(report) + print '* Check that binary blacklisting works' pr.mark_ignore() check_crash() diff -Nru /tmp/9hNJJQTTAH/apport-0.68/TODO /tmp/cwuWlFGveD/apport-0.69/TODO --- /tmp/9hNJJQTTAH/apport-0.68/TODO 2007-03-13 12:55:10.000000000 +0100 +++ /tmp/cwuWlFGveD/apport-0.69/TODO 2007-03-15 13:02:11.000000000 +0100 @@ -6,7 +6,6 @@ apport-retrace: - add stack rewinding to step back through crash handlers - add heuristics for more crash types (SEGV on read/write/exec & mem region) - - stuck on 91756 python-apport: - Add API/report attribute for doing upstream problem reports