Commit Graph

120 Commits

Author SHA1 Message Date
Chris Dinneen
ba594d1e78 Add abbreviation explainer for tape types in code comment 2025-01-05 16:39:16 +01:00
Iustin Pop
e6f79d85ec Re-format code via clang-format
Technically, via `make reindent` :)
2025-01-05 16:27:41 +01:00
Kai Mäkisara
42dd44bb90 stinit: Change stinit to return one if setting one or more options fails
Previously, stinit returned zero even if it fails to set the options.
This patch changes the return value to one if one or more of the options
can't be set for a device if the tape numbers are given on command line.
If no numbers are given, stinit returns zero (as before this patch).
After this change, scripts (udev rules) can more easily detect when
stinit fails.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
2025-01-05 16:26:21 +01:00
Kai Mäkisara
ff108770be mt: stinit: Add support for setting and clearing MT_ST_NOWAIT_EOF
Add code to set/clear the MT_ST_NO_WAIT option bit for MTSETDRVBUFFER.
The string used in the user interface is 'weof-no-wait'.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
2025-01-05 14:54:06 +01:00
Kai Mäkisara
9c8f170d4a mt: Complain about write protection if write protected
Print the message if status bit is one, not zero.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
2024-12-14 18:28:43 +01:00
Chris Dinneen
72f9eda87d Backport Linux Kernel WEOFI ioctls 2023-11-04 10:06:45 +01:00
Chris Dinneen
eadc992f2a Fix #26; Add LTO9 Density Code 2023-10-31 17:57:47 +01:00
Iustin Pop
e8e6d543de Release version 1.7 v1.7 2023-04-20 23:23:56 +02:00
Iustin Pop
34978b4019 Fix a 25-year old bug \o/
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>
2023-04-20 23:18:23 +02:00
Iustin Pop
8056c1542a Fix CFLAGS for sanitizer
Oops, didn't fail as expected :)
2023-04-20 23:04:14 +02:00
Iustin Pop
c36a4a0fa5 Don't run undefined (UBSAN) on top of MSAN 2023-04-20 23:03:46 +02:00
Iustin Pop
f9c0570e34 Run tests under various sanitizers
This is in preparation for the next commit which will fix a very long
standing bug…
2023-04-20 23:01:20 +02:00
Iustin Pop
aec3bd67f6 CI workflow: install dependencies for the test jobs too
shelltestrunner was already installed for the coverage target, but not
for main test ones (for the same reason that release 1.5 was broken,
in the sense that it was not needed…).
v1.6
2023-04-19 23:39:12 +02:00
Iustin Pop
52a6c218b9 Release bugfix version 1.6 😅 2023-04-19 23:33:02 +02:00
Iustin Pop
4a72962872 Finish the test migration to shelltest
The shelltest migration was done in 1.4, but not completed - the
distcheck was still doing hard-coded manual tests, and as such, the
"check" target from the dist archive was not working. Sigh.

Now 'distcheck' is using 'check', and the archive is complete.
2023-04-19 23:29:58 +02:00
Iustin Pop
c49c863a2a Release version 1.5 v1.5 2023-04-19 22:59:23 +02:00
Iustin Pop
b6d221c17a Add a few more stinit parsing tests 2023-04-18 22:14:18 +02:00
Iustin Pop
e96400b602 Make sure that make clean removes coverage info
I spent 20 minutes trying to understand why lcov/gcov were complaining
about wrong coverage format/version, before I saw I had a 2 year old
file that was not overwritten nor removed…
2023-04-18 21:34:04 +02:00
Iustin Pop
3c537a17e2 Modernise the CI workflow
Switch to more recent versions of the checkout and codecov action, the
latter also removing saving the data locally, so remove the archival
of that data.
2023-04-18 20:47:08 +02:00
Iustin Pop
bd3b8539d1 Fixup workflows after master->main rename 2023-04-18 20:43:05 +02:00
Iustin Pop
07e9cd2653 Fix build status badge and add a couple more 2023-04-18 20:41:52 +02:00
Iustin Pop
1dafc02c2e Merge pull request #25 from dabiged/Add_3590
Add IBM 3590 B/E format to tape densities table
2023-03-17 13:09:46 +01:00
Chris Dinneen
d7e60146d2 Add: 3590 B using same syntax as T10000A 2023-02-07 12:17:14 +08:00
Chris Dinneen
4fdbc29fed Add IBM 3590 E format to tape list 2023-01-09 11:35:11 +08:00
Iustin Pop
fbfd923faa Expand command line and error handling 2021-06-06 02:34:24 +02:00
Iustin Pop
886ce1f261 Switch 'make check' to be done via shelltestrunner
The embedding of tests in the Makefile works only for that is there
today - a few `--version` and `stinit -p` calls. For expanding the
test coverage, as much as it can be done for `mt`, let's use a proper
shell test runner. `shelltestrunner` is available in Debian/Ubuntu, so
it's likely to be available in other distributions too, and as such
should not be a big barrier to contribution.
2021-06-06 01:46:03 +02:00
Iustin Pop
1743522b8a Add a local coverage target
This needs lcov installed, but it's a good quick helper for local
runs. For history and pull requests, codecov keeps tracking.

