Bug#857627: libsane-perl: If SANE handle opened before scanner powered on, get_devices() always returns undef
Jeffrey Ratcliffe
jffry at posteo.net
Mon Mar 13 13:16:05 UTC 2017
Package: libsane-perl
Version: 0.05-3
Severity: normal
Tags: patch
Dear Maintainer,
* What led up to the situation?
Forgot to power on scanner
* What exactly did you do (or not do) that was effective (or
ineffective)?
Started frontend
* What was the outcome of this action?
get_devices() returned undef, despite rerunning after powering on scanner
* What outcome did you expect instead?
that get_devices() returned the devices found
-- System Information:
Debian Release: 9.0
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libsane-perl depends on:
ii libc6 2.24-9
ii libsane 1.0.25-3
ii perl 5.24.1-1
ii perl-base [perlapi-5.24.1] 5.24.1-1
libsane-perl recommends no packages.
libsane-perl suggests no packages.
-- no debconf information
-------------- next part --------------
>From 90f1bc80026877bb35612e4c69aa25952942d204 Mon Sep 17 00:00:00 2001
From: Jeffrey Ratcliffe <Jeffrey.Ratcliffe at gmail.com>
Date: Sat, 6 Oct 2012 22:21:44 +0200
Subject: [PATCH] Run sane_exit() before sane_get_devices()
---
Sane.xs | 2 +-
lib/Sane.pm | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/Sane.xs b/Sane.xs
index 3d1790a..6806d92 100644
--- a/Sane.xs
+++ b/Sane.xs
@@ -577,7 +577,7 @@ sane_strstatus (status)
SANE_Status status
void
-END ()
+sane__exit ()
CODE:
SV* sv = get_sv("Sane::_vc", FALSE);
if (SvTRUE(sv)) {
diff --git a/lib/Sane.pm b/lib/Sane.pm
index b839d8b..056019d 100644
--- a/lib/Sane.pm
+++ b/lib/Sane.pm
@@ -287,16 +287,20 @@ sub get_version_scalar {
sub get_devices {
- if (not $_vc) {
- print "Running init\n" if $DEBUG;
- $_vc = Sane->_init;
- $STATUS = Sane::Status->new;
- return undef if ($_status);
- }
+ Sane::_exit();
+ print "Running init\n" if $DEBUG;
+ $_vc = Sane->_init;
+ $STATUS = Sane::Status->new;
+ return undef if ($_status);
return Sane::_get_devices();
}
+END {
+ Sane::_exit();
+}
+
+
# todo
# add simple sane methods
# remove examples/test.pl
--
1.7.9.5
More information about the pkg-perl-maintainers
mailing list