On Tue, Oct 13, 2020 at 15:08:43 -0400, Chris Hoogendyk wrote:
> 
> End of /tmp/amanda/server/daily/amcheck-device.20201013150303.debug
[...]
>    Tue Oct 13 15:03:04.326400287 2020: pid 10777: thd-0x2688800: 
> amcheck-device: warning: Use of
>    uninitialized value $label in concatenation (.) or string at
>    /usr/local/share/perl/5.22.1/Amanda/ScanInventory.pm line 687.
>    Tue Oct 13 15:03:04.326421243 2020: pid 10777: thd-0x2688800: 
> amcheck-device:
>    volume_is_labelable start: label:  barcode: 000029L7
>    Tue Oct 13 15:03:04.326444683 2020: pid 10777: thd-0x2688800: 
> amcheck-device:
>    volume_is_labelable pre-matchlabel call

Okay, great, this would seem to confirm the theory that passing an
uninitialed $label value into the match_labelstr() function is what's
triggering the crash.

Here's a new patch to try.  I am not sure that it's really the
long-term-correct fix, but with some luck it will at least prevent the
crash you are currrently seeing and let you switch back to the oldest
taperscan.

You can either apply this patch file against the *original* version of
ScanInventory.pm, or just manually edit the previously-patched version
of the file to add the 
   $label='' if !defined $label;
just below the 
   debug("volume_is_labelable pre-matchlabel call");
line that appears in there now.

Given that a shot (and send the log file lines as usual)...


                                                Nathan


----------------------------------------------------------------------------
Nathan Stratton Treadway  -  [email protected]  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239
--- ScanInventory.pm_orig_v3.5.1        2017-09-22 19:41:42.154305907 -0400
+++ ScanInventory.pm    2020-10-13 15:47:36.242054712 -0400
@@ -684,6 +684,7 @@
     my $chg = $self->{'chg'};
     my $autolabel = $chg->{'autolabel'};
 
+    debug("volume_is_labelable start: label: $label barcode: $barcode");   
     if (!defined $dev_status) {
        return 0;
     } elsif ($dev_status & $DEVICE_STATUS_VOLUME_UNLABELED and
@@ -723,8 +724,11 @@
        return 0;
     } elsif ($dev_status == $DEVICE_STATUS_SUCCESS and
             $f_type == $Amanda::Header::F_TAPESTART) {
+        debug("volume_is_labelable pre-matchlabel call");   
+        $label='' if !defined $label;
        if (!match_labelstr($self->{'labelstr'}, $autolabel, $label,
                            $barcode, $meta, 
$self->{'chg'}->{'storage'}->{'storage_name'})) {
+            debug("volume_is_labelable post-matchlabel call");   
            if (!$autolabel->{'other_config'}) {
 #              $self->_user_msg(slot_result  => 1,
 #                               label        => $label,
@@ -734,7 +738,9 @@
                return 0;
            }
        } else {
+            debug("volume_is_labelable pre-lookup_tapelabel  call");   
            my $vol_tle = $self->{'tapelist'}->lookup_tapelabel($label);
+            debug("volume_is_labelable post-lookup_tapelabel  call");   
            if (!$vol_tle) {
 #              $self->_user_msg(slot_result     => 1,
 #                               label           => $label,

Reply via email to