Also tweak in the process gitignore to clean the noise.
2021-06-06 00:11:35 +02:00
Iustin Pop
c33c6ad43e Update README badges
Switch from travis-ci to github workflows, and add codecov badge.
2021-06-06 00:03:35 +02:00
Iustin Pop
51b0d3da23 Remove travis config file 2021-06-05 23:51:41 +02:00
Iustin Pop
3241491f72 CI: Add coverage job and upload to codecov 2021-06-05 23:51:01 +02:00
Iustin Pop
5a88467b88 Create a make check target
This is the exact same mini-"tests" that are used in distcheck, but
separated so that the tests can be run with coverage tracking. Would
be good not to have duplicates - maybe use make check inside the
distcheck?
2021-06-05 23:41:47 +02:00
Iustin Pop
9759c9c469 Add github actions CI workflow 2021-06-05 23:33:42 +02:00
kishorkunal-raj
5dbcde9d0d Adding ppc64le architecture support on travis-ci 2020-12-01 08:51:21 +01:00
Iustin Pop
7366f37f69 Test enable codeql analysis 2020-08-31 20:54:00 +02:00
Iustin Pop
ae2907fdd6 Update changelog and bump version for 1.4 release v1.4 2020-08-30 11:43:29 +02:00
Paweł Marciniak
1aaca9a944 Use of sysfs instead of udevadm 2020-07-19 18:00:04 +02:00
Paweł Marciniak
639ece4580 Rename mt-st to mt-st.bash_completion 2020-07-19 18:00:04 +02:00
Paweł Marciniak
a109c716d8 Add BASH auto completion 2020-07-19 18:00:04 +02:00
Dan Horák
e0e9792238 use a variable for the install tool 2020-06-30 22:32:18 +02:00
Dan Horák
72575e6bf0 don't strip binaries on installation 2020-06-30 22:32:18 +02:00
Iustin Pop
845f5e48d2 Add density code for LTO-7 formatted as M8
Still not able to find LTO-9/LTO-10 density codes, but at least this
one should be correct from internet resources.
2019-12-13 16:14:59 +01:00
Iustin Pop
66f36f2ba8 Add test for valid mode parsing result
While fixing #14, what pointed me to check parsing validity (and not
local issues as I thought at first) was that `-v -v` was showing empty
mode definitions, despite claiming parse success. So let's add a test
that mode parsing does do things, not just empty claims.
2019-10-13 20:22:46 +02:00
Iustin Pop
d5720ee85e Fix stinit file parsing broken in 874d58d9
For some reason I missed this during the pull request (even if
trivial), thanks travis-ci for letting me know (indirectly :).

Fixes #14.
2019-10-13 20:14:39 +02:00
Iustin Pop
c73d6ee0e5 Travis: switch build to bionic
The GCC in xenial is old (5.x), and something seems to trip it
compared to the clang build, when checking the default options, see
https://travis-ci.org/iustin/mt-st/jobs/597087158.

Switch to bionic which has GCC 7, which is recent enough.
2019-10-13 19:26:30 +02:00
Iustin Pop
1345189baf Remove left-shifting of negative values
Left-shifting of negative values is undefined behaviour according to
the C standard, because it depends on the exact representation. This
code, copied from the Linux kernel, is intended for 2's complement and
can be replaced by well-defined behaviour: ~(-1<<N) is equivalent
to (1<<N)-1.

Signed-off-by: Iustin Pop <iustin@k1024.org>
2019-02-23 23:16:33 +01:00
Iustin Pop
a15c02e572 More formatting fixes
Just another run of clang-format.
2019-02-16 14:13:02 +01:00
Gris Ge
874d58d952 Fix coverity scan warnings.
* Fix the leaking `fd`.
 * Fix the possible overflow of strcat().

Signed-off-by: Gris Ge <fge@redhat.com>
2019-02-16 14:08:35 +01:00
hrchu
0d1245dce0 Add lto-8 density code 2019-02-16 14:02:41 +01:00
Iustin Pop
0442de1f7c stinit: mark usage() as non-returning
So that we don't have to fake it's non-returnness.
2016-05-06 22:18:30 +02:00
Iustin Pop
013135f604 stinit: check that tape index values are fully correct
Right now stinit ignores leftover chars in strings such as '9a'; let's
make sure we don't miss these (at least the warning message might give
a hint)..
2016-05-06 22:13:02 +02:00