summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/drakbug.pm45
-rw-r--r--perl-install/standalone.pm38
2 files changed, 46 insertions, 37 deletions
diff --git a/perl-install/drakbug.pm b/perl-install/drakbug.pm
new file mode 100644
index 000000000..ded09d5d2
--- /dev/null
+++ b/perl-install/drakbug.pm
@@ -0,0 +1,45 @@
+package drakbug;
+
+use c;
+use strict;
+use common qw(backtrace if_);
+
+
+sub bug_handler {
+ my ($error, $is_signal) = @_;
+
+ # exceptions in eval are OK:
+ return if $error && $^S ne '0' && !$is_signal;
+
+ # exceptions with "\n" are normal ways to quit:
+ if (!$is_signal && eval { $error eq MDK::Common::String::formatError($error) }) {
+ warn $error;
+ exit(255);
+ }
+
+ # we want the full backtrace:
+ if ($is_signal) {
+ my $ctrace = c::C_backtrace();
+ $ctrace =~ s/0:.*(\d+:[^:]*Perl_sighandler)/$1/sig;
+ $error .= "\nGlibc's trace:\n$ctrace\n";
+ }
+ $error .= "Perl's trace:\n" . common::backtrace() if $error;
+
+ my $progname = $0;
+
+ # do not loop if drakbug crashes and do not complain about wizcancel:
+ if ($progname =~ /drakbug/ || $error =~ /wizcancel/ || !-x '/usr/bin/drakbug') {
+ warn $error;
+ exit(1);
+ }
+ $progname =~ s|.*/||;
+ exec('drakbug', if_($error, '--error', $error), '--incident', $progname);
+ c::_exit(1);
+}
+
+if (!$ENV{DISABLE_DRAKBUG}) {
+ $SIG{SEGV} = sub { bug_handler(@_, 1) };
+ $SIG{__DIE__} = \&bug_handler;
+}
+
+1;
diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm
index 9a5d8e157..53293c4a4 100644
--- a/perl-install/standalone.pm
+++ b/perl-install/standalone.pm
@@ -5,6 +5,7 @@ use strict;
use subs qw(exit);
use common qw(N N_ if_ backtrace);
use Config;
+use drakbug;
BEGIN { unshift @::textdomains, 'libDrakX-standalone' }
@@ -190,43 +191,6 @@ our @common_functs = qw(renamef linkf symlinkf output substInFile mkdir_p rm_rf
our @builtin_functs = qw(chmod chown __exit exit unlink link symlink rename system);
our @drakx_modules = qw(Xconfig::card Xconfig::default Xconfig::main Xconfig::monitor Xconfig::parse Xconfig::proprietary Xconfig::resolution_and_depth Xconfig::screen Xconfig::test Xconfig::various Xconfig::xfree any bootloader bootlook c commands crypto detect_devices devices diskdrake diskdrake::hd_gtk diskdrake::interactive diskdrake::removable diskdrake::removable_gtk diskdrake::smbnfs_gtk fs fsedit http keyboard lang log loopback lvm modules::parameters modules mouse my_gtk network network::adsl network::ethernet network::connection network::isdn_consts network::isdn network::modem network::netconnect network::network fs::remote::nfs fs::remote::smb network::tools partition_table partition_table_bsd partition_table::dos partition_table::empty partition_table::gpt partition_table::mac partition_table::raw partition_table::sun printer printerdrake proxy raid run_program scanner services steps swap timezone network::drakfirewall network::shorewall);
-sub bug_handler {
- my ($error, $is_signal) = @_;
-
- # exceptions in eval are OK:
- return if $error && $^S ne '0' && !$is_signal;
-
- # exceptions with "\n" are normal ways to quit:
- if (!$is_signal && eval { $error eq MDK::Common::String::formatError($error) }) {
- warn $error;
- exit(255);
- }
-
- # we want the full backtrace:
- if ($is_signal) {
- my $ctrace = c::C_backtrace();
- $ctrace =~ s/0:.*(\d+:[^:]*Perl_sighandler)/$1/sig;
- $error .= "\nGlibc's trace:\n$ctrace\n";
- }
- $error .= "Perl's trace:\n" . common::backtrace() if $error;
-
- my $progname = $0;
-
- # do not loop if drakbug crashes and do not complain about wizcancel:
- if ($progname =~ /drakbug/ || $error =~ /wizcancel/ || !-x '/usr/bin/drakbug') {
- warn $error;
- exit(1);
- }
- $progname =~ s|.*/||;
- exec('drakbug', if_($error, '--error', $error), '--incident', $progname);
- c::_exit(1);
-}
-
-if (!$ENV{DISABLE_DRAKBUG}) {
- $SIG{SEGV} = sub { bug_handler(@_, 1) };
- $SIG{__DIE__} = \&bug_handler;
-}
-
sub import() {
($standalone_name = $0) =~ s|.*/||;
c::openlog($standalone_name . "[$$]");