diff -Nru kerneloops-0.12+git20090217/configfile.c kerneloops-0.12+git20090217/configfile.c --- kerneloops-0.12+git20090217/configfile.c 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/configfile.c 2009-04-23 16:30:11.000000000 +0200 @@ -25,10 +25,8 @@ #include #include -#include #include #include -#include #include "kerneloops.h" @@ -39,7 +37,6 @@ int opted_in; int allow_distro_to_pass_on; char *submit_url; -char *submit_pipe; char *log_file; @@ -62,9 +59,6 @@ free(line); continue; } - c = strchr(line, '\n'); - if (c != NULL) - *c = '\0'; c = strstr(line, "allow-submit "); if (c) { c += 13; @@ -86,17 +80,6 @@ if (c) submit_url = strdup(c); } - c = strstr(line, "submit-pipe "); - if (c) { - c += 12; - while(*c) { - if ( !isspace(*c) && *c != '=') - break; - c++; - } - if (*c) - submit_pipe = strdup(c); - } c = strstr(line, "log-file "); if (c) { c += 9; diff -Nru kerneloops-0.12+git20090217/debian/changelog kerneloops-0.12+git20090217/debian/changelog --- kerneloops-0.12+git20090217/debian/changelog 2012-04-17 18:09:39.000000000 +0200 +++ kerneloops-0.12+git20090217/debian/changelog 2012-06-12 15:06:16.000000000 +0200 @@ -1,3 +1,83 @@ +kerneloops (0.12+git20090217-3ubuntu1) quantal; urgency=low + + * Daemon is disabled by default as the kerneloops.org web-site + is down. + * Merge from Debian unstable. Remaining changes: + - ubuntu-adapt-dmesg.patch + - Avoid bug 422536's WARNING as it isn't a WARN(). + - Avoid another way that edac complains loudly. (LP: 525792) + - ubuntu-add-submit-pipe.patch + - Add a "submit-pipe" configuration option for passing the oops to + another tool. Set it to pipe to apport for Ubuntu. + - Add kerneloops-submit which will allow apport to submit an oops. + - submit.c: do not report OOPSes with WARNING in them (LP: 346303) + - Don't scan the log file, just rely on dmesg for now to avoid a flood + of duplicate reports. Thanks Matt Zimmerman. (LP: 429000) + - ubuntu-change-syslog-location.patch + - Change log-file option to point to /var/log/kern.log instead of + /var/log/messages. + - ubuntu-ignore-newline.patch + - Ensure that the newline is not included in the value when parsing + string values (LP: 344813) + - Create a kernoops system user and run the daemon as that, using + start-stop-daemon. (Running in the adm group ensures it can + read the logs). + - Add postinst/postrm to add/remove the user. + - Depend on adduser. + - Tweak the dbus conf so that the new user can own the dbus names + (ubuntu-kernoops-user.patch). + - Don't stop the daemon in runlevels 0 or 6 as sendsigs can quite + happily kill it for us. + - Add apport to Recommends as it will be needed to report any oopses + now if you don't edit the configuration file. + + -- Stefan Bader Tue, 12 Jun 2012 15:05:45 +0200 + +kerneloops (0.12+git20090217-3) unstable; urgency=low + + * QA upload. + * Add missing build dependency on libdbus-glib-1-dev (Closes: #669456) + + -- Michael Biebl Thu, 19 Apr 2012 22:06:26 +0200 + +kerneloops (0.12+git20090217-2) unstable; urgency=low + + * QA upload. + * Orphan the package with QA Team approval + * Split package into applet and daemon packages (Closes: #476328) + * debian/control: + - Add ${misc:Depends} to Depends + - Bump debhelper compatibitily to 8 + - Bump Standards-Version to 3.9.2 + - Add lsb-base Dependency + - Set arch:linux-any as this software is only relevant with Linux kernel + - Add Homepage field + - Add Vcs- fields + * debian/rules: + - Switch to dh sequence + * Switch to dpkg-source 3.0 (quilt) format and split up existing patches + * debian/copyright: Add Copyright statements + * debian/kerneloops.init: + - Use our own version of the init file instead of upstream one + - Use LSB function for logging (Closes: #477418) + - Source /etc/default/kerneloops instead of /etc/sysconfig/kerneloops + (Closes: #588493) + - Exit immediately if the package is not installed (Closes: #496253, 540684) + * Add debian/gbp.conf file + * debian/patches/l10n_da.patch: Add Danish translation (Closes: #610098) + * debian/patches/l10n_de.patch: Add German translation (Closes: #624658) + + -- Laurent Bigonville Thu, 01 Dec 2011 17:37:21 +0100 + +kerneloops (0.12+git20090217-1.1) unstable; urgency=low + + * Non-maintainer upload + * Fix compatibility with libnotify 0.7 API (closes: #636297) + * Add now missing dependencies on libgtk2.0-dev + * Add dbus-glib-1 to pkg-config calls in Makefile + + -- Jérémy Bobbio Fri, 05 Aug 2011 18:53:41 +0200 + kerneloops (0.12+git20090217-1ubuntu19) precise; urgency=low * Disable kerneloops for final release. diff -Nru kerneloops-0.12+git20090217/debian/compat kerneloops-0.12+git20090217/debian/compat --- kerneloops-0.12+git20090217/debian/compat 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/compat 2011-12-01 17:37:27.000000000 +0100 @@ -1 +1 @@ -4 +8 diff -Nru kerneloops-0.12+git20090217/debian/control kerneloops-0.12+git20090217/debian/control --- kerneloops-0.12+git20090217/debian/control 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/control 2012-05-25 10:21:23.000000000 +0200 @@ -1,16 +1,20 @@ Source: kerneloops -Build-Depends: debhelper (>= 4), libcurl4-gnutls-dev | libcurl-dev, libnotify-dev, desktop-file-utils, libgtk2.0-dev, libdbus-glib-1-dev +Build-Depends: debhelper (>= 8), libcurl4-gnutls-dev | libcurl-dev, libgtk2.0-dev, libnotify-dev, libdbus-glib-1-dev, desktop-file-utils Section: utils Priority: optional Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Matthew Wilcox -Standards-Version: 3.8.1 +XSBC-Original-Maintainer: Debian QA Group +Standards-Version: 3.9.2 Homepage: http://www.kerneloops.org/ +Vcs-Git: git://anonscm.debian.org/git/collab-maint/kerneloops.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/kerneloops.git Package: kerneloops -Architecture: any -Depends: kerneloops-applet -Description: kernel oops tracker +Architecture: linux-any +Section: oldlibs +Priority: extra +Depends: kerneloops-applet, ${misc:Depends} +Description: kernel oops tracker (transitional package) This is a transitional package for splitting the kerneloops package into the kerneloops-daemon package and the kerneloops-applet package. In the future, the kerneloops package will contain only the @@ -18,10 +22,10 @@ applet, you should explicitly install the kerneloops-applet package. Package: kerneloops-daemon -Architecture: any -Depends: ${shlibs:Depends}, adduser -Conflicts: kerneloops (<< 0.12+git20090217-1ubuntu2) -Replaces: kerneloops (<< 0.12+git20090217-1ubuntu2) +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.2-14), adduser +Replaces: kerneloops (<< 0.12+git20090217-2) +Breaks: kerneloops (<< 0.12+git20090217-2) Recommends: apport Description: kernel oops tracker kerneloops is a daemon that collects kernel crash information and then @@ -29,9 +33,10 @@ statistical analysis and presentation to the Linux kernel developers. Package: kerneloops-applet -Architecture: any -Replaces: kerneloops (<< 0.12+git20090217-1ubuntu2) -Depends: ${shlibs:Depends}, kerneloops-daemon +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends}, kerneloops-daemon (= ${binary:Version}) +Replaces: kerneloops (<< 0.12+git20090217-2) +Breaks: kerneloops (<< 0.12+git20090217-2) Description: applet for the kernel oops tracker The kerneloops applet allows the kerneloops crash reporting utility to ask a desktop user for permission before submitting an oops report diff -Nru kerneloops-0.12+git20090217/debian/copyright kerneloops-0.12+git20090217/debian/copyright --- kerneloops-0.12+git20090217/debian/copyright 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/copyright 2011-12-01 17:37:27.000000000 +0100 @@ -6,6 +6,9 @@ The primary upstream author is Arjan van de Ven Copyright: + * Copyright (C) 2007 Intel Corporation + * Copyright (C) 2005-2007 Marcel Holtmann + * Copyright (C) 2006-2007 Bastien Nocera This software is supplied under the terms of the GNU General Public License version 2. The full text of the license can be found at: diff -Nru kerneloops-0.12+git20090217/debian/gbp.conf kerneloops-0.12+git20090217/debian/gbp.conf --- kerneloops-0.12+git20090217/debian/gbp.conf 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/gbp.conf 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,8 @@ +[DEFAULT] +debian-branch = debian +upstream-branch = upstream +pristine-tar = True + +[git-buildpackage] +tarball-dir = ../tarballs/ +export-dir = ../build-area/ diff -Nru kerneloops-0.12+git20090217/debian/kerneloops-applet.install kerneloops-0.12+git20090217/debian/kerneloops-applet.install --- kerneloops-0.12+git20090217/debian/kerneloops-applet.install 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/kerneloops-applet.install 2011-12-01 17:37:27.000000000 +0100 @@ -1,4 +1,4 @@ -debian/tmp/usr/bin/kerneloops-applet /usr/bin -debian/tmp/usr/share/kerneloops /usr/share -debian/tmp/usr/share/locale /usr/share -debian/tmp/etc/xdg/autostart/ /etc/xdg/ +etc/xdg/autostart/ +usr/bin/kerneloops-applet +usr/share/kerneloops/ +usr/share/locale/ diff -Nru kerneloops-0.12+git20090217/debian/kerneloops-applet.postinst kerneloops-0.12+git20090217/debian/kerneloops-applet.postinst --- kerneloops-0.12+git20090217/debian/kerneloops-applet.postinst 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/kerneloops-applet.postinst 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e - -mv_conffile() { - OLDCONFFILE="$1" - NEWCONFFILE="$2" - - if [ -e "$OLDCONFFILE" ]; then - echo "Preserving user changes to $NEWCONFFILE ..." - mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new - mv -f "$OLDCONFFILE" "$NEWCONFFILE" - fi -} - -case "$1" in -configure) - if dpkg --compare-versions "$2" le "0.12+git20090217-1ubuntu5"; then - mv_conffile "/etc/xdg/autostart/autostart/kerneloops-applet.desktop" "/etc/xdg/autostart/kerneloops-applet.desktop" - fi -esac - -#DEBHELPER# - diff -Nru kerneloops-0.12+git20090217/debian/kerneloops-applet.preinst kerneloops-0.12+git20090217/debian/kerneloops-applet.preinst --- kerneloops-0.12+git20090217/debian/kerneloops-applet.preinst 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/kerneloops-applet.preinst 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -#!/bin/sh - -set -e - -prep_mv_conffile() { - CONFFILE="$1" - - if [ -e "$CONFFILE" ]; then - md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" - old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`" - if [ "$md5sum" = "$old_md5sum" ]; then - rm -f "$CONFFILE" - fi - fi -} - -case "$1" in -install|upgrade) - if dpkg --compare-versions "$2" le "0.12+git20090217-1ubuntu5"; then - prep_mv_conffile "/etc/xdg/autostart/autostart/kerneloops-applet.desktop" - fi -esac - -#DEBHELPER# - diff -Nru kerneloops-0.12+git20090217/debian/kerneloops-daemon.install kerneloops-0.12+git20090217/debian/kerneloops-daemon.install --- kerneloops-0.12+git20090217/debian/kerneloops-daemon.install 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/kerneloops-daemon.install 2012-05-25 09:33:03.000000000 +0200 @@ -1,4 +1,5 @@ -debian/tmp/usr/sbin/kerneloops /usr/sbin/ -debian/tmp/usr/bin/kerneloops-submit /usr/bin/ -debian/tmp/usr/share/man/man8/* /usr/share/man/man8/ -debian/tmp/etc/kerneloops.conf /etc/ +etc/kerneloops.conf +etc/dbus-1/system.d/kerneloops.dbus +usr/sbin/kerneloops +usr/bin/kerneloops-submit +usr/share/man/man8/ diff -Nru kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.default kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.default --- kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.default 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.default 2012-05-25 10:22:07.000000000 +0200 @@ -0,0 +1,3 @@ +# Whether the daemon should be started at boot time. +# Set to 1 to start. +ENABLED=0 diff -Nru kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.init kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.init --- kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.init 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/kerneloops-daemon.kerneloops.init 2012-05-25 14:18:58.000000000 +0200 @@ -0,0 +1,123 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: kerneloops +# Required-Start: $remote_fs $named $network $time $syslog +# Required-Stop: $remote_fs $named $network $time $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +# Short-Description: Tool to automatically collect and submit kernel crash signatures +# Description: A tool that collects and submits kernel crash +# signatures to the kerneloops.org website for use by the Linux +# kernel developers. +### END INIT INFO + +# Author: Laurent Bigonville + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Kernel Oops catching service" +NAME=kerneloops +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +ENABLED=1 + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +[ "$ENABLED" = "1" ] || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --chuid kernoops:adm \ + --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --chuid kernoops:adm \ + --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS \ + || return 2 + pidofproc $DAEMON > $PIDFILE +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff -Nru kerneloops-0.12+git20090217/debian/kerneloops.default kerneloops-0.12+git20090217/debian/kerneloops.default --- kerneloops-0.12+git20090217/debian/kerneloops.default 2012-04-17 18:09:26.000000000 +0200 +++ kerneloops-0.12+git20090217/debian/kerneloops.default 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -# Whether the daemon should be started at boot time. -# Set to 1 to start. -enabled=0 diff -Nru kerneloops-0.12+git20090217/debian/patches/add_missing_include.patch kerneloops-0.12+git20090217/debian/patches/add_missing_include.patch --- kerneloops-0.12+git20090217/debian/patches/add_missing_include.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/add_missing_include.patch 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,10 @@ +--- kerneloops-0.12+git20090217.orig/configfile.c ++++ kerneloops-0.12+git20090217/configfile.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + + #include "kerneloops.h" + diff -Nru kerneloops-0.12+git20090217/debian/patches/l10n_da.patch kerneloops-0.12+git20090217/debian/patches/l10n_da.patch --- kerneloops-0.12+git20090217/debian/patches/l10n_da.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/l10n_da.patch 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,81 @@ +diff --git a/po/da.po b/po/da.po +new file mode 100644 +index 0000000..df9062a +--- /dev/null ++++ b/po/da.po +@@ -0,0 +1,75 @@ ++# Danish translation kerneloops. ++# Copyright (C) 2011 kerneloops og nedenstående oversættere. ++# This file is distributed under the same license as the kerneloops package. ++# Joe Hansen , 2011. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: kerneloops\n" ++"Report-Msgid-Bugs-To: \n" ++"POT-Creation-Date: 2008-01-01 06:36-0800\n" ++"PO-Revision-Date: 2011-01-07 17:30+01:00\n" ++"Last-Translator: Joe Hansen \n" ++"Language-Team: Danish \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++ ++#: kerneloops-applet.c:170 kerneloops-applet.c:212 ++msgid "Always" ++msgstr "Altid" ++ ++#: kerneloops-applet.c:332 ++#, c-format ++msgid "Connecting to system bus failed: %s\n" ++msgstr "Forbindelse til systembus mislykkedes: %s\n" ++ ++#: kerneloops-applet.c:190 ++msgid "" ++"Diagnostic information from your Linux kernel has been sent to www.kerneloops.org for the Linux kernel " ++"developers to work on. \n" ++"Thank you for contributing to improve the quality of the Linux kernel.\n" ++msgstr "" ++"Diagnostisk information fra din Linuxkerne er blevet sendt til www.kerneloops.org, så at udviklerne " ++"på Linuxkernen kan arbejde for forbedringer. \n" ++"Tak for dit bidrag til forbedring af kvaliteten på Linuxkernen.\n" ++ ++#: kerneloops-applet.c:188 ++msgid "Kernel bug diagnostic information sent" ++msgstr "diagnostisk information for kernefejlsøgning blev sendt" ++ ++#: kerneloops-applet.c:176 ++msgid "Never" ++msgstr "Aldrig" ++ ++#: kerneloops-applet.c:214 ++msgid "Never again" ++msgstr "Aldrig igen" ++ ++#: kerneloops-applet.c:174 ++msgid "No" ++msgstr "Nej" ++ ++#: kerneloops-applet.c:143 ++msgid "" ++"There is diagnostic information available for this failure. Do you want to " ++"submit this information to the www." ++"kerneloops.org website for use by the Linux kernel developers?\n" ++msgstr "" ++"Der er diagnostisk information tilgængelig for denne fejl. Ønsker du at sende " ++"denne information til hjemmesiden www." ++"kerneloops.org, så udviklerne på Linuxkernen kan bruge informationen?\n" ++ ++#: kerneloops-applet.c:172 ++msgid "Yes" ++msgstr "Ja" ++ ++#: kerneloops-applet.c:141 ++msgid "Your system had a kernel failure" ++msgstr "Dit system har en kernefejl" ++ ++#: kerneloops-applet.c:343 ++msgid "kerneloops client" ++msgstr "klient for kerneloops" diff -Nru kerneloops-0.12+git20090217/debian/patches/l10n_de.patch kerneloops-0.12+git20090217/debian/patches/l10n_de.patch --- kerneloops-0.12+git20090217/debian/patches/l10n_de.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/l10n_de.patch 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,80 @@ +--- /dev/null ++++ b/po/de.po +@@ -0,0 +1,77 @@ ++# translation of kerneloops to German ++# Copyright (C) Chris Leick , 2009. ++# This file is distributed under the same license as the kerneloops package. ++# Chris Leick , 2009. ++# ++msgid "" ++msgstr "" ++"Project-Id-Version: kerneloops-0.10.2\n" ++"Report-Msgid-Bugs-To: willy@debian.org\n" ++"POT-Creation-Date: 2009-02-22 11:49+0100\n" ++"PO-Revision-Date: 2009-03-16 13:05+0100\n" ++"Last-Translator: Chris Leick \n" ++"Language-Team: German \n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"Plural-Forms: nplurals=2; plural=(n != 1);\n" ++ ++#: kerneloops-applet.c:170 kerneloops-applet.c:212 ++msgid "Always" ++msgstr "Immer" ++ ++#: kerneloops-applet.c:332 ++#, c-format ++msgid "Connecting to system bus failed: %s\n" ++msgstr "Verbinden zum System-Bus fehlgeschlagen: %s\n" ++ ++#: kerneloops-applet.c:190 ++msgid "" ++"Diagnostic information from your Linux kernel has been sent to www.kerneloops.org for the Linux kernel " ++"developers to work on. \n" ++"Thank you for contributing to improve the quality of the Linux kernel.\n" ++msgstr "" ++"Diagnose-Information von Ihrem Linux-Kernel wurde an www.kerneloops.org gesandt, damit die " ++"Kernel-Entwickler daran arbeiten können.\n" ++"Vielen Dank, dass Sie zur Verbesserung des Linux-Kernels beitragen.\n" ++ ++#: kerneloops-applet.c:188 ++msgid "Kernel bug diagnostic information sent" ++msgstr "Gesendete Kernel-Fehler-Diagnose-Information" ++ ++#: kerneloops-applet.c:176 ++msgid "Never" ++msgstr "Niemals" ++ ++#: kerneloops-applet.c:214 ++msgid "Never again" ++msgstr "Niemals wieder" ++ ++#: kerneloops-applet.c:174 ++msgid "No" ++msgstr "Nein" ++ ++#: kerneloops-applet.c:143 ++msgid "" ++"There is diagnostic information available for this failure. Do you want to " ++"submit this information to the www." ++"kerneloops.org website for use by the Linux kernel developers?\n" ++msgstr "" ++"Es sind dort Diagnose-Informationen für diesen Ausfall verfügbar. Möchten " ++"Sie diese Information zu der www." ++"kerneloops.org-Website für die Benutzung durch die " ++"Linux-Kernel-Entwickler senden?\n" ++ ++#: kerneloops-applet.c:172 ++msgid "Yes" ++msgstr "Ja" ++ ++#: kerneloops-applet.c:141 ++msgid "Your system had a kernel failure" ++msgstr "Ihr System hatte einen Kernel-Ausfall" ++ ++#: kerneloops-applet.c:343 ++msgid "kerneloops client" ++msgstr "kerneloops-Client" diff -Nru kerneloops-0.12+git20090217/debian/patches/libnotify0.7.patch kerneloops-0.12+git20090217/debian/patches/libnotify0.7.patch --- kerneloops-0.12+git20090217/debian/patches/libnotify0.7.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/libnotify0.7.patch 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,41 @@ +--- kerneloops-0.12+git20090217.orig/kerneloops-applet.c ++++ kerneloops-0.12+git20090217/kerneloops-applet.c +@@ -51,6 +51,10 @@ + #include + + #include ++#ifndef NOTIFY_CHECK_VERSION ++#define NOTIFY_CHECK_VERSION(x,y,z) 0 ++#endif ++ + + static DBusConnection *bus; + +@@ -240,8 +244,13 @@ static void got_a_message(void) + /* if there's a notification active already, close it first */ + close_notification(); + ++#if NOTIFY_CHECK_VERSION(0,7,0) ++ notify = notify_notification_new(summary, message, ++ "/usr/share/kerneloops/icon.png"); ++#else + notify = notify_notification_new(summary, message, + "/usr/share/kerneloops/icon.png", NULL); ++#endif + + notify_notification_set_timeout(notify, 0); + notify_notification_set_urgency(notify, NOTIFY_URGENCY_CRITICAL); +@@ -306,8 +315,13 @@ static void sent_an_oops(void) + + url_to_oops[0] = 0; + ++#if NOTIFY_CHECK_VERSION(0,7,0) ++ notify = notify_notification_new(summary, message, ++ "/usr/share/kerneloops/icon.png"); ++#else + notify = notify_notification_new(summary, message, + "/usr/share/kerneloops/icon.png", NULL); ++#endif + + notify_notification_set_timeout(notify, 5000); + notify_notification_set_urgency(notify, NOTIFY_URGENCY_LOW); diff -Nru kerneloops-0.12+git20090217/debian/patches/link_against_dbus-glib.patch kerneloops-0.12+git20090217/debian/patches/link_against_dbus-glib.patch --- kerneloops-0.12+git20090217/debian/patches/link_against_dbus-glib.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/link_against_dbus-glib.patch 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,18 @@ +--- kerneloops-0.12+git20090217.orig/Makefile ++++ kerneloops-0.12+git20090217/Makefile +@@ -12,13 +12,13 @@ CC?=gcc + + CFLAGS := -O2 -g -fstack-protector -D_FORTIFY_SOURCE=2 -Wall -W -Wstrict-prototypes -Wundef -fno-common -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wformat -Wformat-security -Werror=format-security + +-MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0` ++MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0 dbus-glib-1` + # + # pkg-config tends to make programs pull in a ton of libraries, not all + # are needed. -Wl,--as-needed tells the linker to just drop unused ones, + # and that makes the applet load faster and use less memory. + # +-LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0` ++LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0 dbus-glib-1` + LDF_D := -Wl,--as-needed `pkg-config --libs glib-2.0 dbus-glib-1` `curl-config --libs` -Wl,"-z relro" -Wl,"-z now" + + all: kerneloops kerneloops-applet kerneloops.8.gz diff -Nru kerneloops-0.12+git20090217/debian/patches/remove_test_dbg.patch kerneloops-0.12+git20090217/debian/patches/remove_test_dbg.patch --- kerneloops-0.12+git20090217/debian/patches/remove_test_dbg.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/remove_test_dbg.patch 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1,11 @@ +--- kerneloops-0.12+git20090217.orig/Makefile ++++ kerneloops-0.12+git20090217/Makefile +@@ -40,7 +40,7 @@ kerneloops.8.gz: kerneloops.8 + gzip -9 -c $< > $@ + + clean: +- rm -f *~ *.o *.ko DEADJOE kerneloops kerneloops-applet *.out */*~ kerneloops.8.gz ++ rm -f *~ *.o *.ko DEADJOE kerneloops kerneloops-applet *.out */*~ kerneloops.8.gz test/*.dbg + @(cd po/ && $(MAKE) $@) + + dist: clean diff -Nru kerneloops-0.12+git20090217/debian/patches/series kerneloops-0.12+git20090217/debian/patches/series --- kerneloops-0.12+git20090217/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/series 2012-06-12 11:28:38.000000000 +0200 @@ -0,0 +1,11 @@ +remove_test_dbg.patch +add_missing_include.patch +link_against_dbus-glib.patch +libnotify0.7.patch +l10n_da.patch +l10n_de.patch +ubuntu-kernoops-user.patch +ubuntu-change-syslog-location.patch +ubuntu-ignore-newline.patch +ubuntu-add-submit-pipe.patch +ubuntu-adapt-dmesg.patch diff -Nru kerneloops-0.12+git20090217/debian/patches/ubuntu-adapt-dmesg.patch kerneloops-0.12+git20090217/debian/patches/ubuntu-adapt-dmesg.patch --- kerneloops-0.12+git20090217/debian/patches/ubuntu-adapt-dmesg.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/ubuntu-adapt-dmesg.patch 2012-06-12 14:34:46.000000000 +0200 @@ -0,0 +1,428 @@ +Description: Ubuntu changes to dmesg.c + Squashed together changes to dmesg.c from the previous ubuntu package. + Changes are: + - Serveral changes for which no related changelog entries were found: + - Use array of struct instead of two arrays for lineptrs and levels. + - Grow lineptr aray in chunks. + - Change lines into zero terminated strings. + - Add some asserts. + - Change some str* calls into mem* counterparts. + - Ignore two WARNINGS of EDAC (LP: 422536, 525792) +Forwarded: no +Origin: vendor, ??? +Bug-Ubuntu: http://bugs.launchpad.net/bugs/422536 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/525792 + +Index: kerneloops-0.12+git20090217/dmesg.c +=================================================================== +--- kerneloops-0.12+git20090217.orig/dmesg.c 2012-05-25 12:08:04.898374121 +0200 ++++ kerneloops-0.12+git20090217/dmesg.c 2012-05-25 12:09:18.234732652 +0200 +@@ -25,6 +25,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -36,101 +37,119 @@ + #include "kerneloops.h" + + +-static char **linepointer; ++struct line_info { ++ char *ptr; ++ char level; ++}; + +-static char *linelevel; ++static struct line_info *lines_info; ++static int lines_info_alloc; + static int linecount; + +-#define MAX(A,B) ((A) > (B) ? (A) : (B)) ++#define MIN(A,B) ((A) < (B) ? (A) : (B)) + ++#define REALLOC_CHUNK 1000 ++static int set_line_info(int index, char *linepointer, char linelevel) ++{ ++ if (index >= lines_info_alloc) { ++ struct line_info *new_info; ++ new_info = realloc(lines_info, ++ (lines_info_alloc + REALLOC_CHUNK) * sizeof(struct line_info)); ++ if (!new_info) ++ return -1; ++ lines_info_alloc += REALLOC_CHUNK; ++ lines_info = new_info; ++ } ++ ++ lines_info[index].ptr = linepointer; ++ lines_info[index].level = linelevel; ++ return 0; ++} + + /* + * This function splits the dmesg buffer data into lines +- * (null terminated). The linepointer array is assumed to be +- * allocated already. ++ * (null terminated). + */ +-static void fill_linepointers(char *buffer, int remove_syslog) ++static int fill_lineinfo(char *buffer, size_t buflen, int remove_syslog) + { +- char *c; ++ char *c, *linepointer, linelevel; + linecount = 0; ++ if (!buflen) ++ return 0; ++ buffer[buflen - 1] = '\n'; /* the buffer usually ends with \n, but let's make sure */ + c = buffer; +- while (c) { ++ while (c < buffer + buflen) { + int len = 0; + char *c9; + +- c9 = strchr(c, '\n'); +- if (c9) +- len = c9 - c; ++ c9 = memchr(c, '\n', buffer + buflen - c); /* a \n will always be found */ ++ assert(c9); ++ len = c9 - c; + + /* in /var/log/messages, we need to strip the first part off, upto the 3rd ':' */ + if (remove_syslog) { + char *c2; ++ int i; + + /* skip non-kernel lines */ + c2 = memmem(c, len, "kernel:", 7); + if (!c2) + c2 = memmem(c, len, "kerneloops:", 11); +- if (!c2) { +- c2 = c9; +- if (c2) { +- c = c2 + 1; +- continue; +- } else +- break; ++ if (!c2) ++ goto next_line; ++ ++ /* skip to message in "Jan 01 01:23:45 hostname kernel: message" */ ++ for (i = 0; i < 3; i++) { ++ c = memchr(c, ':', len); ++ if (!c) ++ goto next_line; ++ c++; ++ len = c9 - c; + } +- c = strchr(c, ':'); +- if (!c) +- break; +- c++; +- c = strchr(c, ':'); +- if (!c) +- break; + c++; +- c = strchr(c, ':'); +- if (!c) +- break; +- c++; +- if (*c) +- c++; ++ len--; + } + +- linepointer[linecount] = c; +- linelevel[linecount] = 0; ++ linepointer = c; ++ linelevel = 0; + /* store and remove kernel log level */ +- if (*c == '<' && *(c+2) == '>') { +- linelevel[linecount] = *(c+1); +- c = c + 3; +- linepointer[linecount] = c; ++ if (len >= 3 && *c == '<' && *(c+2) == '>') { ++ linelevel = *(c+1); ++ c += 3; ++ len -= 3; ++ linepointer = c; + } + /* remove jiffies time stamp counter if present */ + if (*c == '[') { + char *c2, *c3; +- c2 = strchr(c, '.'); +- c3 = strchr(c, ']'); ++ c2 = memchr(c, '.', len); ++ c3 = memchr(c, ']', len); + if (c2 && c3 && (c2 < c3) && (c3-c) < 14 && (c2-c) < 8) { +- c = c3+1; ++ c = c3 + 1; + if (*c == ' ') + c++; +- linepointer[linecount] = c; ++ len = c9 - c; ++ linepointer = c; + } + } + +- c = strchr(c, '\n'); /* turn the \n into a string termination */ +- if (c) { +- *c = 0; +- c = c+1; +- } ++ assert(c + len == c9); ++ *c9 = '\0'; /* turn the \n into a string termination */ + + /* if we see our own marker, we know we submitted everything upto here already */ +- if (strstr(linepointer[linecount], "www.kerneloops.org")) { ++ if (memmem(linepointer, len, "www.kerneloops.org", 18)) { + linecount = 0; +- linepointer[0] = NULL; ++ lines_info[0].ptr = NULL; + } ++ if (set_line_info(linecount, linepointer, linelevel) < 0) ++ return -1; + linecount++; ++next_line: ++ c = c9 + 1; + } ++ return 0; + } + +- + /* + * extract_oops tries to find oops signatures in a log + */ +@@ -142,23 +161,17 @@ + int oopsend; + int inbacktrace = 0; + +- linepointer = calloc(buflen+1, sizeof(char*)); +- if (!linepointer) +- return; +- linelevel = calloc(buflen+1, sizeof(char)); +- if (!linelevel) { +- free(linepointer); +- linepointer = NULL; +- return; +- } ++ lines_info = NULL; ++ lines_info_alloc = 0; + +- fill_linepointers(buffer, remove_syslog); ++ if (fill_lineinfo(buffer, buflen, remove_syslog) < 0) ++ goto fail; + + oopsend = linecount; + + i = 0; + while (i < linecount) { +- char *c = linepointer[i]; ++ char *c = lines_info[i].ptr; + + if (c == NULL) { + i++; +@@ -187,7 +200,9 @@ + if (strstr(c, "NETDEV WATCHDOG")) + oopsstart = i; + if (strstr(c, "WARNING:") && +- !strstr(c, "appears to be on the same physical disk")) ++ !strstr(c, "appears to be on the same physical disk") && ++ !strstr(c, "ECC is NOT currently enabled by the BIOS") && ++ !strstr(c, "ECC is disabled by BIOS. Module will NOT be loaded.")) + oopsstart = i; + if (strstr(c, "Unable to handle kernel")) + oopsstart = i; +@@ -203,7 +218,7 @@ + oopsstart = i-3; + if (oopsstart >= 0 && testmode) { + printf("Found start of oops at line %i\n", oopsstart); +- printf(" start line is -%s-\n", linepointer[oopsstart]); ++ printf(" start line is -%s-\n", lines_info[oopsstart].ptr); + if (oopsstart != i) + printf(" trigger line is -%s-\n", c); + } +@@ -213,7 +228,7 @@ + int i2; + i2 = i+1; + while (i2 < linecount && i2 < (i+50)) { +- if (strstr(linepointer[i2], "---[ end trace")) { ++ if (strstr(lines_info[i2].ptr, "---[ end trace")) { + inbacktrace = 1; + i = i2; + break; +@@ -224,15 +239,15 @@ + } + + /* a calltrace starts with "Call Trace:" or with the " [<.......>] function+0xFF/0xAA" pattern */ +- if (oopsstart >= 0 && strstr(linepointer[i], "Call Trace:")) ++ if (oopsstart >= 0 && strstr(lines_info[i].ptr, "Call Trace:")) + inbacktrace = 1; + +- else if (oopsstart >= 0 && inbacktrace == 0 && strlen(linepointer[i]) > 8) { ++ else if (oopsstart >= 0 && inbacktrace == 0 && strlen(lines_info[i].ptr) > 8) { + char *c1, *c2, *c3; +- c1 = strstr(linepointer[i], ">]"); +- c2 = strstr(linepointer[i], "+0x"); +- c3 = strstr(linepointer[i], "/0x"); +- if (linepointer[i][0] == ' ' && linepointer[i][1] == '[' && linepointer[i][2] == '<' && c1 && c2 && c3) ++ c1 = strstr(lines_info[i].ptr, ">]"); ++ c2 = strstr(lines_info[i].ptr, "+0x"); ++ c3 = strstr(lines_info[i].ptr, "/0x"); ++ if (lines_info[i].ptr[0] == ' ' && lines_info[i].ptr[1] == '[' && lines_info[i].ptr[2] == '<' && c1 && c2 && c3) + inbacktrace = 1; + } else + +@@ -240,38 +255,38 @@ + + if (oopsstart >= 0 && inbacktrace > 0) { + char c2, c3; +- c2 = linepointer[i][0]; +- c3 = linepointer[i][1]; ++ c2 = lines_info[i].ptr[0]; ++ c3 = lines_info[i].ptr[1]; + + /* line needs to start with " [" or have "] ["*/ + if ((c2 != ' ' || c3 != '[') && +- strstr(linepointer[i], "] [") == NULL && +- strstr(linepointer[i], "--- Exception") == NULL && +- strstr(linepointer[i], " LR =") == NULL && +- strstr(linepointer[i], "<#DF>") == NULL && +- strstr(linepointer[i], "") == NULL && +- strstr(linepointer[i], "") == NULL && +- strstr(linepointer[i], "<>") == NULL) ++ strstr(lines_info[i].ptr, "] [") == NULL && ++ strstr(lines_info[i].ptr, "--- Exception") == NULL && ++ strstr(lines_info[i].ptr, " LR =") == NULL && ++ strstr(lines_info[i].ptr, "<#DF>") == NULL && ++ strstr(lines_info[i].ptr, "") == NULL && ++ strstr(lines_info[i].ptr, "") == NULL && ++ strstr(lines_info[i].ptr, "<>") == NULL) + oopsend = i-1; + + /* oops lines are always more than 8 long */ +- if (strlen(linepointer[i]) < 8) ++ if (strlen(lines_info[i].ptr) < 8) + oopsend = i-1; + /* single oopses are of the same loglevel */ +- if (linelevel[i] != prevlevel) ++ if (lines_info[i].level != prevlevel) + oopsend = i-1; + /* The Code: line means we're done with the backtrace */ +- if (strstr(linepointer[i], "Code:") != NULL) ++ if (strstr(lines_info[i].ptr, "Code:") != NULL) + oopsend = i; +- if (strstr(linepointer[i], "Instruction dump::") != NULL) ++ if (strstr(lines_info[i].ptr, "Instruction dump::") != NULL) + oopsend = i; + /* if a new oops starts, this one has ended */ +- if (strstr(linepointer[i], "WARNING:") != NULL && oopsstart != i) ++ if (strstr(lines_info[i].ptr, "WARNING:") != NULL && oopsstart != i) + oopsend = i-1; +- if (strstr(linepointer[i], "Unable to handle") != NULL && oopsstart != i) ++ if (strstr(lines_info[i].ptr, "Unable to handle") != NULL && oopsstart != i) + oopsend = i-1; + /* kernel end-of-oops marker */ +- if (strstr(linepointer[i], "---[ end trace") != NULL) ++ if (strstr(lines_info[i].ptr, "---[ end trace") != NULL) + oopsend = i; + + if (oopsend <= i) { +@@ -281,12 +296,12 @@ + + len = 2; + for (q = oopsstart; q <= oopsend; q++) +- len += strlen(linepointer[q])+1; ++ len += strlen(lines_info[q].ptr)+1; + + oops = calloc(len, 1); + + for (q = oopsstart; q <= oopsend; q++) { +- strcat(oops, linepointer[q]); ++ strcat(oops, lines_info[q].ptr); + strcat(oops, "\n"); + } + /* too short oopses are invalid */ +@@ -298,7 +313,7 @@ + free(oops); + } + } +- prevlevel = linelevel[i]; ++ prevlevel = lines_info[i].level; + i++; + if (oopsstart > 0 && i-oopsstart > 50) { + oopsstart = -1; +@@ -319,15 +334,15 @@ + oopsend = i-1; + + len = 2; +- while (oopsend > 0 && linepointer[oopsend] == NULL) ++ while (oopsend > 0 && lines_info[oopsend].ptr == NULL) + oopsend--; + for (q = oopsstart; q <= oopsend; q++) +- len += strlen(linepointer[q])+1; ++ len += strlen(lines_info[q].ptr)+1; + + oops = calloc(len, 1); + + for (q = oopsstart; q <= oopsend; q++) { +- strcat(oops, linepointer[q]); ++ strcat(oops, lines_info[q].ptr); + strcat(oops, "\n"); + } + /* too short oopses are invalid */ +@@ -338,10 +353,9 @@ + oopsend = linecount; + free(oops); + } +- free(linepointer); +- free(linelevel); +- linepointer = NULL; +- linelevel = NULL; ++fail: ++ free(lines_info); ++ lines_info = NULL; + } + + int scan_dmesg(void __unused *unused) +@@ -366,7 +380,7 @@ + struct stat statb; + FILE *file; + int ret; +- size_t buflen; ++ size_t buflen, nread; + + memset(&statb, 0, sizeof(statb)); + +@@ -380,13 +394,13 @@ + * to /var/log/messages before we read it in... we try to + * deal with it by reading at most 1023 bytes extra. If there's + * more than that.. any oops will be in dmesg anyway. +- * Do not try to allocate an absurt amount of memory; ignore ++ * Do not try to allocate an absurd amount of memory; ignore + * older log messages because they are unlikely to have + * sufficiently recent data to be useful. 32MB is more + * than enough; it's not worth looping through more log + * if the log is larger than that. + */ +- buflen = MAX(statb.st_size+1024, 32*1024*1024); ++ buflen = MIN(statb.st_size+1024, 32*1024*1024); + buffer = calloc(buflen, 1); + assert(buffer != NULL); + +@@ -396,11 +410,11 @@ + return; + } + fseek(file, -buflen, SEEK_END); +- ret = fread(buffer, 1, buflen-1, file); ++ nread = fread(buffer, 1, buflen, file); + fclose(file); + +- if (ret > 0) +- extract_oops(buffer, buflen-1, issyslog); ++ if (nread > 0) ++ extract_oops(buffer, nread, issyslog); + free(buffer); + if (opted_in >= 2) + submit_queue(); diff -Nru kerneloops-0.12+git20090217/debian/patches/ubuntu-add-submit-pipe.patch kerneloops-0.12+git20090217/debian/patches/ubuntu-add-submit-pipe.patch --- kerneloops-0.12+git20090217/debian/patches/ubuntu-add-submit-pipe.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/ubuntu-add-submit-pipe.patch 2012-06-12 14:51:43.000000000 +0200 @@ -0,0 +1,608 @@ +Description: Add pipe submission option + - Adds a config file option that allows to set another tool which will + receive the report piped into stdin. Change the configuration to make + apport the default. + - Split off code to submit to kerneloops.org into its own binary called + submit-kerneloops. + - Don't scan the log-file, only look at dmesg (LP: 429000). + - Don't report oopses with WARNING in them (LP: 346303). +Forwarded: no +Origin: vendor, ??? +Bug-Ubuntu: http://bugs.launchpad.net/bugs/429000 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/346303 + +Index: kerneloops-0.12+git20090217/configfile.c +=================================================================== +--- kerneloops-0.12+git20090217.orig/configfile.c 2012-05-25 12:39:40.855642988 +0200 ++++ kerneloops-0.12+git20090217/configfile.c 2012-05-25 12:55:53.480397910 +0200 +@@ -25,6 +25,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -38,6 +39,7 @@ + int opted_in; + int allow_distro_to_pass_on; + char *submit_url; ++char *submit_pipe; + char *log_file; + + +@@ -84,6 +86,17 @@ + if (c) + submit_url = strdup(c); + } ++ c = strstr(line, "submit-pipe "); ++ if (c) { ++ c += 12; ++ while (*c) { ++ if ( !isspace(*c) && *c != '=') ++ break; ++ c++; ++ } ++ if (*c) ++ submit_pipe = strdup(c); ++ } + c = strstr(line, "log-file "); + if (c) { + c += 9; +Index: kerneloops-0.12+git20090217/kerneloops.conf +=================================================================== +--- kerneloops-0.12+git20090217.orig/kerneloops.conf 2012-05-25 12:39:40.815642797 +0200 ++++ kerneloops-0.12+git20090217/kerneloops.conf 2012-05-25 12:39:55.023712254 +0200 +@@ -39,3 +39,10 @@ + # + + log-file = /var/log/kern.log ++ ++# ++# Script or program to pipe oops submits to ++# Comment out for no pipe submission ++# ++ ++submit-pipe = /usr/share/apport/kernel_oops +Index: kerneloops-0.12+git20090217/kerneloops.h +=================================================================== +--- kerneloops-0.12+git20090217.orig/kerneloops.h 2012-05-25 12:39:40.875643085 +0200 ++++ kerneloops-0.12+git20090217/kerneloops.h 2012-05-25 12:39:55.023712254 +0200 +@@ -45,6 +45,7 @@ + extern int opted_in; + extern int allow_distro_to_pass_on; + extern char *submit_url; ++extern char *submit_pipe; + extern char *log_file; + + extern int testmode; +Index: kerneloops-0.12+git20090217/submit.c +=================================================================== +--- kerneloops-0.12+git20090217.orig/submit.c 2012-05-25 12:39:40.831642868 +0200 ++++ kerneloops-0.12+git20090217/submit.c 2012-05-25 12:39:55.023712254 +0200 +@@ -25,15 +25,16 @@ + #define _BSD_SOURCE + #include + #include ++#include + #include ++#include + #include + #include + #include ++#include + + #include + +-#include +- + #include "kerneloops.h" + + +@@ -112,7 +113,7 @@ + } + + +-void write_detail_file(void) ++static void write_detail_file(void) + { + int temp_fileno; + FILE *tmpf; +@@ -143,14 +144,75 @@ + close(temp_fileno); + } + +-void unlink_detail_file(void) ++static void unlink_detail_file(void) + { + if (detail_filename) { + unlink(detail_filename); + free(detail_filename); ++ detail_filename = NULL; + } + } + ++static void pipe_oopses(void) ++{ ++ struct oops *oops; ++ struct oops *queue; ++ ++ if (access(submit_pipe, X_OK) != 0) { ++ printf("Cant access %s, not submitting oopses\n", submit_pipe); ++ return; ++ } ++ ++ queue = queued_oopses; ++ queued_oopses = NULL; ++ barrier(); ++ oops = queue; ++ while (oops) { ++ FILE *pipe_file; ++ int len; ++ char pipe[4096]; ++ ++ if (strstr(oops->text, "WARNING:")) ++ return; ++ ++ if (strstr(oops->text, "NETDEV WATCHDOG:")) ++ return; ++ ++ len = snprintf(pipe, 4096, "%s %d", submit_pipe, oops->checksum); ++ if (len > 4096) { ++ printf("Pipe name too long, aborting\n"); ++ return; ++ } ++ ++ pipe_file = popen(pipe, "w"); ++ if (pipe_file) { ++ size_t written = 0; ++ int err; ++ char *buf = oops->text; ++ size_t to_write = strlen(oops->text); ++ ++ do { ++ written = fwrite(buf, 1, to_write, pipe_file); ++ if (written == to_write) ++ break; ++ buf += written; ++ to_write -= written; ++ } while (errno == EINTR); ++ if (written < to_write) { ++ perror("aborting, writing to pipe failed"); ++ } ++ ++ err = pclose(pipe_file); ++ if (err != 0) ++ perror("closing pipe failed"); ++ } else { ++ perror("aborting, popen failed"); ++ return; ++ } ++ ++ oops = oops->next; ++ } ++} + + static void print_queue(void) + { +@@ -175,39 +237,97 @@ + + } + +-static void write_logfile(int count) ++static void write_logfile(int count, char *result_url) + { + openlog("kerneloops", 0, LOG_KERN); +- syslog(LOG_WARNING, "Submitted %i kernel oopses to www.kerneloops.org", count); ++ syslog(LOG_WARNING, "Submitted %i kernel oopses to www.kerneloops.org", ++ count); ++ if (result_url && result_url[0]) ++ syslog(LOG_WARNING, "kerneloops.org: oops is posted as %s", ++ result_url); + closelog(); + } + +-char result_url[4096]; ++static char result_url[4096]; + +-size_t writefunction( void *ptr, size_t size, size_t nmemb, void __attribute((unused)) *stream) ++int submit_oops(struct oops *oops) + { +- char *c, *c1, *c2; +- c = malloc(size*nmemb + 1); +- memset(c, 0, size*nmemb + 1); +- memcpy(c, ptr, size*nmemb); +- printf("received %s \n", c); +- c1 = strstr(c, "201 "); +- if (c1) { +- c1+=4; +- c2 = strchr(c1, '\n'); +- if (c2) *c2 = 0; +- strncpy(result_url, c1, 4095); ++ char *submit_prog = "kerneloops-submit"; ++ int in_pipe[2]; ++ int out_pipe[2]; ++ int pid; ++ ++ if (pipe(in_pipe)) { ++ perror("pipe"); ++ return 1; ++ } ++ ++ if (pipe(out_pipe)){ ++ perror("pipe"); ++ return 1; ++ } ++ ++ pid = fork(); ++ if (pid < 0) { ++ perror("fork"); ++ } else if (pid == 0) { ++ //child ++ close(in_pipe[1]); ++ close(out_pipe[0]); ++ dup2(in_pipe[0], 0); ++ dup2(out_pipe[1], 1); ++ if (execvp(submit_prog, NULL)) { ++ perror("execl"); ++ exit(255); ++ } ++ exit(0); ++ } else { ++ // parent ++ size_t written = 0; ++ char *buf = oops->text; ++ size_t to_write = strlen(oops->text); ++ int status; ++ ssize_t count; ++ char url[4096]; ++ close(in_pipe[0]); ++ close(out_pipe[1]); ++ do { ++ written = write(in_pipe[1], buf, to_write); ++ if (written == to_write) ++ break; ++ buf += written; ++ to_write -= written; ++ } while (errno == EINTR); ++ if (written < to_write) { ++ perror("aborting, writing to pipe failed"); ++ return 1; ++ } ++ close(in_pipe[1]); ++ waitpid(pid, &status, 0); ++ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { ++ perror("child failed"); ++ close(out_pipe[0]); ++ return 1; ++ } ++ count = read(out_pipe[0], url, 4095); ++ if (count < 0) { ++ perror("read from child"); ++ return 1; ++ } ++ close(out_pipe[0]); ++ printf("url is %s\n", url); ++ strncpy(result_url, url, 4095); + } +- return size * nmemb; ++ return 0; + } + + void submit_queue(void) + { +- int result; + struct oops *oops; + struct oops *queue; + int count = 0; + ++ unlink_detail_file(); + memset(result_url, 0, 4096); + + if (testmode) { +@@ -220,53 +340,28 @@ + barrier(); + oops = queue; + while (oops) { +- CURL *handle; +- struct curl_httppost *post = NULL; +- struct curl_httppost *last = NULL; ++ int err; + struct oops *next; +- +- handle = curl_easy_init(); +- +- printf("DEBUG SUBMIT URL is %s \n", submit_url); +- curl_easy_setopt(handle, CURLOPT_URL, submit_url); +- +- /* set up the POST data */ +- curl_formadd(&post, &last, +- CURLFORM_COPYNAME, "oopsdata", +- CURLFORM_COPYCONTENTS, oops->text, CURLFORM_END); +- +- if (allow_distro_to_pass_on) { +- curl_formadd(&post, &last, +- CURLFORM_COPYNAME, "pass_on_allowed", +- CURLFORM_COPYCONTENTS, "yes", CURLFORM_END); +- } +- +- curl_easy_setopt(handle, CURLOPT_HTTPPOST, post); +- curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction); +- result = curl_easy_perform(handle); +- +- curl_formfree(post); +- curl_easy_cleanup(handle); ++ err = submit_oops(oops); + next = oops->next; + free(oops->text); + free(oops); + oops = next; +- count++; ++ if (!err) ++ count++; + } + +- if (count && !testmode) +- write_logfile(count); +- +- if (count) ++ if (count) { ++ write_logfile(count, result_url); + dbus_say_thanks(result_url); ++ } ++ + /* + * If we've reached the maximum count, we'll exit the program, + * the program won't do any useful work anymore going forward. + */ +- if (submitted >= MAX_CHECKSUMS-1) { +- unlink_detail_file(); ++ if (submitted >= MAX_CHECKSUMS-1) + exit(EXIT_SUCCESS); +- } + } + + void clear_queue(void) +@@ -284,17 +379,27 @@ + free(oops); + oops = next; + } +- write_logfile(0); ++ unlink_detail_file(); ++ write_logfile(0, NULL); + } + + void ask_permission(void) + { +- if (!newoops && !pinged) ++ if (!newoops) + return; +- pinged = 0; +- newoops = 0; +- if (queued_oopses) { +- write_detail_file(); +- dbus_ask_permission(detail_filename); ++ if (!submit_pipe) { ++ if (!pinged) ++ return; ++ pinged = 0; ++ newoops = 0; ++ if (queued_oopses) { ++ write_detail_file(); ++ dbus_ask_permission(detail_filename); ++ } ++ } else { ++ newoops = 0; ++ if (queued_oopses) { ++ pipe_oopses(); ++ } + } + } +Index: kerneloops-0.12+git20090217/Makefile +=================================================================== +--- kerneloops-0.12+git20090217.orig/Makefile 2012-05-25 12:39:40.895643188 +0200 ++++ kerneloops-0.12+git20090217/Makefile 2012-05-25 14:07:29.393399559 +0200 +@@ -21,7 +21,7 @@ + LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0 dbus-glib-1` + LDF_D := -Wl,--as-needed `pkg-config --libs glib-2.0 dbus-glib-1` `curl-config --libs` -Wl,"-z relro" -Wl,"-z now" + +-all: kerneloops kerneloops-applet kerneloops.8.gz ++all: kerneloops kerneloops-applet kerneloops-submit kerneloops.8.gz + + noui: kerneloops kerneloops.8.gz + +@@ -36,6 +36,9 @@ + kerneloops-applet: kerneloops-applet.o + gcc kerneloops-applet.o $(LDF_A)-o kerneloops-applet + ++kerneloops-submit: kerneloops-submit.o configfile.o ++ gcc kerneloops-submit.o configfile.o $(LDF_D) -o kerneloops-submit ++ + kerneloops.8.gz: kerneloops.8 + gzip -9 -c $< > $@ + +@@ -58,6 +61,10 @@ + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 0755 kerneloops $(DESTDIR)$(SBINDIR)/ + ++install-kerneloops-submit: kerneloops-submit ++ -mkdir -p $(DESTDIR)$(BINDIR) ++ install -m 0755 kerneloops-submit $(DESTDIR)$(BINDIR)/ ++ + install-applet: kerneloops-applet + -mkdir -p $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)/etc/xdg/autostart +@@ -66,9 +73,9 @@ + desktop-file-install --mode 0644 --dir=$(DESTDIR)/etc/xdg/autostart/ kerneloops-applet.desktop + install -m 0644 icon.png $(DESTDIR)/usr/share/kerneloops/icon.png + +-install: install-system install-kerneloops install-applet ++install: install-system install-kerneloops install-applet install-kerneloops-submit + +-install-noui: install-system install-kerneloops ++install-noui: install-system install-kerneloops install-kerneloops-submit + + + # This is for translators. To update your po with new strings, do : +Index: kerneloops-0.12+git20090217/kerneloops-submit.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kerneloops-0.12+git20090217/kerneloops-submit.c 2012-05-25 13:44:52.798767502 +0200 +@@ -0,0 +1,120 @@ ++/* ++ * Copyright 2007, Intel Corporation ++ * ++ * This file is part of kerneloops.org ++ * ++ * This program file is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; version 2 of the License. ++ * ++ * This program is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program in a file named COPYING; if not, write to the ++ * Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, ++ * Boston, MA 02110-1301 USA ++ * ++ * Authors: ++ * Arjan van de Ven ++ * James Westby ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "kerneloops.h" ++ ++ ++static char result_url[4096]; ++ ++static void write_logfile(char *result_url) ++{ ++ openlog("kerneloops-submit", 0, LOG_KERN); ++ syslog(LOG_WARNING, "Submitted 1 kernel oopses to www.kerneloops.org"); ++ syslog(LOG_WARNING, "kerneloops.org: oops is posted as %s", result_url); ++ closelog(); ++} ++ ++static size_t writefunction( void *ptr, size_t size, size_t nmemb, void __attribute((unused)) *stream) ++{ ++ char *c, *c1, *c2; ++ c = malloc(size*nmemb + 1); ++ memset(c, 0, size*nmemb + 1); ++ memcpy(c, ptr, size*nmemb); ++ c1 = strstr(c, "201 "); ++ if (c1) { ++ c1+=4; ++ c2 = strchr(c1, '\n'); ++ if (c2) *c2 = 0; ++ strncpy(result_url, c1, 4095); ++ } ++ return size * nmemb; ++} ++ ++void submit_oops(char *text) ++{ ++ int result; ++ CURL *handle; ++ struct curl_httppost *post = NULL; ++ struct curl_httppost *last = NULL; ++ ++ handle = curl_easy_init(); ++ ++ curl_easy_setopt(handle, CURLOPT_URL, submit_url); ++ ++ /* set up the POST data */ ++ curl_formadd(&post, &last, ++ CURLFORM_COPYNAME, "oopsdata", ++ CURLFORM_COPYCONTENTS, text, CURLFORM_END); ++ ++ if (allow_distro_to_pass_on) { ++ curl_formadd(&post, &last, ++ CURLFORM_COPYNAME, "pass_on_allowed", ++ CURLFORM_COPYCONTENTS, "yes", CURLFORM_END); ++ } ++ ++ curl_easy_setopt(handle, CURLOPT_HTTPPOST, post); ++ curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction); ++ result = curl_easy_perform(handle); ++ ++ if (result_url[0]) { ++ write_logfile(result_url); ++ printf("%s\n", result_url); ++ } ++ ++ curl_formfree(post); ++ curl_easy_cleanup(handle); ++} ++ ++int main(int __unused argc, char __unused **argv) ++{ ++ char text[10000]; ++ size_t resp; ++ char *buf = text; ++ size_t to_read = 10000; ++ ++ while (!feof(stdin) && !ferror(stdin)) { ++ resp = fread(buf, 1, to_read, stdin); ++ buf = buf + resp; ++ to_read = to_read - resp; ++ } ++ ++ if (ferror(stdin)) { ++ write_logfile("ferror(stdin)\n"); ++ return 1; ++ } ++ ++ read_config_file("/etc/kerneloops.conf"); ++ ++ submit_oops(text); ++ ++ return 0; ++} +Index: kerneloops-0.12+git20090217/kerneloops.c +=================================================================== +--- kerneloops-0.12+git20090217.orig/kerneloops.c 2012-05-25 12:39:40.911643266 +0200 ++++ kerneloops-0.12+git20090217/kerneloops.c 2012-05-25 12:39:55.023712254 +0200 +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -119,7 +120,6 @@ + dbus_message_append_args (message, DBUS_TYPE_STRING, &url, DBUS_TYPE_INVALID); + dbus_connection_send(bus, message, NULL); + dbus_message_unref(message); +- syslog(LOG_WARNING, "kerneloops.org: oops is posted as %s", url); + } + + message = dbus_message_new_signal("/org/kerneloops/submit/sent", +@@ -185,12 +185,13 @@ + dbus_connection_add_filter(bus, got_message, NULL, NULL); + } + +- /* we scan dmesg before /var/log/messages; dmesg is a more accurate source normally */ +- scan_dmesg(NULL); + /* during boot... don't go too fast and slow the system down */ + if (!testmode) + sleep(10); +- scan_filename(log_file, 1); ++ /* we scan dmesg before /var/log/messages; dmesg is a more accurate source normally */ ++ scan_dmesg(NULL); ++ /* Can cause an OOPS to be reported multiple times LP: #429000 */ ++ /* scan_filename(log_file, 1); */ + + if (argc > 2 && strstr(argv[1], "--file")) + scan_filename(argv[2], 1); diff -Nru kerneloops-0.12+git20090217/debian/patches/ubuntu-change-syslog-location.patch kerneloops-0.12+git20090217/debian/patches/ubuntu-change-syslog-location.patch --- kerneloops-0.12+git20090217/debian/patches/ubuntu-change-syslog-location.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/ubuntu-change-syslog-location.patch 2012-06-12 14:53:29.000000000 +0200 @@ -0,0 +1,15 @@ +Description: Change location of logfile + Changes the hard coded logfile into /var/log/kern.log +Forwarded: no +Origin: vendor, ??? + +Index: kerneloops-0.12+git20090217/kerneloops.conf +=================================================================== +--- kerneloops-0.12+git20090217.orig/kerneloops.conf 2009-04-23 16:30:11.000000000 +0200 ++++ kerneloops-0.12+git20090217/kerneloops.conf 2012-05-25 10:29:22.585421414 +0200 +@@ -38,4 +38,4 @@ + # Path to syslog file containing full kernel logging output + # + +-log-file = /var/log/messages ++log-file = /var/log/kern.log diff -Nru kerneloops-0.12+git20090217/debian/patches/ubuntu-ignore-newline.patch kerneloops-0.12+git20090217/debian/patches/ubuntu-ignore-newline.patch --- kerneloops-0.12+git20090217/debian/patches/ubuntu-ignore-newline.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/ubuntu-ignore-newline.patch 2012-06-12 14:56:45.000000000 +0200 @@ -0,0 +1,21 @@ +Description: Ensure that newline is stripped off + Explicitely removes any trailing newlines from all lines read from + the configuration file. +Forwarded: no +Origin: vendor, ??? +Bugs-Ubuntu: http://bugs.launchpad.net/bugs/344813 + +Index: kerneloops-0.12+git20090217/configfile.c +=================================================================== +--- kerneloops-0.12+git20090217.orig/configfile.c 2012-05-25 09:19:18.000000000 +0200 ++++ kerneloops-0.12+git20090217/configfile.c 2012-05-25 10:41:08.632873101 +0200 +@@ -60,6 +60,9 @@ + free(line); + continue; + } ++ c = strchr(line, '\n'); ++ if (c != NULL) ++ *c = '\0'; + c = strstr(line, "allow-submit "); + if (c) { + c += 13; diff -Nru kerneloops-0.12+git20090217/debian/patches/ubuntu-kernoops-user.patch kerneloops-0.12+git20090217/debian/patches/ubuntu-kernoops-user.patch --- kerneloops-0.12+git20090217/debian/patches/ubuntu-kernoops-user.patch 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/patches/ubuntu-kernoops-user.patch 2012-06-12 15:00:01.000000000 +0200 @@ -0,0 +1,18 @@ +Description: Change dbus configuration policy + Set kernoops user as the owner for submitting oopses. +Forwarded: no +Origin: vendor, ??? + +Index: kerneloops-0.12+git20090217/kerneloops.dbus +=================================================================== +--- kerneloops-0.12+git20090217.orig/kerneloops.dbus 2009-04-23 16:30:11.000000000 +0200 ++++ kerneloops-0.12+git20090217/kerneloops.dbus 2012-05-25 10:18:32.842244981 +0200 +@@ -7,7 +7,7 @@ + + + +- ++ + + + diff -Nru kerneloops-0.12+git20090217/debian/rules kerneloops-0.12+git20090217/debian/rules --- kerneloops-0.12+git20090217/debian/rules 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/rules 2011-12-01 17:37:27.000000000 +0100 @@ -1,60 +1,11 @@ #!/usr/bin/make -f +# -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -build: build-stamp -build-stamp: - dh_testdir - $(MAKE) $(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),CFLAGS+=-O0,) -ifneq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),nocheck) - $(MAKE) tests -endif - touch build-stamp +%: + dh $@ -clean: - dh_testdir - dh_testroot - rm -f build-stamp - - $(MAKE) clean - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/ - $(MAKE) DESTDIR=`pwd`/debian/tmp install - install -D -m 0755 kerneloops.init `pwd`/debian/kerneloops-daemon/etc/init.d/kerneloops - install -D -m 0644 debian/kerneloops.default `pwd`/debian/kerneloops-daemon/etc/default/kerneloops - dh_install - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_installinit -pkerneloops-daemon --name=kerneloops -o -- start 20 2 3 4 5 . stop 20 1 . -# dh_installdebconf -# dh_installman kerneloops.8 - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +override_dh_installinit: + dh_installinit -pkerneloops-daemon --name=kerneloops diff -Nru kerneloops-0.12+git20090217/debian/source/format kerneloops-0.12+git20090217/debian/source/format --- kerneloops-0.12+git20090217/debian/source/format 1970-01-01 01:00:00.000000000 +0100 +++ kerneloops-0.12+git20090217/debian/source/format 2011-12-01 17:37:27.000000000 +0100 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru kerneloops-0.12+git20090217/dmesg.c kerneloops-0.12+git20090217/dmesg.c --- kerneloops-0.12+git20090217/dmesg.c 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/dmesg.c 2009-04-23 16:30:11.000000000 +0200 @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -37,119 +36,101 @@ #include "kerneloops.h" -struct line_info { - char *ptr; - char level; -}; +static char **linepointer; -static struct line_info *lines_info; -static int lines_info_alloc; +static char *linelevel; static int linecount; -#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#define MAX(A,B) ((A) > (B) ? (A) : (B)) -#define REALLOC_CHUNK 1000 -static int set_line_info(int index, char *linepointer, char linelevel) -{ - if (index >= lines_info_alloc) { - struct line_info *new_info; - new_info = realloc(lines_info, - (lines_info_alloc + REALLOC_CHUNK) * sizeof(struct line_info)); - if (!new_info) - return -1; - lines_info_alloc += REALLOC_CHUNK; - lines_info = new_info; - } - - lines_info[index].ptr = linepointer; - lines_info[index].level = linelevel; - return 0; -} /* * This function splits the dmesg buffer data into lines - * (null terminated). + * (null terminated). The linepointer array is assumed to be + * allocated already. */ -static int fill_lineinfo(char *buffer, size_t buflen, int remove_syslog) +static void fill_linepointers(char *buffer, int remove_syslog) { - char *c, *linepointer, linelevel; + char *c; linecount = 0; - if (!buflen) - return 0; - buffer[buflen - 1] = '\n'; /* the buffer usually ends with \n, but let's make sure */ c = buffer; - while (c < buffer + buflen) { + while (c) { int len = 0; char *c9; - c9 = memchr(c, '\n', buffer + buflen - c); /* a \n will always be found */ - assert(c9); - len = c9 - c; + c9 = strchr(c, '\n'); + if (c9) + len = c9 - c; /* in /var/log/messages, we need to strip the first part off, upto the 3rd ':' */ if (remove_syslog) { char *c2; - int i; /* skip non-kernel lines */ c2 = memmem(c, len, "kernel:", 7); if (!c2) c2 = memmem(c, len, "kerneloops:", 11); - if (!c2) - goto next_line; - - /* skip to message in "Jan 01 01:23:45 hostname kernel: message" */ - for (i = 0; i < 3; i++) { - c = memchr(c, ':', len); - if (!c) - goto next_line; - c++; - len = c9 - c; + if (!c2) { + c2 = c9; + if (c2) { + c = c2 + 1; + continue; + } else + break; } + c = strchr(c, ':'); + if (!c) + break; + c++; + c = strchr(c, ':'); + if (!c) + break; c++; - len--; + c = strchr(c, ':'); + if (!c) + break; + c++; + if (*c) + c++; } - linepointer = c; - linelevel = 0; + linepointer[linecount] = c; + linelevel[linecount] = 0; /* store and remove kernel log level */ - if (len >= 3 && *c == '<' && *(c+2) == '>') { - linelevel = *(c+1); - c += 3; - len -= 3; - linepointer = c; + if (*c == '<' && *(c+2) == '>') { + linelevel[linecount] = *(c+1); + c = c + 3; + linepointer[linecount] = c; } /* remove jiffies time stamp counter if present */ if (*c == '[') { char *c2, *c3; - c2 = memchr(c, '.', len); - c3 = memchr(c, ']', len); + c2 = strchr(c, '.'); + c3 = strchr(c, ']'); if (c2 && c3 && (c2 < c3) && (c3-c) < 14 && (c2-c) < 8) { - c = c3 + 1; + c = c3+1; if (*c == ' ') c++; - len = c9 - c; - linepointer = c; + linepointer[linecount] = c; } } - assert(c + len == c9); - *c9 = '\0'; /* turn the \n into a string termination */ + c = strchr(c, '\n'); /* turn the \n into a string termination */ + if (c) { + *c = 0; + c = c+1; + } /* if we see our own marker, we know we submitted everything upto here already */ - if (memmem(linepointer, len, "www.kerneloops.org", 18)) { + if (strstr(linepointer[linecount], "www.kerneloops.org")) { linecount = 0; - lines_info[0].ptr = NULL; + linepointer[0] = NULL; } - if (set_line_info(linecount, linepointer, linelevel) < 0) - return -1; linecount++; -next_line: - c = c9 + 1; } - return 0; } + /* * extract_oops tries to find oops signatures in a log */ @@ -161,17 +142,23 @@ int oopsend; int inbacktrace = 0; - lines_info = NULL; - lines_info_alloc = 0; + linepointer = calloc(buflen+1, sizeof(char*)); + if (!linepointer) + return; + linelevel = calloc(buflen+1, sizeof(char)); + if (!linelevel) { + free(linepointer); + linepointer = NULL; + return; + } - if (fill_lineinfo(buffer, buflen, remove_syslog) < 0) - goto fail; + fill_linepointers(buffer, remove_syslog); oopsend = linecount; i = 0; while (i < linecount) { - char *c = lines_info[i].ptr; + char *c = linepointer[i]; if (c == NULL) { i++; @@ -200,9 +187,7 @@ if (strstr(c, "NETDEV WATCHDOG")) oopsstart = i; if (strstr(c, "WARNING:") && - !strstr(c, "appears to be on the same physical disk") && - !strstr(c, "ECC is NOT currently enabled by the BIOS") && - !strstr(c, "ECC is disabled by BIOS. Module will NOT be loaded.")) + !strstr(c, "appears to be on the same physical disk")) oopsstart = i; if (strstr(c, "Unable to handle kernel")) oopsstart = i; @@ -218,7 +203,7 @@ oopsstart = i-3; if (oopsstart >= 0 && testmode) { printf("Found start of oops at line %i\n", oopsstart); - printf(" start line is -%s-\n", lines_info[oopsstart].ptr); + printf(" start line is -%s-\n", linepointer[oopsstart]); if (oopsstart != i) printf(" trigger line is -%s-\n", c); } @@ -228,7 +213,7 @@ int i2; i2 = i+1; while (i2 < linecount && i2 < (i+50)) { - if (strstr(lines_info[i2].ptr, "---[ end trace")) { + if (strstr(linepointer[i2], "---[ end trace")) { inbacktrace = 1; i = i2; break; @@ -239,15 +224,15 @@ } /* a calltrace starts with "Call Trace:" or with the " [<.......>] function+0xFF/0xAA" pattern */ - if (oopsstart >= 0 && strstr(lines_info[i].ptr, "Call Trace:")) + if (oopsstart >= 0 && strstr(linepointer[i], "Call Trace:")) inbacktrace = 1; - else if (oopsstart >= 0 && inbacktrace == 0 && strlen(lines_info[i].ptr) > 8) { + else if (oopsstart >= 0 && inbacktrace == 0 && strlen(linepointer[i]) > 8) { char *c1, *c2, *c3; - c1 = strstr(lines_info[i].ptr, ">]"); - c2 = strstr(lines_info[i].ptr, "+0x"); - c3 = strstr(lines_info[i].ptr, "/0x"); - if (lines_info[i].ptr[0] == ' ' && lines_info[i].ptr[1] == '[' && lines_info[i].ptr[2] == '<' && c1 && c2 && c3) + c1 = strstr(linepointer[i], ">]"); + c2 = strstr(linepointer[i], "+0x"); + c3 = strstr(linepointer[i], "/0x"); + if (linepointer[i][0] == ' ' && linepointer[i][1] == '[' && linepointer[i][2] == '<' && c1 && c2 && c3) inbacktrace = 1; } else @@ -255,38 +240,38 @@ if (oopsstart >= 0 && inbacktrace > 0) { char c2, c3; - c2 = lines_info[i].ptr[0]; - c3 = lines_info[i].ptr[1]; + c2 = linepointer[i][0]; + c3 = linepointer[i][1]; /* line needs to start with " [" or have "] ["*/ if ((c2 != ' ' || c3 != '[') && - strstr(lines_info[i].ptr, "] [") == NULL && - strstr(lines_info[i].ptr, "--- Exception") == NULL && - strstr(lines_info[i].ptr, " LR =") == NULL && - strstr(lines_info[i].ptr, "<#DF>") == NULL && - strstr(lines_info[i].ptr, "") == NULL && - strstr(lines_info[i].ptr, "") == NULL && - strstr(lines_info[i].ptr, "<>") == NULL) + strstr(linepointer[i], "] [") == NULL && + strstr(linepointer[i], "--- Exception") == NULL && + strstr(linepointer[i], " LR =") == NULL && + strstr(linepointer[i], "<#DF>") == NULL && + strstr(linepointer[i], "") == NULL && + strstr(linepointer[i], "") == NULL && + strstr(linepointer[i], "<>") == NULL) oopsend = i-1; /* oops lines are always more than 8 long */ - if (strlen(lines_info[i].ptr) < 8) + if (strlen(linepointer[i]) < 8) oopsend = i-1; /* single oopses are of the same loglevel */ - if (lines_info[i].level != prevlevel) + if (linelevel[i] != prevlevel) oopsend = i-1; /* The Code: line means we're done with the backtrace */ - if (strstr(lines_info[i].ptr, "Code:") != NULL) + if (strstr(linepointer[i], "Code:") != NULL) oopsend = i; - if (strstr(lines_info[i].ptr, "Instruction dump::") != NULL) + if (strstr(linepointer[i], "Instruction dump::") != NULL) oopsend = i; /* if a new oops starts, this one has ended */ - if (strstr(lines_info[i].ptr, "WARNING:") != NULL && oopsstart != i) + if (strstr(linepointer[i], "WARNING:") != NULL && oopsstart != i) oopsend = i-1; - if (strstr(lines_info[i].ptr, "Unable to handle") != NULL && oopsstart != i) + if (strstr(linepointer[i], "Unable to handle") != NULL && oopsstart != i) oopsend = i-1; /* kernel end-of-oops marker */ - if (strstr(lines_info[i].ptr, "---[ end trace") != NULL) + if (strstr(linepointer[i], "---[ end trace") != NULL) oopsend = i; if (oopsend <= i) { @@ -296,12 +281,12 @@ len = 2; for (q = oopsstart; q <= oopsend; q++) - len += strlen(lines_info[q].ptr)+1; + len += strlen(linepointer[q])+1; oops = calloc(len, 1); for (q = oopsstart; q <= oopsend; q++) { - strcat(oops, lines_info[q].ptr); + strcat(oops, linepointer[q]); strcat(oops, "\n"); } /* too short oopses are invalid */ @@ -313,7 +298,7 @@ free(oops); } } - prevlevel = lines_info[i].level; + prevlevel = linelevel[i]; i++; if (oopsstart > 0 && i-oopsstart > 50) { oopsstart = -1; @@ -334,15 +319,15 @@ oopsend = i-1; len = 2; - while (oopsend > 0 && lines_info[oopsend].ptr == NULL) + while (oopsend > 0 && linepointer[oopsend] == NULL) oopsend--; for (q = oopsstart; q <= oopsend; q++) - len += strlen(lines_info[q].ptr)+1; + len += strlen(linepointer[q])+1; oops = calloc(len, 1); for (q = oopsstart; q <= oopsend; q++) { - strcat(oops, lines_info[q].ptr); + strcat(oops, linepointer[q]); strcat(oops, "\n"); } /* too short oopses are invalid */ @@ -353,9 +338,10 @@ oopsend = linecount; free(oops); } -fail: - free(lines_info); - lines_info = NULL; + free(linepointer); + free(linelevel); + linepointer = NULL; + linelevel = NULL; } int scan_dmesg(void __unused *unused) @@ -380,7 +366,7 @@ struct stat statb; FILE *file; int ret; - size_t buflen, nread; + size_t buflen; memset(&statb, 0, sizeof(statb)); @@ -394,13 +380,13 @@ * to /var/log/messages before we read it in... we try to * deal with it by reading at most 1023 bytes extra. If there's * more than that.. any oops will be in dmesg anyway. - * Do not try to allocate an absurd amount of memory; ignore + * Do not try to allocate an absurt amount of memory; ignore * older log messages because they are unlikely to have * sufficiently recent data to be useful. 32MB is more * than enough; it's not worth looping through more log * if the log is larger than that. */ - buflen = MIN(statb.st_size+1024, 32*1024*1024); + buflen = MAX(statb.st_size+1024, 32*1024*1024); buffer = calloc(buflen, 1); assert(buffer != NULL); @@ -410,11 +396,11 @@ return; } fseek(file, -buflen, SEEK_END); - nread = fread(buffer, 1, buflen, file); + ret = fread(buffer, 1, buflen-1, file); fclose(file); - if (nread > 0) - extract_oops(buffer, nread, issyslog); + if (ret > 0) + extract_oops(buffer, buflen-1, issyslog); free(buffer); if (opted_in >= 2) submit_queue(); diff -Nru kerneloops-0.12+git20090217/kerneloops-applet.c kerneloops-0.12+git20090217/kerneloops-applet.c --- kerneloops-0.12+git20090217/kerneloops-applet.c 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops-applet.c 2009-04-23 16:30:11.000000000 +0200 @@ -140,48 +140,58 @@ gtk_widget_destroy(dialog); } -static GtkWidget *create_detail_textview(void) + +/* Called only to display details */ +static void detail_action(NotifyNotification __unused *notify, + gchar __unused *action, gpointer __unused user_data) { - GtkWidget *sw; + GtkWidget *dialog; + GtkWidget *scrollwindow; GtkWidget *view; GtkTextBuffer *buffer; GtkWidget *button_cancel; GtkWidget *button_send; GtkTextTag *fixed; GtkTextIter iter; - struct stat statb; char *detail_data; + struct stat statb; int detail_fd; int ret; + /* If anything goes wrong, return as early as possible... */ + if (!detail_file_name) - return NULL; + return; - memset(&statb, 0, sizeof(statb)); + memset(&statb, 0, sizeof(statb)); ret = stat(detail_file_name, &statb); if (statb.st_size < 1 || ret != 0) - return NULL; + return; detail_fd = open(detail_file_name, O_RDONLY); if (detail_fd < 0) - return NULL; + return; - detail_data = malloc(statb.st_size + 1); + detail_data = malloc(statb.st_size+1); if (!detail_data) - return NULL; + return; if (read(detail_fd, detail_data, statb.st_size) != statb.st_size) { free(detail_data); - return NULL; + return; } close(detail_fd); detail_data[statb.st_size] = '\0'; - /* Scrolled window */ - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (sw), + dialog = gtk_dialog_new(); + gtk_window_set_title(GTK_WINDOW(dialog), _("Kernel failure details")); + gtk_widget_set_size_request(dialog, 600, 400); + scrollwindow = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrollwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), scrollwindow, + TRUE, TRUE, 0); view = gtk_text_view_new(); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view)); fixed = gtk_text_buffer_create_tag (buffer, "font", "font", "monospace", NULL); @@ -189,29 +199,9 @@ gtk_text_buffer_insert_with_tags(buffer, &iter, detail_data, -1, fixed, NULL); free(detail_data); - gtk_container_add (GTK_CONTAINER (sw), view); + gtk_container_add (GTK_CONTAINER (scrollwindow), view); gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE); - - return sw; -} - -/* Called only to display details */ -static void detail_action(NotifyNotification __unused *notify, - gchar __unused *action, gpointer __unused user_data) -{ - GtkWidget *dialog; - GtkWidget *sw; - GtkWidget *button_cancel; - GtkWidget *button_send; - - dialog = gtk_dialog_new(); - gtk_window_set_title(GTK_WINDOW(dialog), _("Kernel failure details")); - gtk_widget_set_size_request(dialog, 600, 400); - sw = create_detail_textview (); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), sw, - TRUE, TRUE, 0); - button_send = gtk_button_new_with_label (_("Send")); GTK_WIDGET_SET_FLAGS(button_send, GTK_CAN_DEFAULT); button_cancel = gtk_button_new_with_label (_("Cancel")); @@ -230,143 +220,55 @@ button_cancel, TRUE, TRUE, 0); gtk_widget_grab_default(button_send); - gtk_widget_show_all(dialog); -} - -static gboolean can_support_actions (void) -{ - static gboolean supports_actions = FALSE; - static gboolean have_checked = FALSE; - - if (!have_checked) { - GList *caps = NULL; - GList *c; - - have_checked = TRUE; - - caps = notify_get_server_caps(); - if (caps != NULL) { - for (c = caps; c != NULL; c = c->next) { - if (strcmp ((char*)c->data, "actions") == 0) { - supports_actions = TRUE; - break; - } - } - } - - g_list_foreach (caps, (GFunc)g_free, NULL); - g_list_free (caps); - } - - return supports_actions; + gtk_widget_show(view); + gtk_widget_show(button_send); + gtk_widget_show(button_cancel); + gtk_widget_show(scrollwindow); + gtk_widget_show(dialog); } static void got_a_message(void) { char *summary = _("Your system had a kernel failure"); - char *message; - - if (can_support_actions ()) { - NotifyActionCallback callback = notify_action; + char *message = + _("There is diagnostic information available for this failure." + " Do you want to submit this information to the www.kerneloops.org" + " website for use by the Linux kernel developers?\n"); - message = - _("There is diagnostic information available for this failure." - " Do you want to submit this information to the www.kerneloops.org" - " website for use by the Linux kernel developers?\n"); - - /* if there's a notification active already, close it first */ - close_notification(); - - notify = notify_notification_new(summary, message, - "/usr/share/kerneloops/icon.png"); + NotifyActionCallback callback = notify_action; - notify_notification_set_timeout(notify, 0); - notify_notification_set_urgency(notify, NOTIFY_URGENCY_CRITICAL); + /* if there's a notification active already, close it first */ + close_notification(); + notify = notify_notification_new(summary, message, + "/usr/share/kerneloops/icon.png", NULL); - /* - * add the buttons and default action - */ + notify_notification_set_timeout(notify, 0); + notify_notification_set_urgency(notify, NOTIFY_URGENCY_CRITICAL); - notify_notification_add_action(notify, "default", "action", - callback, "default", NULL); - notify_notification_add_action(notify, "always", _("Always"), - callback, "always", NULL); - notify_notification_add_action(notify, "never", _("Never"), - callback, "never", NULL); - notify_notification_add_action(notify, "no", _("Don't Send"), - callback, "no", NULL); - notify_notification_add_action(notify, "yes", _("Send"), - callback, "yes", NULL); - if (detail_file_name) { - notify_notification_add_action(notify, - "details", _("Show Details"), - detail_action, "details", NULL); - } - - notify_notification_show(notify, NULL); - } else { - GtkWidget *dialog; - GtkWidget *image; - GtkWidget *expander; - GtkWidget *details; - GtkWidget *content_area; - gint response; - - message = - _("Information about a kernel failure on this computer" - " can be sent to kerneloops.org to help improve Linux." - " Do you want to send this information?"); - - dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_OTHER, - GTK_BUTTONS_NONE, NULL); - gtk_window_set_title (GTK_WINDOW (dialog), _("Kernel Failure")); - gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); - gtk_window_set_icon (GTK_WINDOW (dialog), NULL); - gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), message); - - image = gtk_image_new_from_file ("/usr/share/kerneloops/icon.png"); - - if (image) - gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image); - - expander = gtk_expander_new_with_mnemonic (_("Details")); - - details = create_detail_textview (); - gtk_container_add (GTK_CONTAINER (expander), details); - - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_box_pack_end (GTK_BOX (content_area), expander, TRUE, TRUE, 0); - - gtk_widget_show_all (content_area); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - _("Always"), GTK_RESPONSE_ACCEPT, - _("Never"), GTK_RESPONSE_REJECT, - _("Don't Send"), GTK_RESPONSE_NO, - _("Send"), GTK_RESPONSE_YES, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (dialog), - GTK_RESPONSE_YES); - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - switch (response) { - case GTK_RESPONSE_ACCEPT: - notify_action (NULL, NULL, "always"); - break; - case GTK_RESPONSE_REJECT: - notify_action (NULL, NULL, "never"); - break; - case GTK_RESPONSE_NO: - notify_action (NULL, NULL, "no"); - break; - case GTK_RESPONSE_YES: - notify_action (NULL, NULL, "yes"); - break; - } - gtk_widget_hide (dialog); + /* + * add the buttons and default action + */ + + notify_notification_add_action(notify, "default", "action", + callback, "default", NULL); + + notify_notification_add_action(notify, "always", _("Always"), + callback, "always", NULL); + notify_notification_add_action(notify, "yes", _("Yes"), + callback, "yes", NULL); + notify_notification_add_action(notify, "no", _("No"), + callback, "no", NULL); + notify_notification_add_action(notify, "never", _("Never"), + callback, "never", NULL); + if (detail_file_name) { + notify_notification_add_action(notify, + "details", _("Show Details"), + detail_action, "details", NULL); } + + notify_notification_show(notify, NULL); } char url_to_oops[4095]; @@ -405,21 +307,20 @@ url_to_oops[0] = 0; notify = notify_notification_new(summary, message, - "/usr/share/kerneloops/icon.png"); + "/usr/share/kerneloops/icon.png", NULL); notify_notification_set_timeout(notify, 5000); notify_notification_set_urgency(notify, NOTIFY_URGENCY_LOW); - if (can_support_actions ()) { - notify_notification_add_action(notify, "default", "action", - callback, "default", NULL); - - if (user_preference <= 0) - notify_notification_add_action(notify, "always", _("Always"), - callback, "always", NULL); - notify_notification_add_action(notify, "never", _("Never again"), - callback, "never", NULL); - } + + notify_notification_add_action(notify, "default", "action", + callback, "default", NULL); + + if (user_preference <= 0) + notify_notification_add_action(notify, "always", _("Always"), + callback, "always", NULL); + notify_notification_add_action(notify, "never", _("Never again"), + callback, "never", NULL); notify_notification_show(notify, NULL); g_free(message); diff -Nru kerneloops-0.12+git20090217/kerneloops.c kerneloops-0.12+git20090217/kerneloops.c --- kerneloops-0.12+git20090217/kerneloops.c 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops.c 2009-04-23 16:30:11.000000000 +0200 @@ -24,10 +24,10 @@ #include #include -#include #include #include #include +#include #include #include @@ -119,6 +119,7 @@ dbus_message_append_args (message, DBUS_TYPE_STRING, &url, DBUS_TYPE_INVALID); dbus_connection_send(bus, message, NULL); dbus_message_unref(message); + syslog(LOG_WARNING, "kerneloops.org: oops is posted as %s", url); } message = dbus_message_new_signal("/org/kerneloops/submit/sent", @@ -184,13 +185,12 @@ dbus_connection_add_filter(bus, got_message, NULL, NULL); } + /* we scan dmesg before /var/log/messages; dmesg is a more accurate source normally */ + scan_dmesg(NULL); /* during boot... don't go too fast and slow the system down */ if (!testmode) sleep(10); - /* we scan dmesg before /var/log/messages; dmesg is a more accurate source normally */ - scan_dmesg(NULL); - /* Can cause an OOPS to be reported multiple times LP: #429000 */ - /* scan_filename(log_file, 1); */ + scan_filename(log_file, 1); if (argc > 2 && strstr(argv[1], "--file")) scan_filename(argv[2], 1); diff -Nru kerneloops-0.12+git20090217/kerneloops.conf kerneloops-0.12+git20090217/kerneloops.conf --- kerneloops-0.12+git20090217/kerneloops.conf 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops.conf 2009-04-23 16:30:11.000000000 +0200 @@ -37,10 +37,5 @@ # # Path to syslog file containing full kernel logging output # -log-file = /var/log/kern.log -# -# Script or program to pipe oops submits to -# Comment out for no pipe submission -# -submit-pipe = /usr/share/apport/kernel_oops +log-file = /var/log/messages diff -Nru kerneloops-0.12+git20090217/kerneloops.dbus kerneloops-0.12+git20090217/kerneloops.dbus --- kerneloops-0.12+git20090217/kerneloops.dbus 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops.dbus 2009-04-23 16:30:11.000000000 +0200 @@ -7,7 +7,7 @@ - + diff -Nru kerneloops-0.12+git20090217/kerneloops.h kerneloops-0.12+git20090217/kerneloops.h --- kerneloops-0.12+git20090217/kerneloops.h 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops.h 2009-04-23 16:30:11.000000000 +0200 @@ -45,7 +45,6 @@ extern int opted_in; extern int allow_distro_to_pass_on; extern char *submit_url; -extern char *submit_pipe; extern char *log_file; extern int testmode; diff -Nru kerneloops-0.12+git20090217/kerneloops.init kerneloops-0.12+git20090217/kerneloops.init --- kerneloops-0.12+git20090217/kerneloops.init 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops.init 2009-04-23 16:30:11.000000000 +0200 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # kerneloops # @@ -11,8 +11,8 @@ # ### BEGIN INIT INFO # Provides: kerneloops -# Default-Start: 2 3 4 5 -# Default-Stop: 1 +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 # Required-Start: $local_fs $remote_fs $named $network $time $syslog # Required-Stop: $local_fs $remote_fs $syslog # Short-Description: Tool to automatically collect and submit kernel crash signatures @@ -22,37 +22,31 @@ ### END INIT INFO # Source function library. -. /lib/lsb/init-functions +. /etc/rc.d/init.d/functions exec="/usr/sbin/kerneloops" prog=$(basename $exec) -service="Kernel Oops catching service" -pidfile=/var/run/$prog.pid sconf="/etc/kerneloops.conf" -enabled=1 +lockfile=/var/lock/subsys/$prog -[ -x "$exec" ] || exit 0 - -[ -e /etc/default/$prog ] && . /etc/default/$prog - -[ "$enabled" = "1" ] || exit 0 +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog start() { - log_daemon_msg "Starting $service" "$prog" - start-stop-daemon --start --quiet --oknodo --chuid kernoops:adm --pidfile $pidfile --exec $exec + echo -n $"Starting $prog:" + daemon $prog $OPTS retval=$? - pidof -s kerneloops > $pidfile - log_end_msg "$retval" + echo + [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { - log_daemon_msg "Stopping $service" "$prog" - start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile + echo -n $"Stopping $prog: " + killproc $prog retval=$? - rm -f $pidfile - log_end_msg "$retval" + echo + [ $retval -eq 0 ] && rm -f $lockfile return $retval } @@ -70,7 +64,7 @@ } fdr_status() { - status_of_proc -p $pidfile $prog "$service" + status $prog } @@ -85,7 +79,7 @@ fdr_status ;; condrestart|try-restart) - pidof kerneloops >/dev/null || restart + [ -f $lockfile ] || restart ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}" diff -Nru kerneloops-0.12+git20090217/kerneloops-submit.c kerneloops-0.12+git20090217/kerneloops-submit.c --- kerneloops-0.12+git20090217/kerneloops-submit.c 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/kerneloops-submit.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,121 +0,0 @@ -/* - * Copyright 2007, Intel Corporation - * - * This file is part of kerneloops.org - * - * This program file is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program in a file named COPYING; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * Authors: - * Arjan van de Ven - * James Westby - */ - -#include -#include -#include -#include -#include -#include - -#include "kerneloops.h" - - -static void write_logfile(int count, char *result_url) -{ - openlog("kerneloops-submit", 0, LOG_KERN); - syslog(LOG_WARNING, "Submitted %i kernel oopses to www.kerneloops.org", count); - if (result_url && result_url[0]) - syslog(LOG_WARNING, "kerneloops.org: oops is posted as %s", result_url); - closelog(); -} - -static char result_url[4096]; - -static size_t writefunction( void *ptr, size_t size, size_t nmemb, void __attribute((unused)) *stream) -{ - char *c, *c1, *c2; - c = malloc(size*nmemb + 1); - memset(c, 0, size*nmemb + 1); - memcpy(c, ptr, size*nmemb); - c1 = strstr(c, "201 "); - if (c1) { - c1+=4; - c2 = strchr(c1, '\n'); - if (c2) *c2 = 0; - strncpy(result_url, c1, 4095); - } - return size * nmemb; -} - -void submit_oops(char *text) -{ - int result; - CURL *handle; - struct curl_httppost *post = NULL; - struct curl_httppost *last = NULL; - - handle = curl_easy_init(); - - curl_easy_setopt(handle, CURLOPT_URL, submit_url); - - /* set up the POST data */ - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "oopsdata", - CURLFORM_COPYCONTENTS, text, CURLFORM_END); - - if (allow_distro_to_pass_on) { - curl_formadd(&post, &last, - CURLFORM_COPYNAME, "pass_on_allowed", - CURLFORM_COPYCONTENTS, "yes", CURLFORM_END); - } - - curl_easy_setopt(handle, CURLOPT_HTTPPOST, post); - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction); - result = curl_easy_perform(handle); - - write_logfile(1, result_url); - - if (result_url) - printf("%s\n", result_url); - - curl_formfree(post); - curl_easy_cleanup(handle); -} - -int main(int __unused argc, char __unused **argv) -{ - char text[10000]; - size_t resp; - char *buf = text; - size_t to_read = 10000; - - while (!feof(stdin) && !ferror(stdin)) { - resp = fread(buf, 1, to_read, stdin); - buf = buf + resp; - to_read = to_read - resp; - } - - if (ferror(stdin)) { - write_logfile(1, "ferror(stdin)\n"); - return 1; - } - - read_config_file("/etc/kerneloops.conf"); - - submit_oops(text); - - return 0; -} diff -Nru kerneloops-0.12+git20090217/Makefile kerneloops-0.12+git20090217/Makefile --- kerneloops-0.12+git20090217/Makefile 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/Makefile 2009-04-23 16:30:11.000000000 +0200 @@ -12,16 +12,16 @@ CFLAGS := -O2 -g -fstack-protector -D_FORTIFY_SOURCE=2 -Wall -W -Wstrict-prototypes -Wundef -fno-common -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wformat -Wformat-security -Werror=format-security -MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0 dbus-glib-1` +MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0` # # pkg-config tends to make programs pull in a ton of libraries, not all # are needed. -Wl,--as-needed tells the linker to just drop unused ones, # and that makes the applet load faster and use less memory. # -LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0 dbus-glib-1` +LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0` LDF_D := -Wl,--as-needed `pkg-config --libs glib-2.0 dbus-glib-1` `curl-config --libs` -Wl,"-z relro" -Wl,"-z now" -all: kerneloops kerneloops-applet kerneloops-submit kerneloops.8.gz +all: kerneloops kerneloops-applet kerneloops.8.gz noui: kerneloops kerneloops.8.gz @@ -36,14 +36,11 @@ kerneloops-applet: kerneloops-applet.o gcc kerneloops-applet.o $(LDF_A)-o kerneloops-applet -kerneloops-submit: kerneloops-submit.o configfile.o - gcc kerneloops-submit.o configfile.o $(LDF_D) -o kerneloops-submit - kerneloops.8.gz: kerneloops.8 gzip -9 -c $< > $@ clean: - rm -f *~ *.o *.ko DEADJOE kerneloops kerneloops-applet *.out */*~ kerneloops.8.gz test/*.dbg + rm -f *~ *.o *.ko DEADJOE kerneloops kerneloops-applet *.out */*~ kerneloops.8.gz @(cd po/ && $(MAKE) $@) dist: clean @@ -61,10 +58,6 @@ -mkdir -p $(DESTDIR)$(SBINDIR) install -m 0755 kerneloops $(DESTDIR)$(SBINDIR)/ -install-kerneloops-submit: kerneloops-submit - -mkdir -p $(DESTDIR)$(BINDIR) - install -m 0755 kerneloops-submit $(DESTDIR)$(BINDIR)/ - install-applet: kerneloops-applet -mkdir -p $(DESTDIR)$(BINDIR) -mkdir -p $(DESTDIR)/etc/xdg/autostart @@ -73,9 +66,9 @@ desktop-file-install --mode 0644 --dir=$(DESTDIR)/etc/xdg/autostart/ kerneloops-applet.desktop install -m 0644 icon.png $(DESTDIR)/usr/share/kerneloops/icon.png -install: install-system install-kerneloops install-kerneloops-submit install-applet +install: install-system install-kerneloops install-applet -install-noui: install-system install-kerneloops install-kerneloops-submit +install-noui: install-system install-kerneloops # This is for translators. To update your po with new strings, do : diff -Nru kerneloops-0.12+git20090217/po/de.po kerneloops-0.12+git20090217/po/de.po --- kerneloops-0.12+git20090217/po/de.po 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/po/de.po 1970-01-01 01:00:00.000000000 +0100 @@ -1,77 +0,0 @@ -# translation of kerneloops to German -# Copyright (C) Chris Leick , 2009. -# This file is distributed under the same license as the kerneloops package. -# Chris Leick , 2009. -# -msgid "" -msgstr "" -"Project-Id-Version: kerneloops-0.10.2\n" -"Report-Msgid-Bugs-To: willy@debian.org\n" -"POT-Creation-Date: 2009-02-22 11:49+0100\n" -"PO-Revision-Date: 2009-03-16 13:05+0100\n" -"Last-Translator: Chris Leick \n" -"Language-Team: German \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: kerneloops-applet.c:170 kerneloops-applet.c:212 -msgid "Always" -msgstr "Immer" - -#: kerneloops-applet.c:332 -#, c-format -msgid "Connecting to system bus failed: %s\n" -msgstr "Verbinden zum System-Bus fehlgeschlagen: %s\n" - -#: kerneloops-applet.c:190 -msgid "" -"Diagnostic information from your Linux kernel has been sent to www.kerneloops.org for the Linux kernel " -"developers to work on. \n" -"Thank you for contributing to improve the quality of the Linux kernel.\n" -msgstr "" -"Diagnose-Information von Ihrem Linux-Kernel wurde an www.kerneloops.org gesandt, damit die " -"Kernel-Entwickler daran arbeiten können.\n" -"Vielen Dank, dass Sie zur Verbesserung des Linux-Kernels beitragen.\n" - -#: kerneloops-applet.c:188 -msgid "Kernel bug diagnostic information sent" -msgstr "Gesendete Kernel-Fehler-Diagnose-Information" - -#: kerneloops-applet.c:176 -msgid "Never" -msgstr "Niemals" - -#: kerneloops-applet.c:214 -msgid "Never again" -msgstr "Niemals wieder" - -#: kerneloops-applet.c:174 -msgid "No" -msgstr "Nein" - -#: kerneloops-applet.c:143 -msgid "" -"There is diagnostic information available for this failure. Do you want to " -"submit this information to the www." -"kerneloops.org website for use by the Linux kernel developers?\n" -msgstr "" -"Es sind dort Diagnose-Informationen für diesen Ausfall verfügbar. Möchten " -"Sie diese Information zu der www." -"kerneloops.org-Website für die Benutzung durch die " -"Linux-Kernel-Entwickler senden?\n" - -#: kerneloops-applet.c:172 -msgid "Yes" -msgstr "Ja" - -#: kerneloops-applet.c:141 -msgid "Your system had a kernel failure" -msgstr "Ihr System hatte einen Kernel-Ausfall" - -#: kerneloops-applet.c:343 -msgid "kerneloops client" -msgstr "kerneloops-Client" diff -Nru kerneloops-0.12+git20090217/po/fi.po kerneloops-0.12+git20090217/po/fi.po --- kerneloops-0.12+git20090217/po/fi.po 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/po/fi.po 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -# Finnish translation of kerneloops. -# Copyright (C) kerneloops' COPYRIGHT HOLDER -# This file is distributed under the same license as the kerneloops package. -# Ville-Pekka Vainio , 2009 -msgid "" -msgstr "" -"Project-Id-Version: kerneloops git\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-01-01 06:36-0800\n" -"PO-Revision-Date: 2009-04-11 01:24+0300\n" -"Last-Translator: Ville-Pekka Vainio \n" -"Language-Team: Finnish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: kerneloops-applet.c:170 kerneloops-applet.c:212 -msgid "Always" -msgstr "Aina" - -#: kerneloops-applet.c:332 -#, c-format -msgid "Connecting to system bus failed: %s\n" -msgstr "Järjestelmäväylään yhdistäminen epäonnistui: %s\n" - -#: kerneloops-applet.c:190 -msgid "" -"Diagnostic information from your Linux kernel has been sent to www.kerneloops.org for the Linux kernel " -"developers to work on. \n" -"Thank you for contributing to improve the quality of the Linux kernel.\n" -msgstr "" -"Linux-ytimen vianmääritystiedot on lähetetty osoitteeseen www.kerneloops.org ytimen kehittäjien " -"käytettäväksi. Kiitos osallistumisestasi Linux-ytimen laadun parantamiseen.\n" - -#: kerneloops-applet.c:188 -msgid "Kernel bug diagnostic information sent" -msgstr "Ytimen vianmääritystiedot on lähetetty" - -#: kerneloops-applet.c:176 -msgid "Never" -msgstr "Ei koskaan" - -#: kerneloops-applet.c:214 -msgid "Never again" -msgstr "Ei enää koskaan" - -#: kerneloops-applet.c:174 -msgid "No" -msgstr "Ei" - -#: kerneloops-applet.c:143 -msgid "" -"There is diagnostic information available for this failure. Do you want to " -"submit this information to the www." -"kerneloops.org website for use by the Linux kernel developers?\n" -msgstr "" -"Tästä viasta on saatavilla vianmääritystietoja. Haluatko lähettää nämä " -"tiedot www.kerneloops.org-sivustolle Linux-" -"ytimen kehittäjien käytettäväksi?\n" - -#: kerneloops-applet.c:172 -msgid "Yes" -msgstr "Kyllä" - -#: kerneloops-applet.c:141 -msgid "Your system had a kernel failure" -msgstr "Järjestelmän ytimessä on toimintahäiriö" - -#: kerneloops-applet.c:343 -msgid "kerneloops client" -msgstr "kerneloops-asiakasohjelma" diff -Nru kerneloops-0.12+git20090217/submit.c kerneloops-0.12+git20090217/submit.c --- kerneloops-0.12+git20090217/submit.c 2012-01-13 12:53:38.000000000 +0100 +++ kerneloops-0.12+git20090217/submit.c 2009-04-23 16:30:11.000000000 +0200 @@ -25,16 +25,15 @@ #define _BSD_SOURCE #include #include -#include #include -#include #include #include #include -#include #include +#include + #include "kerneloops.h" @@ -85,48 +84,6 @@ return temp; } -/* Pipe the oops into another program for submission - * to other reporting data sinks. - * Silently return if the pipe executable/script is not - * there. This allows for safe removal of the other package - * without major panic attacks and log file chatter. - */ -static void pipe_oops(char *oops) { - FILE *pipe_file = NULL; - int err; - size_t wrote; - - if (submit_pipe && access(submit_pipe, X_OK) == 0) - ; - else - return; - - openlog("kerneloops", 0, LOG_KERN); - pipe_file = popen(submit_pipe, "w"); - if (pipe_file) { - wrote = fwrite(oops, 1, strlen(oops), pipe_file); - if (wrote == strlen(oops)) { - syslog(LOG_INFO, - "Wrote %d bytes of oops log to %s", wrote, submit_pipe); - } else { - syslog(LOG_ERR, - "Write to %s failed: %s\n", submit_pipe, - ferror(pipe_file) ? strerror(errno) : "short write"); - } - err = pclose(pipe_file); - if (err != 0) { - syslog(LOG_ERR, - "Close of pipe to %s failed: %s\n", submit_pipe, - err < 0 ? strerror(errno) : "non-zero exit from child"); - } - } else { - syslog(LOG_WARNING, - "popen to %s failed: %s\n", - submit_pipe, strerror(errno)); - } - closelog(); -} - void queue_oops(char *oops) { int i; @@ -155,7 +112,7 @@ } -static void write_detail_file(void) +void write_detail_file(void) { int temp_fileno; FILE *tmpf; @@ -186,75 +143,14 @@ close(temp_fileno); } -static void unlink_detail_file(void) +void unlink_detail_file(void) { if (detail_filename) { unlink(detail_filename); free(detail_filename); - detail_filename = NULL; } } -static void pipe_oopses(void) -{ - struct oops *oops; - struct oops *queue; - - if (access(submit_pipe, X_OK) != 0) { - printf("Cant access %s, not submitting oopses\n", submit_pipe); - return; - } - - queue = queued_oopses; - queued_oopses = NULL; - barrier(); - oops = queue; - while (oops) { - FILE *pipe_file; - int len; - char pipe[4096]; - - if (strstr(oops->text, "WARNING:")) - return; - - if (strstr(oops->text, "NETDEV WATCHDOG:")) - return; - - len = snprintf(pipe, 4096, "%s %d", submit_pipe, oops->checksum); - if (len > 4096) { - printf("Pipe name too long, aborting\n"); - return; - } - - pipe_file = popen(pipe, "w"); - if (pipe_file) { - size_t written = 0; - int err; - char *buf = oops->text; - size_t to_write = strlen(oops->text); - - do { - written = fwrite(buf, 1, to_write, pipe_file); - if (written == to_write) - break; - buf += written; - to_write -= written; - } while (errno == EINTR); - if (written < to_write) { - perror("aborting, writing to pipe failed"); - } - - err = pclose(pipe_file); - if (err != 0) - perror("closing pipe failed"); - } else { - perror("aborting, popen failed"); - return; - } - - oops = oops->next; - } -} static void print_queue(void) { @@ -279,95 +175,39 @@ } -static void write_logfile(int count, char *result_url) +static void write_logfile(int count) { openlog("kerneloops", 0, LOG_KERN); syslog(LOG_WARNING, "Submitted %i kernel oopses to www.kerneloops.org", count); - if (result_url && result_url[0]) - syslog(LOG_WARNING, "kerneloops.org: oops is posted as %s", result_url); closelog(); } -static char result_url[4096]; +char result_url[4096]; -int submit_oops(struct oops *oops) +size_t writefunction( void *ptr, size_t size, size_t nmemb, void __attribute((unused)) *stream) { - char *submit_prog = "kerneloops-submit"; - int in_pipe[2]; - int out_pipe[2]; - int pid; - - if (pipe(in_pipe)) { - perror("pipe"); - return 1; - } - - if (pipe(out_pipe)){ - perror("pipe"); - return 1; - } - - pid = fork(); - if (pid < 0) { - perror("fork"); - } else if (pid == 0) { - //child - close(in_pipe[1]); - close(out_pipe[0]); - dup2(in_pipe[0], 0); - dup2(out_pipe[1], 1); - if (execvp(submit_prog, NULL)) { - perror("execl"); - exit(255); - } - exit(0); - } else { - // parent - size_t written = 0; - char *buf = oops->text; - size_t to_write = strlen(oops->text); - int status; - ssize_t count; - char url[4096]; - close(in_pipe[0]); - close(out_pipe[1]); - do { - written = write(in_pipe[1], buf, to_write); - if (written == to_write) - break; - buf += written; - to_write -= written; - } while (errno == EINTR); - if (written < to_write) { - perror("aborting, writing to pipe failed"); - return 1; - } - close(in_pipe[1]); - waitpid(pid, &status, 0); - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - perror("child failed"); - close(out_pipe[0]); - return 1; - } - count = read(out_pipe[0], url, 4095); - if (count < 0) { - perror("read from child"); - return 1; - } - close(out_pipe[0]); - printf("url is %s\n", url); - strncpy(result_url, url, 4095); + char *c, *c1, *c2; + c = malloc(size*nmemb + 1); + memset(c, 0, size*nmemb + 1); + memcpy(c, ptr, size*nmemb); + printf("received %s \n", c); + c1 = strstr(c, "201 "); + if (c1) { + c1+=4; + c2 = strchr(c1, '\n'); + if (c2) *c2 = 0; + strncpy(result_url, c1, 4095); } - return 0; + return size * nmemb; } void submit_queue(void) { + int result; struct oops *oops; struct oops *queue; int count = 0; - unlink_detail_file(); memset(result_url, 0, 4096); if (testmode) { @@ -380,19 +220,42 @@ barrier(); oops = queue; while (oops) { - int err; + CURL *handle; + struct curl_httppost *post = NULL; + struct curl_httppost *last = NULL; struct oops *next; - err = submit_oops(oops); + + handle = curl_easy_init(); + + printf("DEBUG SUBMIT URL is %s \n", submit_url); + curl_easy_setopt(handle, CURLOPT_URL, submit_url); + + /* set up the POST data */ + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "oopsdata", + CURLFORM_COPYCONTENTS, oops->text, CURLFORM_END); + + if (allow_distro_to_pass_on) { + curl_formadd(&post, &last, + CURLFORM_COPYNAME, "pass_on_allowed", + CURLFORM_COPYCONTENTS, "yes", CURLFORM_END); + } + + curl_easy_setopt(handle, CURLOPT_HTTPPOST, post); + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction); + result = curl_easy_perform(handle); + + curl_formfree(post); + curl_easy_cleanup(handle); next = oops->next; free(oops->text); free(oops); oops = next; - if (!err) - count++; + count++; } if (count && !testmode) - write_logfile(count, result_url); + write_logfile(count); if (count) dbus_say_thanks(result_url); @@ -400,8 +263,10 @@ * If we've reached the maximum count, we'll exit the program, * the program won't do any useful work anymore going forward. */ - if (submitted >= MAX_CHECKSUMS-1) + if (submitted >= MAX_CHECKSUMS-1) { + unlink_detail_file(); exit(EXIT_SUCCESS); + } } void clear_queue(void) @@ -419,26 +284,17 @@ free(oops); oops = next; } - unlink_detail_file(); - write_logfile(0, NULL); + write_logfile(0); } void ask_permission(void) { - if (!newoops) + if (!newoops && !pinged) return; - if (!submit_pipe) { - if (!pinged) - return; - pinged = 0; - newoops = 0; - if (queued_oopses) { - write_detail_file(); - dbus_ask_permission(detail_filename); - } - } else { - if (queued_oopses) { - pipe_oopses(); - } + pinged = 0; + newoops = 0; + if (queued_oopses) { + write_detail_file(); + dbus_ask_permission(detail_filename); } }