86 Commits

Author SHA1 Message Date
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
Iustin Pop
a172976fd2 Remove obsolete calls to uname in do_show_options()
Commit b48a427 removed the actual kernel version checks, but forgot
the calls to populate the values themselves. Remove them as we don't
do anything with those values.
2016-05-06 22:05:57 +02:00
Iustin Pop
2299178287 mt: make usage() show default tape device
This is not unified with version(), and the quotes have been removed
(looks more standard).
2016-05-06 21:58:46 +02:00
Iustin Pop
8c47d73803 mt: move exit-after-usage() into usage()
This simplifies a bit the calls to usage().
2016-05-06 21:58:18 +02:00
Iustin Pop
14a9ca5df4 LARGE CHURN: reindent source code
The source code seems to have, over time, become less self-consistent
in style. In order to not have to keep this up manually, switch over
indenting to clang-format. A .clang-format file is provided to give
repeatable results.

The main difference is switching from tabs to non-tabs
usage. Otherwise the changes are mostly minor and leading to more
consistency. Contributions to the format style welcome!

Nota bene: this should have had no code impact. Any actual code
changes (beyond indenting) are bugs in the re-indent process.
2016-05-06 21:54:34 +02:00
Iustin Pop
a8252c4f91 Re-align structure initialization lists in mt.c
There are three "tables" with structure initialization lists in mt.c,
which look like they were intended to be nicely-aligned, but over time
they got out of alignment.

