This is a trivial bug, but a bug nevertheless. It's present in the
first commit in this (synthetic) Git repository, and from my
investigations into very old versions - mt-st-0.5 from an old RedHat
version - it was already present in the `stinit.c` version from Apr
11, 1998, which makes it 25 years and 9 days old. This is a new record
for me, which I don't think I'll beat :)
The bug is trivial, in retrospect, and was found just by accident
because with the 1.6 release uploaded in Debian, the new test suite is
run on multiple architectures. While amd64/x86 doesn't trigger this
bug in neither '-O2' nor '-g' build, mips64el, arm64, and s390x do
show the bug in the optimised builds (and only in them) as follows:
amd64:
```
$ /sbin/stinit -v -v -v -p -f ./tests/data/bad-definition.data
Parsing modes for ('XYZ', 'UVW1', '').
Mode 1 definition: blocksize=
Warning: errors in definition for ('XYZ', 'UVW1', ''):
blocksize=
Definition parse completed. Errors found!
```
s390x:
```
$ ./stinit -p -v -v -v -f tests/data/bad-definition.data
Parsing modes for ('XYZ', 'UVW1', '').
Mode 1 definition: blocksize=
Warning: errors in definition for ('XYZ', 'UVW1', ''):
�H
Definition parse completed. Errors found!
```
And shelltest fails to parse that binary output, in 4/5 cases, which
by luck caused the builds to fail. From there it was a fun
investigation into trying to find why it behaves like that.
This bug is caught by the recently introduced MSAN build in the GitHub
CI, so will rely less on luck in the future.
I'm not 100% sure on the semantics of the fix, but it should only
affect this case (missing value to argument), so should be a well
localised fix.
Signed-off-by: Iustin Pop <iustin@k1024.org>
mt-st tools
This directory contains two programs; mt and stinit, used for
dealing with Linux-specific tape-drive handling.
The project was authored and is copyright by Kai Mäkisara
(Kai.Makisara@kolumbus.fi), and since version 1.2 is maintained by
Iustin Pop (iustin@k1024.org). For copyright information, see the
COPYING file.
For more information, bug reports and the source code repository, please see the project homepage at https://github.com/iustin/mt-st.
mt
mt is basically a "standard" mt with additional commands to send the
ioctls specific to the Linux SCSI tape driver. The source supports all
SCSI tape ioctls up to kernel version 2.6.0 but it can also be
compiled in kernels >= 2.0.x (and hopefully with 1.2.x). Although this
mt program is tailored for SCSI tapes, it can also be used with other
Linux tape drivers using the same ioctls (some of the commands may not
work with all drivers).
stinit
The program stinit is meant for initializing of SCSI tape drive modes
at system startup, when the tape driver module is loaded, or when new
tape drivers are initialized using:
echo "scsi add-single-device x y z v" >/proc/scsi/scsi
or (with 2.6 kernels):
echo "y z v" > /sys/class/scsi_host/hostx/scan
where x=host y=channel z=id v=lun (- is wild card for 2.6).
The parameters used in initialization of a tape drive are fetched from a text file. The parameter file is indexed by the inquiry data returned by the drive, i.e., the parameters are defined by the drive manufacturer, model, etc. This means that the initialization for a drive does not depend on its hardware address. A similar method is used by most Unices either within the kernel or outside the kernel.
The contents of the configuration file and the command line parameters
are defined in the man page stinit.8. A sample configuration file
stinit.def.examples is included in this distribution. It can be used
as example when writing descriptions for the tape drives in a
system. NOTE that the examples by no means specify what are the
"correct" parameters for different types of devices.
The program is configured for maximum of 32 tapes and 4 modes (the
default Linux configuration). If the kernel is configured for
different number of tape modes, the definitions MAX_TAPES and
NBR_MODES in stinit.c should be configured accordingly. (With 8 bit
minor numbers NBR_MODES * MAX_TAPES == 128.)
Contents
The files:
README.md: This file.CHANGELOG.md: Changes between versions.COPYING: The GNU Public LicenseMakefile: Makefile for programsmt.c: The mt sourcemt.1: The man page for mtmtio.h: The tape command definitionsstinit.c: The stinit sourcestinit.8: The man page for stinitstinit.def.examples: example configurations for different devicesmt-st.bash_completion: bash auto completion file
Installation
Really simple:
- review the makefile
makemake install