Hello community,
here is the log from the commit of package kerneloops
checked in at Fri Aug 8 23:49:52 CEST 2008.
--------
--- kerneloops/kerneloops.changes 2008-04-25 01:39:20.000000000 +0200
+++ /mounts/work_src_done/STABLE/kerneloops/kerneloops.changes 2008-08-08 20:04:16.812997000 +0200
@@ -1,0 +2,17 @@
+Fri Aug 8 20:01:16 CEST 2008 - bphilips@suse.de
+
+- update to version 0.12
+ * Add a "Show me my oops before submit" button.
+ * If you have an incredibly large log file.. kerneloops takes too long.
+ Just parse the last 32Mb instead, should be plenty.
+ * Don't delay for non-dmesg oopses. Apparently some people have really
+ large logfiles and this causes major delays.
+ * one more "start of oops" string
+ * Detect RTLN assertions (networking) as well
+ * 2 more ident strings to get more useful list corruption messages
+ * add a --file option
+ * Pass $OPTS to kerneloops from /etc/sysconfig/kerneloops.
+ * Print a URL to the submitted oops in the thank you screen
+
+
+-------------------------------------------------------------------
Old:
----
kerneloops-0.11.tar.bz2
New:
----
0001-Fix-up-some-weird-git-damage.patch
0002-kerneloops-applet-fix-string-handling-make-window.patch
0003-kerneloops-applet-use-monospace-fonts-in-detail-vie.patch
0004-kerneloops-applet-Fix-Gtk-WARNING-gtkwidget.c-5.patch
kerneloops-0.12.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ kerneloops.spec ++++++
--- /var/tmp/diff_new_pack.Z21087/_old 2008-08-08 23:49:42.000000000 +0200
+++ /var/tmp/diff_new_pack.Z21087/_new 2008-08-08 23:49:42.000000000 +0200
@@ -1,10 +1,17 @@
#
-# spec file for package kerneloops (Version 0.11)
+# spec file for package kerneloops (Version 0.12)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
-# This file and all modifications and additions to the pristine
-# package are under the same license as the package itself.
#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
@@ -13,7 +20,7 @@
Url: http://www.kerneloops.org/
Name: kerneloops
-Version: 0.11
+Version: 0.12
Release: 1
License: GPL v2 only
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -22,6 +29,10 @@
Summary: Tool to collect kernel oopses and submit them to kerneloops.org
Source: %{name}-%{version}.tar.bz2
Source1: %{name}.init
+Patch: 0001-Fix-up-some-weird-git-damage.patch
+Patch1: 0002-kerneloops-applet-fix-string-handling-make-window.patch
+Patch2: 0003-kerneloops-applet-use-monospace-fonts-in-detail-vie.patch
+Patch3: 0004-kerneloops-applet-Fix-Gtk-WARNING-gtkwidget.c-5.patch
PreReq: %insserv_prereq
%description
@@ -70,6 +81,10 @@
%prep
%setup -q
+%patch -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
%{__make}
@@ -112,6 +127,19 @@
%{_datadir}/%{name}/icon.png
%changelog
+* Fri Aug 08 2008 bphilips@suse.de
+- update to version 0.12
+ * Add a "Show me my oops before submit" button.
+ * If you have an incredibly large log file.. kerneloops takes too long.
+ Just parse the last 32Mb instead, should be plenty.
+ * Don't delay for non-dmesg oopses. Apparently some people have really
+ large logfiles and this causes major delays.
+ * one more "start of oops" string
+ * Detect RTLN assertions (networking) as well
+ * 2 more ident strings to get more useful list corruption messages
+ * add a --file option
+ * Pass $OPTS to kerneloops from /etc/sysconfig/kerneloops.
+ * Print a URL to the submitted oops in the thank you screen
* Fri Apr 25 2008 crrodriguez@suse.de
- update to version 0.11
* Improve the makefile (GregKH)
++++++ 0001-Fix-up-some-weird-git-damage.patch ++++++
From 85476aba715c47b61a5fc38dd7cb32c10223a2a4 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven
Date: Tue, 24 Jun 2008 22:12:27 -0700
Subject: [PATCH] Fix up some weird git damage
---
dmesg.c | 26 ++++++++++++++++++--------
kerneloops-applet.c | 40 +++++++++++++++++++++++++++++++++++++++-
kerneloops.8 | 3 +++
kerneloops.c | 15 ++++++++++++++-
kerneloops.dbus | 2 ++
kerneloops.h | 2 +-
kerneloops.init | 2 +-
submit.c | 27 +++++++++++++++++++++++++--
8 files changed, 103 insertions(+), 14 deletions(-)
diff --git a/dmesg.c b/dmesg.c
index cbea8c2..301584e 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
/*
* Copyright 2007, Intel Corporation
*
@@ -54,20 +55,25 @@ static void fill_linepointers(char *buffer, int remove_syslog)
linecount = 0;
c = buffer;
while (c) {
+ int len = 0;
+ char *c9;
+
+ 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;
- char *c3;
- c3 = strchr(c, '\n');
/* skip non-kernel lines */
- c2 = strstr(c, "kernel:");
- if (!c2 || (c2 > c3))
- c2 = strstr(c, "kerneloops:");
- if (!c2 || (c2 > c3)) {
- c2 = strchr(c, '\n');
+ c2 = memmem(c, len, "kernel:", 7);
+ if (!c2)
+ c2 = memmem(c, len, "kerneloops:", 11);
+ if (!c2) {
+ c2 = c9;
if (c2) {
- c = c2+1;
+ c = c2 + 1;
continue;
} else
break;
@@ -166,10 +172,14 @@ static void extract_oops(char *buffer, size_t buflen, int remove_syslog)
oopsstart = i;
if (strstr(c, "kernel BUG at"))
oopsstart = i;
+ if (strstr(c, "do_IRQ: stack overflow:"))
+ oopsstart = i;
if (strstr(c, "RTNL: assertion failed"))
oopsstart = i;
if (strstr(c, "Eeek! page_mapcount(page) went negative!"))
oopsstart = i;
+ if (strstr(c, "near stack overflow (cur:"))
+ oopsstart = i;
if (strstr(c, "double fault:"))
oopsstart = i;
if (strstr(c, "Badness at"))
diff --git a/kerneloops-applet.c b/kerneloops-applet.c
index a7b62a9..0497f9d 100644
--- a/kerneloops-applet.c
+++ b/kerneloops-applet.c
@@ -267,6 +267,8 @@ static void got_a_message(void)
notify_notification_show(notify, NULL);
}
+char url_to_oops[4095];
+
/*
* open a notification window (expires in 5 seconds) to say thank you
* to the user for his bug feedback.
@@ -274,15 +276,32 @@ static void got_a_message(void)
static void sent_an_oops(void)
{
char *summary = _("Kernel bug diagnostic information sent");
- char *message =
+ char message[8200];
+ char *message_1 =
_("Diagnostic information from your Linux kernel has been "
"sent to http://www.kerneloops.org\">www.kerneloops.org</a> "
"for the Linux kernel developers to work on. \n"
"Thank you for contributing to improve the quality of the Linux kernel.\n");
+
+ char *message_2 =
+ _("Diagnostic information from your Linux kernel has been "
+ "sent to http://www.kerneloops.org\">www.kerneloops.org</a> "
+ "for the Linux kernel developers to work on. \n"
+ "Thank you for contributing to improve the quality of the Linux kernel.\n"
+ "You can watch your submitted oops here</a>\n");
NotifyActionCallback callback = notify_action;
close_notification();
+
+ if (strlen(url_to_oops)==0)
+ sprintf(message, message_1);
+ else
+ sprintf(message, message_2, url_to_oops);
+
+
+ url_to_oops[0] = 0;
+
notify = notify_notification_new(summary, message,
"/usr/share/kerneloops/icon.png", NULL);
@@ -302,6 +321,17 @@ static void sent_an_oops(void)
notify_notification_show(notify, NULL);
}
+/*
+ * store the URL for the user
+ */
+static void got_an_url(DBusMessage *message)
+{
+ char *string = NULL;
+ dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &string, DBUS_TYPE_INVALID);
+ if (string)
+ strncpy(url_to_oops, string, 4095);
+
+}
/*
@@ -362,6 +392,13 @@ static DBusHandlerResult dbus_gotmessage(DBusConnection __unused *connection,
gtk_status_icon_set_visible(statusicon, FALSE);
return DBUS_HANDLER_RESULT_HANDLED;
}
+ /* check if it's the daemon that asks for permission */
+ if (dbus_message_is_signal(message,
+ "org.kerneloops.submit.url", "url")) {
+
+ got_an_url(message);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -439,6 +476,7 @@ int main(int argc, char *argv[])
/* set the dbus message to listen for */
dbus_bus_add_match(bus, "type='signal',interface='org.kerneloops.submit.permission'", &error);
dbus_bus_add_match(bus, "type='signal',interface='org.kerneloops.submit.sent'", &error);
+ dbus_bus_add_match(bus, "type='signal',interface='org.kerneloops.submit.url'", &error);
dbus_connection_add_filter(bus, dbus_gotmessage, NULL, NULL);
/*
diff --git a/kerneloops.8 b/kerneloops.8
index 1ca8a27..4a8aa3c 100644
--- a/kerneloops.8
+++ b/kerneloops.8
@@ -35,6 +35,9 @@ for statistical analysis and presentation to the Linux kernel developers.
.LP
.TP
+\fB\-\-file filename\fR
+Parse the file denoted with filename as if it were /var/log/messages
+.TP
\fB\-\-debug\fR
Enable debug mode
.TP
diff --git a/kerneloops.c b/kerneloops.c
index 23a4227..47ec535 100644
--- a/kerneloops.c
+++ b/kerneloops.c
@@ -106,11 +106,19 @@ void dbus_ask_permission(char * detail_file_name)
dbus_message_unref(message);
}
-void dbus_say_thanks(void)
+void dbus_say_thanks(char *url)
{
DBusMessage *message;
if (!bus)
return;
+ if (url && strlen(url)) {
+ message = dbus_message_new_signal("/org/kerneloops/submit/url",
+ "org.kerneloops.submit.url", "url");
+ dbus_message_append_args (message, DBUS_TYPE_STRING, &url, DBUS_TYPE_INVALID);
+ dbus_connection_send(bus, message, NULL);
+ dbus_message_unref(message);
+ }
+
message = dbus_message_new_signal("/org/kerneloops/submit/sent",
"org.kerneloops.submit.sent", "sent");
dbus_connection_send(bus, message, NULL);
@@ -169,9 +177,14 @@ int main(int argc, char**argv)
}
+
/* we scan dmesg before /var/log/messages; dmesg is a more accurate source normally */
scan_dmesg(NULL);
scan_filename("/var/log/messages", 1);
+
+ if (argc > 2 && strstr(argv[1], "--file"))
+ scan_filename(argv[2], 1);
+
if (testmode && argc > 2) {
int q;
for (q = 2; q < argc; q++) {
diff --git a/kerneloops.dbus b/kerneloops.dbus
index 7e05d8c..3aeef17 100644
--- a/kerneloops.dbus
+++ b/kerneloops.dbus
@@ -12,6 +12,7 @@
<allow own="org.kerneloops.submit.ping"/>
<allow own="org.kerneloops.submit.permission"/>
<allow own="org.kerneloops.submit.sent"/>
+ <allow own="org.kerneloops.submit.url"/>
</policy>
<policy at_console="true">
@@ -20,6 +21,7 @@
<allow receive_sender="org.kerneloops.submit"/>
<allow receive_sender="org.kerneloops.submit.permission"/>
<allow receive_sender="org.kerneloops.submit.sent"/>
+ <allow receive_sender="org.kerneloops.submit.url"/>
<allow send_path="/org/kerneloops/submit"/>
diff --git a/kerneloops.h b/kerneloops.h
index 38bec4b..b2e0ea3 100644
--- a/kerneloops.h
+++ b/kerneloops.h
@@ -40,7 +40,7 @@ extern void read_config_file(char *filename);
extern void ask_permission(void);
extern void dbus_ask_permission(char * detail_file_name);
-extern void dbus_say_thanks(void);
+extern void dbus_say_thanks(char *url);
extern int opted_in;
extern int allow_distro_to_pass_on;
diff --git a/kerneloops.init b/kerneloops.init
index d7e8663..25f5465 100755
--- a/kerneloops.init
+++ b/kerneloops.init
@@ -34,7 +34,7 @@ lockfile=/var/lock/subsys/$prog
start() {
echo -n $"Starting $prog:"
- daemon $prog
+ daemon $prog $OPTS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
diff --git a/submit.c b/submit.c
index 93e8857..13e1b75 100644
--- a/submit.c
+++ b/submit.c
@@ -182,6 +182,25 @@ static void write_logfile(int count)
closelog();
}
+char result_url[4096];
+
+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);
+ 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 size * nmemb;
+}
+
void submit_queue(void)
{
int result;
@@ -189,6 +208,8 @@ void submit_queue(void)
struct oops *queue;
int count = 0;
+ memset(result_url, 0, 4096);
+
if (testmode) {
print_queue();
return;
@@ -204,8 +225,9 @@ void submit_queue(void)
struct curl_httppost *last = NULL;
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 */
@@ -220,6 +242,7 @@ void submit_queue(void)
}
curl_easy_setopt(handle, CURLOPT_HTTPPOST, post);
+ curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction);
result = curl_easy_perform(handle);
curl_formfree(post);
@@ -235,7 +258,7 @@ void submit_queue(void)
write_logfile(count);
if (count)
- dbus_say_thanks();
+ 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.
--
1.5.6
++++++ 0002-kerneloops-applet-fix-string-handling-make-window.patch ++++++
From edc622c1e6dc60cc1abeab6af2f40100eddbd078 Mon Sep 17 00:00:00 2001
From: Brandon Philips
Date: Thu, 7 Aug 2008 18:51:39 -0700
Subject: [PATCH] kerneloops-applet: fix string handling, make window scrollable
- Strings weren't being properly terminated
- Make the window scrollable with pageup/pagedown by using native scrolling of
the TextView
- Fix up some minor whitespace issues
Signed-off-by: Brandon Philips
---
kerneloops-applet.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/kerneloops-applet.c b/kerneloops-applet.c
index 0497f9d..ea3a122 100644
--- a/kerneloops-applet.c
+++ b/kerneloops-applet.c
@@ -172,12 +172,13 @@ static void detail_action(NotifyNotification __unused *notify,
detail_data = malloc(statb.st_size+1);
if (!detail_data)
return;
-
+
if (read(detail_fd, detail_data, statb.st_size) != statb.st_size) {
free(detail_data);
return;
}
close(detail_fd);
+ detail_data[statb.st_size] = '\0';
dialog = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(dialog), _("Kernel failure details"));
@@ -192,8 +193,8 @@ static void detail_action(NotifyNotification __unused *notify,
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text(buffer, detail_data, -1);
free(detail_data);
- gtk_scrolled_window_add_with_viewport(
- GTK_SCROLLED_WINDOW(scrollwindow), view);
+ gtk_container_add (GTK_CONTAINER (scrollwindow), view);
+
gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);
button_send = gtk_button_new_with_label (_("Send"));
GTK_WIDGET_SET_FLAGS(button_send, GTK_CAN_DEFAULT);
@@ -210,7 +211,7 @@ static void detail_action(NotifyNotification __unused *notify,
G_OBJECT(dialog));
g_signal_connect(G_OBJECT(button_send), "clicked",
G_CALLBACK(send_action), NULL);
-
+
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
button_send, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
--
1.5.6
++++++ 0003-kerneloops-applet-use-monospace-fonts-in-detail-vie.patch ++++++
From e28f6d06b529034f9e2161734e963b92569331c0 Mon Sep 17 00:00:00 2001
From: Brandon Philips
Date: Thu, 7 Aug 2008 19:45:55 -0700
Subject: [PATCH] kerneloops-applet: use monospace fonts in detail view
Signed-off-by: Brandon Philips
---
kerneloops-applet.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/kerneloops-applet.c b/kerneloops-applet.c
index ea3a122..67d9ae8 100644
--- a/kerneloops-applet.c
+++ b/kerneloops-applet.c
@@ -150,6 +150,8 @@ static void detail_action(NotifyNotification __unused *notify,
GtkTextBuffer *buffer;
GtkWidget *button_cancel;
GtkWidget *button_send;
+ GtkTextTag *fixed;
+ GtkTextIter iter;
char *detail_data;
struct stat statb;
int detail_fd;
@@ -187,11 +189,14 @@ static void detail_action(NotifyNotification __unused *notify,
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,
+ 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));
- gtk_text_buffer_set_text(buffer, detail_data, -1);
+ fixed = gtk_text_buffer_create_tag (buffer, "font", "font", "monospace", NULL);
+ gtk_text_buffer_get_iter_at_line_offset(buffer, &iter, 0, 0);
+ gtk_text_buffer_insert_with_tags(buffer, &iter, detail_data, -1,
+ fixed, NULL);
free(detail_data);
gtk_container_add (GTK_CONTAINER (scrollwindow), view);
--
1.5.6
++++++ 0004-kerneloops-applet-Fix-Gtk-WARNING-gtkwidget.c-5.patch ++++++
From 1dc87e62917440aa63b06854a7cc048ec6d1d396 Mon Sep 17 00:00:00 2001
From: Brandon Philips
Date: Thu, 7 Aug 2008 19:59:13 -0700
Subject: [PATCH] kerneloops-applet: Fix Gtk-WARNING **: gtkwidget.c:5240: widget not within a GtkWindow
Signed-off-by: Brandon Philips
---
kerneloops-applet.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kerneloops-applet.c b/kerneloops-applet.c
index 67d9ae8..7acc1e6 100644
--- a/kerneloops-applet.c
+++ b/kerneloops-applet.c
@@ -203,7 +203,6 @@ static void detail_action(NotifyNotification __unused *notify,
gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);
button_send = gtk_button_new_with_label (_("Send"));
GTK_WIDGET_SET_FLAGS(button_send, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button_send);
button_cancel = gtk_button_new_with_label (_("Cancel"));
g_signal_connect(G_OBJECT(dialog), "delete_event",
@@ -221,6 +220,7 @@ static void detail_action(NotifyNotification __unused *notify,
button_send, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
button_cancel, TRUE, TRUE, 0);
+ gtk_widget_grab_default(button_send);
gtk_widget_show(view);
gtk_widget_show(button_send);
--
1.5.6
++++++ kerneloops-0.11.tar.bz2 -> kerneloops-0.12.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/Changelog new/kerneloops-0.12/Changelog
--- old/kerneloops-0.11/Changelog 2008-04-22 19:40:08.000000000 +0200
+++ new/kerneloops-0.12/Changelog 2008-06-23 00:00:15.000000000 +0200
@@ -1,9 +1,10 @@
+0.12 - Jun 22nd 2008
+ * Contributions from Michael Johnson
+ - show the oops text before submitting
+ - various speedups
+
0.11 - Jan 11 2008
* Improve the makefile (GregKH)
- * Take various fixes from Chuck Ebbert (Red Hat) based on Fedora
- feedback
- * Put a link to the submitted oops in the "thanks" screen
- * Consider stack overflow warnings also kernel badness
0.10 - Jan 05 2008
* Fix some bugs found in the fedora package review process
0.9 - Jan 03 2008
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/dmesg.c new/kerneloops-0.12/dmesg.c
--- old/kerneloops-0.11/dmesg.c 2008-04-22 00:44:51.000000000 +0200
+++ new/kerneloops-0.12/dmesg.c 2008-06-23 00:00:15.000000000 +0200
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
/*
* Copyright 2007, Intel Corporation
*
@@ -41,6 +40,8 @@
static char *linelevel;
static int linecount;
+#define MAX(A,B) ((A) > (B) ? (A) : (B))
+
/*
* This function splits the dmesg buffer data into lines
@@ -53,25 +54,20 @@
linecount = 0;
c = buffer;
while (c) {
- int len = 0;
- char *c9;
-
- 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;
+ char *c3;
+ c3 = strchr(c, '\n');
/* skip non-kernel lines */
- c2 = memmem(c, len, "kernel:", 7);
- if (!c2)
- c2 = memmem(c, len, "kerneloops:", 11);
- if (!c2) {
- c2 = c9;
+ c2 = strstr(c, "kernel:");
+ if (!c2 || (c2 > c3))
+ c2 = strstr(c, "kerneloops:");
+ if (!c2 || (c2 > c3)) {
+ c2 = strchr(c, '\n');
if (c2) {
- c = c2 + 1;
+ c = c2+1;
continue;
} else
break;
@@ -132,7 +128,7 @@
/*
* extract_oops tries to find oops signatures in a log
*/
-static void extract_oops(char *buffer, int remove_syslog)
+static void extract_oops(char *buffer, size_t buflen, int remove_syslog)
{
int i;
char prevlevel = 0;
@@ -140,10 +136,10 @@
int oopsend;
int inbacktrace = 0;
- linepointer = calloc(strlen(buffer)+1, sizeof(char*));
+ linepointer = calloc(buflen+1, sizeof(char*));
if (!linepointer)
return;
- linelevel = calloc(strlen(buffer)+1, sizeof(char));
+ linelevel = calloc(buflen+1, sizeof(char));
if (!linelevel) {
free(linepointer);
linepointer = NULL;
@@ -170,9 +166,9 @@
oopsstart = i;
if (strstr(c, "kernel BUG at"))
oopsstart = i;
- if (strstr(c, "do_IRQ: stack overflow:"))
+ if (strstr(c, "RTNL: assertion failed"))
oopsstart = i;
- if (strstr(c, "near stack overflow (cur:"))
+ if (strstr(c, "Eeek! page_mapcount(page) went negative!"))
oopsstart = i;
if (strstr(c, "double fault:"))
oopsstart = i;
@@ -187,6 +183,10 @@
oopsstart = i;
if (strstr(c, "------------[ cut here ]------------"))
oopsstart = i;
+ if (strstr(c, "list_del corruption."))
+ oopsstart = i;
+ if (strstr(c, "list_add corruption."))
+ oopsstart = i;
if (strstr(c, "Oops:") && i >= 3)
oopsstart = i-3;
if (oopsstart >= 0 && testmode) {
@@ -195,10 +195,6 @@
if (oopsstart != i)
printf(" trigger line is -%s-\n", c);
}
- /* give the kernel some time to finish dumping the oops */
- /* but not in testmode since that makes regression testins slow */
- if (oopsstart >= 0 && !testmode)
- sleep(1);
/* try to find the end marker */
if (oopsstart >= 0) {
@@ -343,7 +339,7 @@
buffer = calloc(getpagesize()+1, 1);
syscall(__NR_syslog, 3, buffer, getpagesize());
- extract_oops(buffer, 0);
+ extract_oops(buffer, strlen(buffer), 0);
free(buffer);
if (opted_in >= 2)
submit_queue();
@@ -358,6 +354,7 @@
struct stat statb;
FILE *file;
int ret;
+ size_t buflen;
memset(&statb, 0, sizeof(statb));
@@ -370,9 +367,15 @@
* in theory there's a race here, since someone could spew
* 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
+ * more than that.. any oops will be in dmesg anyway.
+ * 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.
*/
- buffer = calloc(statb.st_size+1024, 1);
+ buflen = MAX(statb.st_size+1024, 32*1024*1024);
+ buffer = calloc(buflen, 1);
assert(buffer != NULL);
file = fopen(filename, "rm");
@@ -380,11 +383,12 @@
free(buffer);
return;
}
- ret = fread(buffer, 1, statb.st_size+1023, file);
+ fseek(file, -buflen, SEEK_END);
+ ret = fread(buffer, 1, buflen-1, file);
fclose(file);
if (ret > 0)
- extract_oops(buffer, issyslog);
+ extract_oops(buffer, buflen-1, issyslog);
free(buffer);
if (opted_in >= 2)
submit_queue();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/.gitignore new/kerneloops-0.12/.gitignore
--- old/kerneloops-0.11/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/kerneloops-0.12/.gitignore 2008-06-23 00:00:15.000000000 +0200
@@ -0,0 +1,8 @@
+*~
+kerneloops
+kerneloops-applet
+test/*dbg
+*.o
+DEADJOE
+kerneloops.1.gz
+po/*.mo
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/kerneloops.8 new/kerneloops-0.12/kerneloops.8
--- old/kerneloops-0.11/kerneloops.8 2008-04-22 19:36:41.000000000 +0200
+++ new/kerneloops-0.12/kerneloops.8 2008-06-23 00:00:15.000000000 +0200
@@ -35,9 +35,6 @@
.LP
.TP
-\fB\-\-file filename\fR
-Parse the file denoted with filename as if it were /var/log/messages
-.TP
\fB\-\-debug\fR
Enable debug mode
.TP
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/kerneloops-applet.c new/kerneloops-0.12/kerneloops-applet.c
--- old/kerneloops-0.11/kerneloops-applet.c 2008-04-22 02:35:01.000000000 +0200
+++ new/kerneloops-0.12/kerneloops-applet.c 2008-06-23 00:00:15.000000000 +0200
@@ -34,9 +34,13 @@
#include
#include
+#include
#include
#include
#include
+#include
+#include
+#include
#include
#include
@@ -65,6 +69,7 @@
int user_preference;
+static char *detail_file_name;
static void write_config(char *permission)
{
@@ -92,6 +97,7 @@
"org.kerneloops.submit.permission", answer);
dbus_connection_send(bus, message, NULL);
dbus_message_unref(message);
+ detail_file_name = NULL;
}
/*
@@ -118,6 +124,7 @@
char *answer = (char *) user_data;
send_permission(answer);
+ detail_file_name = NULL;
if (strcmp(answer, "always") == 0)
write_config("always");
if (strcmp(answer, "never") == 0)
@@ -125,6 +132,97 @@
gtk_status_icon_set_visible(statusicon, FALSE);
}
+/* Called only from the detail window */
+static void send_action(NotifyNotification __unused *notify,
+ gchar __unused *action, gpointer __unused user_data)
+{
+ send_permission("yes");
+}
+
+
+/* Called only to display details */
+static void detail_action(NotifyNotification __unused *notify,
+ gchar __unused *action, gpointer __unused user_data)
+{
+ GtkWidget *dialog;
+ GtkWidget *scrollwindow;
+ GtkWidget *view;
+ GtkTextBuffer *buffer;
+ GtkWidget *button_cancel;
+ GtkWidget *button_send;
+ 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;
+
+ memset(&statb, 0, sizeof(statb));
+ ret = stat(detail_file_name, &statb);
+ if (statb.st_size < 1 || ret != 0)
+ return;
+
+ detail_fd = open(detail_file_name, O_RDONLY);
+ if (detail_fd < 0)
+ return;
+
+ detail_data = malloc(statb.st_size+1);
+ if (!detail_data)
+ return;
+
+ if (read(detail_fd, detail_data, statb.st_size) != statb.st_size) {
+ free(detail_data);
+ return;
+ }
+ close(detail_fd);
+
+ 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));
+ gtk_text_buffer_set_text(buffer, detail_data, -1);
+ free(detail_data);
+ gtk_scrolled_window_add_with_viewport(
+ GTK_SCROLLED_WINDOW(scrollwindow), view);
+ gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);
+ button_send = gtk_button_new_with_label (_("Send"));
+ GTK_WIDGET_SET_FLAGS(button_send, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(button_send);
+ button_cancel = gtk_button_new_with_label (_("Cancel"));
+
+ g_signal_connect(G_OBJECT(dialog), "delete_event",
+ G_CALLBACK(gtk_widget_destroy), dialog);
+ g_signal_connect_swapped(G_OBJECT(button_cancel), "clicked",
+ G_CALLBACK(gtk_widget_destroy),
+ G_OBJECT(dialog));
+ g_signal_connect(G_OBJECT(dialog), "destroy",
+ G_CALLBACK(gtk_widget_destroy),
+ G_OBJECT(dialog));
+ g_signal_connect(G_OBJECT(button_send), "clicked",
+ G_CALLBACK(send_action), NULL);
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
+ button_send, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
+ button_cancel, TRUE, TRUE, 0);
+
+ 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");
@@ -160,12 +258,15 @@
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];
-
/*
* open a notification window (expires in 5 seconds) to say thank you
* to the user for his bug feedback.
@@ -173,32 +274,15 @@
static void sent_an_oops(void)
{
char *summary = _("Kernel bug diagnostic information sent");
- char message[8200];
- char *message_1 =
+ char *message =
_("Diagnostic information from your Linux kernel has been "
"sent to http://www.kerneloops.org\">www.kerneloops.org</a> "
"for the Linux kernel developers to work on. \n"
"Thank you for contributing to improve the quality of the Linux kernel.\n");
-
- char *message_2 =
- _("Diagnostic information from your Linux kernel has been "
- "sent to http://www.kerneloops.org\">www.kerneloops.org</a> "
- "for the Linux kernel developers to work on. \n"
- "Thank you for contributing to improve the quality of the Linux kernel.\n"
- "You can watch your submitted oops here</a>\n");
NotifyActionCallback callback = notify_action;
close_notification();
-
- if (strlen(url_to_oops)==0)
- sprintf(message, message_1);
- else
- sprintf(message, message_2, url_to_oops);
-
-
- url_to_oops[0] = 0;
-
notify = notify_notification_new(summary, message,
"/usr/share/kerneloops/icon.png", NULL);
@@ -218,17 +302,6 @@
notify_notification_show(notify, NULL);
}
-/*
- * store the URL for the user
- */
-static void got_an_url(DBusMessage *message)
-{
- char *string = NULL;
- dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &string, DBUS_TYPE_INVALID);
- if (string)
- strncpy(url_to_oops, string, 4095);
-
-}
/*
@@ -272,6 +345,9 @@
} else {
/* ok time to ask the user */
gtk_status_icon_set_visible(statusicon, TRUE);
+ dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &detail_file_name,
+ DBUS_TYPE_INVALID);
got_a_message();
gtk_status_icon_set_visible(statusicon, FALSE);
}
@@ -286,13 +362,6 @@
gtk_status_icon_set_visible(statusicon, FALSE);
return DBUS_HANDLER_RESULT_HANDLED;
}
- /* check if it's the daemon that asks for permission */
- if (dbus_message_is_signal(message,
- "org.kerneloops.submit.url", "url")) {
-
- got_an_url(message);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -370,7 +439,6 @@
/* set the dbus message to listen for */
dbus_bus_add_match(bus, "type='signal',interface='org.kerneloops.submit.permission'", &error);
dbus_bus_add_match(bus, "type='signal',interface='org.kerneloops.submit.sent'", &error);
- dbus_bus_add_match(bus, "type='signal',interface='org.kerneloops.submit.url'", &error);
dbus_connection_add_filter(bus, dbus_gotmessage, NULL, NULL);
/*
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/kerneloops.c new/kerneloops-0.12/kerneloops.c
--- old/kerneloops-0.11/kerneloops.c 2008-04-22 19:36:05.000000000 +0200
+++ new/kerneloops-0.12/kerneloops.c 2008-06-23 00:00:15.000000000 +0200
@@ -90,30 +90,27 @@
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-void dbus_ask_permission(void)
+void dbus_ask_permission(char * detail_file_name)
{
DBusMessage *message;
if (!bus)
return;
message = dbus_message_new_signal("/org/kerneloops/submit/permission",
"org.kerneloops.submit.permission", "ask");
+ if (detail_file_name) {
+ dbus_message_append_args(message,
+ DBUS_TYPE_STRING, &detail_file_name,
+ DBUS_TYPE_INVALID);
+ }
dbus_connection_send(bus, message, NULL);
dbus_message_unref(message);
}
-void dbus_say_thanks(char *url)
+void dbus_say_thanks(void)
{
DBusMessage *message;
if (!bus)
return;
- if (url && strlen(url)) {
- message = dbus_message_new_signal("/org/kerneloops/submit/url",
- "org.kerneloops.submit.url", "url");
- dbus_message_append_args (message, DBUS_TYPE_STRING, &url, DBUS_TYPE_INVALID);
- dbus_connection_send(bus, message, NULL);
- dbus_message_unref(message);
- }
-
message = dbus_message_new_signal("/org/kerneloops/submit/sent",
"org.kerneloops.submit.sent", "sent");
dbus_connection_send(bus, message, NULL);
@@ -172,14 +169,9 @@
}
-
/* we scan dmesg before /var/log/messages; dmesg is a more accurate source normally */
scan_dmesg(NULL);
scan_filename("/var/log/messages", 1);
-
- if (argc > 2 && strstr(argv[1], "--file"))
- scan_filename(argv[2], 1);
-
if (testmode && argc > 2) {
int q;
for (q = 2; q < argc; q++) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/kerneloops.dbus new/kerneloops-0.12/kerneloops.dbus
--- old/kerneloops-0.11/kerneloops.dbus 2008-04-22 02:35:01.000000000 +0200
+++ new/kerneloops-0.12/kerneloops.dbus 2008-06-23 00:00:15.000000000 +0200
@@ -12,7 +12,6 @@
<allow own="org.kerneloops.submit.ping"/>
<allow own="org.kerneloops.submit.permission"/>
<allow own="org.kerneloops.submit.sent"/>
- <allow own="org.kerneloops.submit.url"/>
</policy>
<policy at_console="true">
@@ -21,7 +20,6 @@
<allow receive_sender="org.kerneloops.submit"/>
<allow receive_sender="org.kerneloops.submit.permission"/>
<allow receive_sender="org.kerneloops.submit.sent"/>
- <allow receive_sender="org.kerneloops.submit.url"/>
<allow send_path="/org/kerneloops/submit"/>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/kerneloops.h new/kerneloops-0.12/kerneloops.h
--- old/kerneloops-0.11/kerneloops.h 2008-04-22 02:35:01.000000000 +0200
+++ new/kerneloops-0.12/kerneloops.h 2008-06-23 00:00:15.000000000 +0200
@@ -39,8 +39,8 @@
extern void read_config_file(char *filename);
extern void ask_permission(void);
-extern void dbus_ask_permission(void);
-extern void dbus_say_thanks(char *url);
+extern void dbus_ask_permission(char * detail_file_name);
+extern void dbus_say_thanks(void);
extern int opted_in;
extern int allow_distro_to_pass_on;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/kerneloops.init new/kerneloops-0.12/kerneloops.init
--- old/kerneloops-0.11/kerneloops.init 2008-04-22 19:25:58.000000000 +0200
+++ new/kerneloops-0.12/kerneloops.init 2008-06-23 00:00:15.000000000 +0200
@@ -34,7 +34,7 @@
start() {
echo -n $"Starting $prog:"
- daemon $prog $OPTS
+ daemon $prog
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/push.sh new/kerneloops-0.12/push.sh
--- old/kerneloops-0.11/push.sh 1970-01-01 01:00:00.000000000 +0100
+++ new/kerneloops-0.12/push.sh 2008-06-23 00:00:15.000000000 +0200
@@ -0,0 +1,4 @@
+#!/bin/sh
+git gc
+git-push -f ssh://git.infradead.org/srv/git/kerneloops.git master:refs/heads/master
+git-push --tags -f ssh://git.infradead.org/srv/git/kerneloops.git master:refs/heads/master
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kerneloops-0.11/submit.c new/kerneloops-0.12/submit.c
--- old/kerneloops-0.11/submit.c 2008-04-22 19:41:02.000000000 +0200
+++ new/kerneloops-0.12/submit.c 2008-06-23 00:00:15.000000000 +0200
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
@@ -65,6 +66,11 @@
static struct oops *queued_oopses;
static int newoops;
+/* For communicating details to the applet, we write the
+ * details in a file, and provide the filename to the applet
+ */
+static char *detail_filename;
+
static unsigned int checksum(char *ptr)
{
@@ -106,6 +112,46 @@
}
+void write_detail_file(void)
+{
+ int temp_fileno;
+ FILE *tmpf;
+ struct oops *oops;
+ int count = 0;
+
+ detail_filename = strdup("/tmp/kerneloops.XXXXXX");
+ temp_fileno = mkstemp(detail_filename);
+ if (temp_fileno < 0) {
+ free(detail_filename);
+ detail_filename = NULL;
+ return;
+ }
+ /* regular user must be able to read this detail file to be
+ * useful; there is nothing worth doing if fchmod fails.
+ */
+ fchmod(temp_fileno, 0644);
+ tmpf = fdopen(temp_fileno, "w");
+ oops = queued_oopses;
+ while (oops) {
+ count++; /* Users are not programmers, start at 1 */
+ fprintf(tmpf, "Kernel failure message %d:\n", count);
+ fprintf(tmpf, oops->text);
+ fprintf(tmpf, "\n\n");
+ oops = oops->next;
+ }
+ fclose(tmpf);
+ close(temp_fileno);
+}
+
+void unlink_detail_file(void)
+{
+ if (detail_filename) {
+ unlink(detail_filename);
+ free(detail_filename);
+ }
+}
+
+
static void print_queue(void)
{
struct oops *oops;
@@ -136,25 +182,6 @@
closelog();
}
-char result_url[4096];
-
-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);
- 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 size * nmemb;
-}
-
void submit_queue(void)
{
int result;
@@ -162,8 +189,6 @@
struct oops *queue;
int count = 0;
- memset(result_url, 0, 4096);
-
if (testmode) {
print_queue();
return;
@@ -179,9 +204,8 @@
struct curl_httppost *last = NULL;
struct oops *next;
- handle = curl_easy_init();
- printf("DEBUG SUBMIT URL is %s \n", submit_url);
+ handle = curl_easy_init();
curl_easy_setopt(handle, CURLOPT_URL, submit_url);
/* set up the POST data */
@@ -196,7 +220,6 @@
}
curl_easy_setopt(handle, CURLOPT_HTTPPOST, post);
- curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction);
result = curl_easy_perform(handle);
curl_formfree(post);
@@ -212,13 +235,15 @@
write_logfile(count);
if (count)
- dbus_say_thanks(result_url);
+ dbus_say_thanks();
/*
* 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)
@@ -245,7 +270,8 @@
return;
pinged = 0;
newoops = 0;
- if (queued_oopses)
- dbus_ask_permission();
+ if (queued_oopses) {
+ write_detail_file();
+ dbus_ask_permission(detail_filename);
+ }
}
-
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org