Redo the alignment by unwrapping the lines and using Emacs'
align-regex, even though this leads to an exception of ~130 line
length for the 'cmds' table, since it leads to a very readable table
(on large terminals). Also protect these regions from clang-format, in
preparation for full file re-indents.
2016-05-06 21:39:48 +02:00
Iustin Pop
faf3e9b3b7 Small naming change MULTIPLE_ARGS→MANY_ARGS
Will help with indenting the cmds[] array.
2016-05-06 18:19:18 +02:00
Iustin Pop
ff81deb7a9 Correct stinit man page regarding database list
I can't find any mention of looking up stinit.def in the current
directory first, at least not since version 0.7. Correct the man page
to mention only `/etc/stinit.def'.
2016-05-04 01:51:12 +02:00
Iustin Pop
0e217e1ae7 Fix small typo in man page
Thanks lintian!
2016-05-03 14:10:56 +02:00
Iustin Pop
a9947a9982 Add build status badge to README
Fancy stuff ☺
2016-05-02 22:39:18 +02:00
Iustin Pop
04a929ee3b Bump version to 1.3 and update changelog mt-st-1.3 2016-05-02 01:39:05 +02:00
Iustin Pop
5842bbac64 Check the supplied stinit.def file in distcheck 2016-05-02 01:27:12 +02:00
Iustin Pop
95c0789085 Small cleanup: use passed buflen in stinit:next_block
Instead of assuming all passed buffers are DEFMAX, use the given
buflen. Also change some types (int→size_t) since these are all
related to string sizes.
2016-05-02 01:09:36 +02:00
Iustin Pop
22df208f19 Fix config file parsing bug in stinit
There is a long-standing (it was already present in 0.7, so around 15
years) bug in stinit's find_pars function, related to parsing per-mode
configurations. Due to the way the temporary buffers are used, at one
point a strcat() is called on overlapping strings. This is documented
not to work, but it seems the behaviour is not deterministic: for some
pairs of strings it works, for some not (possibly related to distance
between strings, etc.). This results in the fact that parsing the
provided example file fails for _some_ entries, but not for all, with
a seemingly wrong error message (showing snippets of the input file
that do not exist).

Fix this issue in a trivial way by simply using a different (new)
buffer during the mode parsing.
2016-05-02 01:01:30 +02:00
Iustin Pop
ab16fd6bd7 Update the licence file from current kernel sources
Since we still have copies of files from the kernel sources, keep the
kernel version instead of moving to 'plain' GPL-v2 (only trivial
differences exist).

Fixes #5.
2016-05-01 22:24:07 +02:00
Iustin Pop
f3581c5065 Update bug report address and maintainer info man pages 2016-05-01 04:32:15 +02:00
Iustin Pop
d7939d48ca Explicitly remove the old archive in make dist
Currently it's implicitly removed by `tar c`, but that's not nice.
2016-05-01 04:26:37 +02:00
Iustin Pop
396cf8d0db Turn on strict error checks during distcheck
This would have found earlier things such as issue #6, and since it's
only done in distcheck, doesn't impact normal users (for whom
`-Werror` is a bit too strict).
2016-05-01 04:24:43 +02:00
Iustin Pop
58a04729fa Add a few more unused-args annotations
There are no warnings now with -Wextra (which turns on -Wunused-…).
2016-05-01 04:19:19 +02:00
Alexey Svistunov
a0f5b83bd7 Code cleanup patch from SUSE package
This adds annotations for unused arguments to a few functions, and
cleans a bit the typedefs.

Closes #6.
2016-05-01 04:17:00 +02:00
Iustin Pop
aa00a18dc8 Update travis config to run distcheck
This is much more comprehensive than just 'make' since it actually
runs the binaries (--version mode) and checks that the distributed
archive is complete.
2016-05-01 04:04:46 +02:00
Iustin Pop
3421b4d92a Expand distcheck test to check for installed files
This would have prevented issue #4.
2016-05-01 04:03:21 +02:00
Iustin Pop
d56216eecc Fix a few small typos in stinit.def.examples 2016-05-01 03:51:22 +02:00
Alexey Svistunov
9d672b9930 Extend examples by Ultrium LTO-3 definitions
This is definition of HP StorageWorks Ultrium 920 SAS LTO-3 internal
drive.

Closes #7.
2016-05-01 03:50:04 +02:00
Iustin Pop
948c3e649a Remove obsolete -c option to install
This is in reference to issue #4, which was fixed differently by
recent patch.
2016-05-01 03:34:18 +02:00
Iustin Pop
bf3520374f Allow installing the binaries under /usr/
This patch reworks the directory-related variables to allow
installation of binaries under `/usr/[s]bin`, instead of directly
under `/[s]bin`. It also allows installing the man pages under a
different prefix (e.g. `/usr/local`).

Example:

    $ make install EXEC_PREFIX=/usr

will install binaries under `/usr/bin`, respectively `/usr/sbin`. A
full "local" installation under `/usr/local` is accomplished by:

    $ make install EXEC_PREFIX=/usr/local PREFIX=/usr/local

This patch points once again that an autoconf/automake conversion
would make a lot of sense…

Closes #3. Additionally, it fixes a previous bug with installation of
the manual pages.
2016-05-01 03:25:59 +02:00
Iustin Pop
75644f8ccd Allow configuring the default tape device at build time
Also adds displaying it in the version output, and moves this (the
show version code) into a separate function.
2016-05-01 03:00:32 +02:00
Iustin Pop
cbf6e618f7 Merge pull request #9: Add missing includes 2016-05-01 02:38:24 +02:00
Iustin Pop
7d1bb99e5d Add a travis-ci config file
Helps to have pull requests and commits automatically validated.
2016-05-01 02:21:34 +02:00
Kai Mäkisara
6a00368c21 Allow negative argument for mkpartition
Allow negative argument for mtpartition to support kernels >= 4.6.
Update the mt man page.
2016-05-01 02:04:05 +02:00
Felix Janda
a844aeed7c mt.c: Include <sys/sysmacros.h> for minor()
We already do the same in stinit.c.

<sys/macros.h> is currently implicitly included by <sys/types.h>
but this might change in the future.
2016-04-22 18:17:51 +02:00
Felix Janda
0c7dd2a8de Fix compilation with musl libc
It is necessary to include <limits.h> to expose PATH_MAX.
2016-04-22 18:17:06 +02:00
Kai Mäkisara
6edb9f2cc5 Remove the redundant stshowopt command definition
The added stshowoptions allows stshowopt (command parsing accepts
any unambiguous abbreviation).
2016-02-12 21:22:24 +01:00
Kai Mäkisara
dd5afc0eb6 Check for overflow when using k, M or G
Check that using a postfix (k, M, G) with repeat count does not cause
overflow in the int mtop.mt_count.
2016-02-12 21:01:35 +01:00
Kai Mäkisara
b48a42742f Remove obsolete test from do_show_options()
Remove from do_show_options() the now obsolete kernel
version test that has never worked correctly. Problem
reported by Emmanuel Florac.
2016-02-12 20:58:21 +01:00