Hi Alan,

I'm resurrecting an old topic since recently upgrading from LTO-4 to LTO-8.

The script read_attribute.pl posted under https://github.com/hreinecke/sg3_utils/issues/18 was running fine on my legacy LTO-4 system (sg3-utils 1.33).

On LTO-8 (sg3-utils 1.45) it still mostly works but returns:

cdb to send: [8c 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00]
SCSI Status: Good

Writing 557 bytes of data to stdout

Argument "5e" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 408. Argument "5e" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 409. Argument "5e" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 410. Argument "5e" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 411. Argument "5e" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 412. Argument "5A" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 413. Argument "5e" isn't numeric in numeric eq (==) at /etc/bacula/scripts/read_attribute.pl line 413.

One of my colleagues who is a Perl programmer (I'm not) pointed out the below:

-----------------------------------------------------------------------

I'm pretty sure it's a bug in the script. The lines it complains about are an if-else block where the script tries to determine the LTO generation (LTO-1 to LTO-7).

Problem 1: It's using numeric comparison (==) when it should be using string comparison (eq), because unpack() with "H*" template returns a string, not a number. The comparison would be correct if the strings were prefixed with "0x" so it's interpreted as a hexadecimal number.

Problem 2: It doesn't have a branch to handle the case "5e" at all, so it's printing, or should be printing, "UNKNOWN - PLEASE UPDATE ME".

-----------------------------------------------------------------------

My questions:

1. Has the script been updated since 2017?
2. If so, does the latest version support LTO-8?
3. Does it address the above bug?
4. Where can I get it from?

Regards,
Adam



On 07/08/2018 13:24, Alan Brown wrote:
On 07/08/18 13:04, Adam Weremczuk wrote:
On 07/08/18 12:31, Alan Brown wrote:

For LTO, there are a number of relatively easy ways of answering these questions _without_ moving the tape - as long as you have the latest version of sg3_utils installed

Thank you Alan.

The utilities look very promising.
The problem is my Bacula system runs on an old Debian wheezy offering sg3-utils 1.33-1 without sg_read_attr :( The tool does appear in version 1.42-2 on stretch but two stage distro upgrade is out of question ATM.

Is there any chance that one of the 1.33-1 tools:


Yes: sg_raw

sg_raw -o - -r 1024 -t 60 -v /dev/nst0 (or its /dev/sg) 8c 00 00 00 00 00 00 00  00 00 00 00 04 00 00 00

And pipe it through the script I posted at https://github.com/hreinecke/sg3_utils/issues/18




_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to