diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2019-07-11 07:03:46 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2019-07-11 07:03:46 +0000 |
commit | a814c9856abd6414c57d63b061cb118243e1fbb0 (patch) | |
tree | 7930ce49593e90edb3382b362c8437e03d8e7f3e /usr.sbin/pkg_add | |
parent | 79ec845a41b15bcbbcc0846033eadf4bf4fbc52b (diff) |
tweak the way we report bugs
- the catch/catchall distinction is no longer relevant, strip some info
by default now
- use state->{cmd} to display the command name properly
This makes sure final displays show the command name.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Error.pm | 17 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 6 |
3 files changed, 8 insertions, 19 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index b0cdba6df60..c5247bebeae 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.85 2019/06/30 14:57:25 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.86 2019/07/11 07:03:45 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -136,7 +136,7 @@ sub framework try { &$do; } catch { - $state->errsay("#1: #2", $0, $_); + $state->errsay("#1: #2", $state->{cmd}, $_); OpenBSD::Handler->reset; if ($_ =~ m/^Caught SIG(\w+)/o) { kill $1, $$; diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index 7bc5880009b..1148a84c7f5 100644 --- a/usr.sbin/pkg_add/OpenBSD/Error.pm +++ b/usr.sbin/pkg_add/OpenBSD/Error.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Error.pm,v 1.32 2017/04/18 15:12:00 espie Exp $ +# $OpenBSD: Error.pm,v 1.33 2019/07/11 07:03:45 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -162,7 +162,7 @@ sub dienow $Line = $3; $FullMessage = $error; - $handler->exec($error, '', $1, $2, $3); + $handler->exec($error, $1, $2, $3); } else { die "Fatal error: can't parse $error"; } @@ -195,7 +195,7 @@ sub catch(&) sub catchall(&) { - bless $_[0], "OpenBSD::Error::catchall"; + bless $_[0], "OpenBSD::Error::catch"; } sub rmtree @@ -214,17 +214,6 @@ package OpenBSD::Error::catch; sub exec { my ($self, $full, $e) = @_; - if ($e) { - &$self; - } else { - die $full; - } -} - -package OpenBSD::Error::catchall; -sub exec -{ - my ($self, $full, $e) = @_; &$self; } diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index e5d5dbcb257..ae1ea255084 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.158 2019/07/10 09:18:09 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.159 2019/07/11 07:03:45 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -1701,8 +1701,8 @@ sub parse_and_run if (!$state->defines("stub")) { $self->finish_manpages($state, $plist); } - }catch { - print STDERR "$0: $_\n"; + } catch { + $state->errsay("#1: #2", $state->{cmd}, $_); $rc = 1; }; return $rc; |