Red Hat Bugzilla – Bug 18
mt may pass incorrect values in its ioctl() calls
Last modified: 2008-05-01 11:37:48 EDT
RH 5.2's "mt" command is built from mt-st-0.5, which
contains a rather annoying bug.
The bug occurs when (a) the -f <device> option is used,
and (b) a command is given which requires a "count" or
some subcommands, eg. "mt -f /dev/nftape drvbuffer 16".
The bug is that in these cases, the count/subcommands are
read from the wrong elements of main()'s argv, as if
the -f option wasn't given, leading to incorrect values
being passed in ioctl calls to the tape's device driver.
A temporary workaround is to avoid the -f option, and
instead set TAPE=<your tape device> in the environment.
The proper fix is to apply the following trivial patch:
--- mt-st-0.5/mt.c.~1~ Sat Apr 11 16:58:25 1998
+++ mt-st-0.5/mt.c Tue Nov 10 11:02:11 1998
@@ -282,7 +282,7 @@
mtfd = (-1);
if (comp->cmd_function != NULL)
- i = comp->cmd_function(mtfd, comp, argc - 2,
+ i = comp->cmd_function(mtfd, comp, argc - argn,
fprintf(stderr, "mt: Internal error: command without
i = 1;
This bug is fixed in mt-st-0.5b available from
this has been fixed in rawhide.
This bug appears to persist in 0.5b. I still get it on setdensity
with an exb-8200
mt -f /dev/nst0 setdensity 20
further investigation indicates the arguments are passed correctly by mt-st
0.5b, but the ioctl() is rejected by the driver or the exb-8200, so it is not
the same bug after all