summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-02-04 16:16:16 +0000
committerThierry Vignaud <tv@mandriva.org>2008-02-04 16:16:16 +0000
commit341b454d330bcb15c0d88edecf7f5628d8df3784 (patch)
tree3cd8e4e35737e1a9d426b1013745369cc54d81f2
parent0d109467687d7bd311863a8e3f7af1617a71ab23 (diff)
downloaddrakx-backup-do-not-use-341b454d330bcb15c0d88edecf7f5628d8df3784.tar
drakx-backup-do-not-use-341b454d330bcb15c0d88edecf7f5628d8df3784.tar.gz
drakx-backup-do-not-use-341b454d330bcb15c0d88edecf7f5628d8df3784.tar.bz2
drakx-backup-do-not-use-341b454d330bcb15c0d88edecf7f5628d8df3784.tar.xz
drakx-backup-do-not-use-341b454d330bcb15c0d88edecf7f5628d8df3784.zip
- autoselect distro version in bugzilla
- do not display twice "Cannot be run in console mode." message - explain what is the usefull part of the gdb trace - make "Please describe what you were doing when it crashed" more visible and force people to write something in before opening bugzilla - open help as user - prevent altering tool and the like when catching a bug (#35241) - report crash messages in the bug report only when --incident is used (and not when tools explicitely run drakbug with --report) - report gdb trace if possible - stop translating program name in bugzilla (#35241)
-rw-r--r--perl-install/NEWS12
-rwxr-xr-xperl-install/standalone/drakbug152
2 files changed, 112 insertions, 52 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 8a39d0e4f..534c97230 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,5 +1,17 @@
- drakbug:
+ o autoselect distro version in bugzilla
+ o do not display twice "Cannot be run in console mode." message
+ o explain what is the usefull part of the gdb trace
o keep buggy process around so that we can run gdb on it (if perl segfaulted)
+ o make "Please describe what you were doing when it crashed" more
+ visible and force people to write something in before opening
+ bugzilla
+ o open help as user
+ o prevent altering tool and the like when catching a bug (#35241)
+ o report crash messages in the bug report only when --incident is used
+ (and not when tools explicitely run drakbug with --report)
+ o report gdb trace if possible
+ o stop translating program name in bugzilla (#35241)
- bootloader-config, diskdrake:
o look for LVM PV on non partitioned disk before looking for DOS
partition_table (esp. for lilo which puts the DOS magic)
diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug
index c786fa045..2a8593e64 100755
--- a/perl-install/standalone/drakbug
+++ b/perl-install/standalone/drakbug
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# Drak Bug Report
-# Copyright (C) 2002-2006 Mandriva (daouda at mandriva dot com)
+# Copyright (C) 2002-2008 Mandriva (daouda at mandriva dot com)
# Stew Benedict (sbenedict at mandriva dot com)
#
# This program is free software; you can redistribute it and/or modify
@@ -23,16 +23,18 @@ use diagnostics;
use lib qw(/usr/lib/libDrakX);
use any;
use standalone;
+use MDK::Common;
use common;
BEGIN { $::no_ugtk_init = 1 }
use mygtk2 qw(gtknew);
use ugtk2 qw(:all);
use Config;
use URI::Escape;
+use run_program;
my $prog;
my $incident = 0;
-my ($table, $comb_app, $com_app, $button_pkg, $package, $distrocode, $error);
+my ($table, $comb_app, $com_app, $button_pkg, $package, $distrocode, $error, $gdb_trace, $user_descr);
my $i;
foreach (@ARGV) {
@@ -43,9 +45,29 @@ foreach (@ARGV) {
/^--incident$/ and do { $incident = 1; $prog = splice(@ARGV, $i, 1) };
}
-if (!check_for_xserver) {
+my $segfaulted = $error =~ /SEGV/;
+if ($segfaulted && -x '/usr/bin/gdb') {
+ local $ENV{TMP} = $ENV{TMP} || '/tmp';
+ my $file = chomp_(`mktemp $ENV{TMP}/drakbug.XXXXXXXX`);
+ my $_guard = before_leaving { rm_rf $file };
+ if (-e $file) {
+ output($file, qq(bt
+quit));
+ local $ENV{LANGUAGE} = 'C';
+ my $temp = run_program::get_stdout('gdb', '-q', 'perl', $$, '-x', $file);
+ $gdb_trace = join "\n", grep { !/^done\.$/ && !/Reading symbols from/
+ && !/Loaded symbols/ && !/The program is run/ } split(/\n/, $temp);
+ }
+}
+if (!check_for_xserver()) {
print("Cannot be run in console mode.\n");
- print N("The \"%s\" program has crashed with the following error:", $prog) . "\n$error\n" if $error;
+ print join("\n",
+ N("The \"%s\" program has crashed with the following error:", $prog),
+ $error,
+ $gdb_trace,
+ '')
+ if $error;
+ c::_exit(0);
}
mygtk2::init();
@@ -100,6 +122,11 @@ $table = create_packtable({ col_spacings => 5, row_spacings => 10 },
$comb_app->set_popdown_strings("", uniq(sort(@generic_tool), if_($prog, $prog)));
$comb_app->set_text("");
+sub format_trace_with_message {
+ my ($message, $trace) = @_;
+ ([ $message ], [ "\n\n " . join("\n ", split("\n", $trace)) . "\n\n", { family => 'monospace' }]);
+}
+
my $parent_uid = get_parent_uid();
gtkadd($window->{window},
@@ -108,57 +135,39 @@ gtkadd($window->{window},
1, create_scrolled_window(
gtknew('TextView', editable => 0, height => 200,
text => [
- if_($prog && $error,
- [
- N("The \"%s\" program has crashed with the following error:", $prog),
- ],
- [
- "\n\n " . join("\n ", split("\n", $error)) . "\n\n",
- { family => 'monospace' }
- ]
- ),
+ if_($prog,
+ if_($error,
+ format_trace_with_message(
+ ($gdb_trace ?
+ N("The \"%s\" program has segfaulted with the following error:", $prog)
+ : N("The \"%s\" program has crashed with the following error:", $prog)),
+ $error)
+ ),
+ if_($gdb_trace, format_trace_with_message(N("Its gdb trace is:"), $gdb_trace)),
+ ),
[
N("To submit a bug report, click on the report button. \nThis will open a web browser window on %s where you'll find a form to fill in. The information displayed above will be transferred to that server. \nThings useful to include in your report are the output of lspcidrake -v, kernel version, and /proc/cpuinfo.", $wizard_name)
]
])),
- 0, gtkadd($table),
+ 0, gtknew('Title2', label => N("Please describe what you were doing when it crashed:")),
+ if_($incident,
+ 1, create_scrolled_window(
+ $user_descr = gtknew('TextView', editable => 1, height => 200)
+ ),
+ ),
+ if_(!$error,
+ 0, gtkadd($table),
+ ),
0, gtkpack(Gtk2::HSeparator->new),
0, gtkpack(create_hbox('edge'),
- gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { system("drakhelp --id drakbug &") }),
- gtkpack(create_hbox('end'),
- gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => sub {
- my $p = $package->get_text;
- my ($product, $version) = $p =~ /^(.*)-([^-]+-[^-]+(mdk|mdv.*))$/; # FIXME: fragile!
- my $app = $comb_app->entry->get_text;
- my $component = $app ?
- if_(member($app, @all_drakxtools), $app) || $mdk_app->{$app} :
- $product;
- my $rel = standalone::real_version();
- my $options = join('&',
- ($product || $version ?
- 'cf_rpmpkg=' . join('-', $product, $version) : ()),
- 'component=Core%20Packages',
- 'classification=Mandriva%20Linux',
- if_($prog,
- "short_desc=$prog%20crashed",
- 'comment=' . uri_escape(qq(The "$prog" program crashed. Drakbug-$rel catched it.
-
-Please describe what you were doing when it crashed.
-
-) . ($error ? qq(Backtrace was:
-$error) :
-qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace)),
- ),
- ),
- );
- print($bugzilla_url . "?" . $options . "\n");
- require run_program;
- run_program::raw({ detach => 1, setuid => $parent_uid },
- '/usr/bin/www-browser', "$bugzilla_url?$options");
- }
- ),
- gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
- ))));
+ gtksignal_connect(
+ Gtk2::Button->new(N("Help")), clicked => sub {
+ run_program::raw({ detach => 1, setuid => $parent_uid }, 'drakhelp', '--id', 'drakbug');
+ }),
+ gtkpack(create_hbox('end'),
+ gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => \&report_bug_to_bugzilla),
+ gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
+ ))));
if (defined $prog) {
update_app($prog);
@@ -189,9 +198,6 @@ sub update_app {
$app_choice = get_package($mdk_app->{$text});
} else {
$app_choice = get_package($text);
- if (my $tool = { reverse %$mdk_app }->{$text}) {
- $prog = $tool;
- }
}
$app_choice ? $package->set_text($app_choice) : $package->set_text(N("Not installed"));
}
@@ -212,4 +218,46 @@ sub get_package {
$rpm_package;
}
+sub report_bug_to_bugzilla() {
+ my $p = $package->get_text;
+ my ($product, $version) = $p =~ /^(.*)-([^-]+-[^-]+(mdk|mdv.*))$/; # FIXME: fragile!
+ my $app = $comb_app->entry->get_text;
+ my $_component = $app ?
+ if_(member($app, @all_drakxtools), $app) || $mdk_app->{$app} :
+ $product;
+ my $text;
+ if ($incident) {
+ my $buffer = $user_descr->get_buffer;
+ $text = $buffer->get_text($buffer->get_start_iter, $buffer->get_end_iter, 0);
+ if (!$text) {
+ err_dialog(N("Warning"),
+ N("You must type in what you were doing when this bug happens in order to increase the reproductibility of this bug and the odds of fixing it")
+ . "\n\n" . N("Thanks."));
+ return;
+ }
+ }
+ my $rel_data = mandrake_release_info();
+ my $rel = standalone::real_version();
+ my $options = join('&',
+ ($product || $version ? 'cf_rpmpkg=' . join('-', $product, $version) : ()),
+ 'version=' . ($rel_data->{branch} eq 'Devel' ? 'Cooker' : $rel_data->{version}),
+ 'component=Core%20Packages',
+ 'classification=Mandriva%20Linux',
+ if_($incident,
+ "short_desc=$prog%20" . ($segfaulted ? 'segfaulted' : 'crashed'),
+ 'comment=' . uri_escape(qq(The "$prog" program crashed. Drakbug-$rel caught it.
+
+) . ($text || "Please describe what you were doing when it crashed.") . "\n\n"
+ . ($error ? qq(Backtrace was:
+$error) :
+ qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace))
+ . if_($gdb_trace, qq(
+GDB backtrace was (its interesting part is below Perl_pp_fork() or Perl_pp_waitpid()):
+$gdb_trace)),
+ ),
+ ),
+ );
+ print($bugzilla_url . "?" . $options . "\n");
+ run_program::raw({ detach => 1, setuid => $parent_uid }, '/usr/bin/www-browser', "$bugzilla_url?$options");
+}