Thanks for the report.

The version of libtiff-tools in testing still outputs to stderr, so I am inclined to say this is not (yet) a Debian bug, and certainly not important.

Indeed, your patch will break the version of gscan2pdf in testing.

Does the attached patch also fix your problem?
diff --git a/bin/gscan2pdf b/bin/gscan2pdf
index 5f911aef..e8664d06 100755
--- a/bin/gscan2pdf
+++ b/bin/gscan2pdf
@@ -935,7 +935,7 @@ sub check_dependencies {
             'djvu', 'stderr', qr/DjVuLibre-([\d.]+)/xsm, [ 'cjb2', '--version' ]
         ],
         [
-            'libtiff', 'stderr',
+            'libtiff', 'both',
             qr/LIBTIFF,\sVersion\s([\d.]+)/xsm, [ 'tiffcp', '-h' ]
         ],
 
diff --git a/lib/Gscan2pdf/Document.pm b/lib/Gscan2pdf/Document.pm
index c0e0ad1c..76f832f0 100644
--- a/lib/Gscan2pdf/Document.pm
+++ b/lib/Gscan2pdf/Document.pm
@@ -2180,8 +2180,24 @@ sub program_version {
 sub _program_version {
     my ( $stream, $regex, @output ) = @_;
     my ( $status, $out,   $err )    = @output;
-    my $output = $stream eq 'stdout' ? $out : $err;
-    if ( defined $output and $output =~ $regex ) { return $1 }
+    if ( not defined $out ) { $out = q{} }
+    if ( not defined $err ) { $err = q{} }
+    my $output;
+    given ($stream) {
+        when ('stdout') {
+            $output = $out
+        }
+        when ('stderr') {
+            $output = $err
+        }
+        when ('both') {
+            $output = $out . $err
+        }
+        default {
+            $logger->error("Unknown stream: '$stream'");
+        }
+    }
+    if ( $output =~ $regex ) { return $1 }
     if ( $status == $PROCESS_FAILED ) {
         $logger->info($err);
         return $PROCESS_FAILED;

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to