Bug 18 - mt may pass incorrect values in its ioctl() calls
Summary: mt may pass incorrect values in its ioctl() calls
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mt-st   
(Show other bugs)
Version: 5.2
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Preston Brown
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1998-11-10 06:26 UTC by mikpe
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-02-10 21:32:55 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description mikpe 1998-11-10 06:26:41 UTC
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,
&(argv[2]));
+       i = comp->cmd_function(mtfd, comp, argc - argn,
&(argv[argn]));
     else {
        fprintf(stderr, "mt: Internal error: command without
function.\n");
        i = 1;


/Mikael

Comment 1 hargrove 1998-11-25 21:13:59 UTC
This bug is fixed in mt-st-0.5b available from
ftp://sunsite.unc.edu/pub/Linux/system/backup/mt-st-0.5b.tar.gz

Comment 2 Preston Brown 1999-02-10 21:32:59 UTC
this has been fixed in rawhide.

Comment 3 jhart 2000-02-18 13:11:59 UTC
This bug appears to persist in 0.5b.  I still get it on setdensity
with an exb-8200

mt -f /dev/nst0 setdensity 20

Comment 4 jhart 2000-02-19 00:33:59 UTC
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


Note You need to log in before you can comment on or make changes to this bug.