Просмотр исходного кода

Dpkg::Source::Package: Do not obscure ‘require’ errors with custom errors

When coming out of eval blocks and reporting on errors, make sure $@ is
included as part of the textual output so that the real underlying error
is reported.

  dpkg-source: error: source package format `3.0 (native)' is not supported
  (Perl module Dpkg::Source::Package::V3::native is required)

Of course, that file is being required just fine, the problem turned out
to be missing File::Temp, but without including $@, it was not obvious
due to the custom error message completely hiding this detail.

Improved-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Guillem Jover <guillem@debian.org>
Thomas Adam лет назад: 14
Родитель
Сommit
f62054b8d9
2 измененных файлов с 5 добавлено и 1 удалено
  1. 3 0
      debian/changelog
  2. 2 1
      scripts/Dpkg/Source/Package.pm

+ 3 - 0
debian/changelog

@@ -28,6 +28,9 @@ dpkg (1.16.4) UNRELEASED; urgency=low
     values are allowed if not appropriate, and that no overflows occur.
     Closes: #580038
   * Switch start-stop-daemon(8) man page examples from /var/run to /run.
+  * Do not obscure Dpkg::Source::Package ‘require’ errors with custom
+    error message. Thanks to Thomas Adam <thomas.adam@smoothwall.net> and
+    Jonathan Nieder <jrnieder@gmail.com>.
 
   [ Updated man page translations ]
   * German (Helge Kreutzmann).

+ 2 - 1
scripts/Dpkg/Source/Package.pm

@@ -233,7 +233,8 @@ sub upgrade_object_type {
             $self->{'fields'}{'Format'} .= " ($variant)" if defined $variant;
         }
         if ($@) {
-	    error(_g("source package format `%s' is not supported (Perl module %s is required)"), $format, $module);
+            error(_g("source package format '%s' is not supported: %s"),
+                  $format, $@);
         }
         bless $self, $module;
     } else {