Bug 1085 - mt mangles command line when -f option used.
mt mangles command line when -f option used.
Status: CLOSED DUPLICATE of bug 276
Product: Red Hat Linux
Classification: Retired
Component: mt-st (Show other bugs)
5.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-02-08 17:51 EST by t.hespe
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-02-19 13:01:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description t.hespe 1999-02-08 17:51:25 EST
There is a problem in the way mt handles command line
arguments.
If the "-f device" option is specified, subsequent
arguments are mangled such that "count" always becomes 0
or "arguments" are misinterpreted.
Here are some examples. (The SCSI tape driver st.c has been
compiled with debugging enabled.)
(1)Forward space the tape using the norewind device:

bash# mt -f /dev/nst0 fsf 1
Detected scsi tape st0 at scsi1, channel 0, id 3, lun 0
st: Buffer size 32768 bytes, write threshold 30720 bytes.
st: Allocated tape buffer 0 (32768 bytes, dma: 1, a:
00f98000).
st: Allocated tape buffer 1 (32768 bytes, dma: 1, a:
00f90000).
st0: Block limits 1 - 16777215 bytes.
st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8
st0: Density 25, tape length: 0, drv buffer: 1
st0: Block size: 0, buffer size: 32768 (1 blocks).
st0: Spacing tape forward over 0 filemarks.
st0: arg = 0.

Please note: the last displayed line "st0: arg = 0.",
from the st driver was added by me, it is not part of the
driver as distributed.

(2) Set the "debug" argument to the "stoptions" operation
while using the "-f" option:

bash# mt -f /dev/nst0 stoptions debug
Detected scsi tape st0 at scsi1, channel 0, id 3, lun 0
st: Buffer size 32768 bytes, write threshold 30720 bytes.
st: Allocated tape buffer 0 (32768 bytes, dma: 1, a:
00f98000).
st: Allocated tape buffer 1 (32768 bytes, dma: 1, a:
00f90000).
st0: Block limits 1 - 16777215 bytes.
st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8
st0: Density 25, tape length: 0, drv buffer: 1
st0: Block size: 0, buffer size: 32768 (1 blocks).
Illegal property name '/dev/nst0'.
The implemented property names are:
  buffer-writes -> buffered writes
  async-writes -> asynchronous writes
  read-ahead -> read-ahead for fixed block size
      debug -> debugging (if compiled into driver)
    two-fms -> write two filemarks when file closed
   fast-eod -> space directly to eod (and lose file number)
  auto-lock -> automatically lock/unlock drive door
  def-writes -> the block size and density are for writes
    can-bsr -> drive can space backwards well
  no-blklimits -> drive doesn't support read block limits
  can-partitions -> drive can handle partitioned tapes
  scsi2logical -> logical block addresses used with SCSI-2
bash#

Here is a possible fix:

*** mt.c.orig   Sun Apr 12 00:58:25 1998
--- mt.c        Mon Feb  8 17:08:10 1999
***************
*** 282,288 ****
        mtfd = (-1);

      if (comp->cmd_function != NULL)
!       i = comp->cmd_function(mtfd, comp, argc - 2, &(argv
[2]));
      else {
        fprintf(stderr, "mt: Internal error: command without
function.\n");
        i = 1;
--- 282,288 ----
        mtfd = (-1);

      if (comp->cmd_function != NULL)
!       i = comp->cmd_function(mtfd, comp, argc - argn,
argv + argn);
      else {
        fprintf(stderr, "mt: Internal error: command without
function.\n");
        i = 1;


---------------------------
The author of the fix was Geoff Hort (g.hort@unsw.edu.au)
Thank you,
              Tim Hespe t.hespe@unsw.edu.au
Comment 1 t.hespe 1999-02-08 20:36:59 EST
This was apparently fixed by the maintainer Kai Makisara
(Kai.Makisara@metla.fi) on August 15 1998. I would have thought it
could have made it into 5.2. This has also been reported before in
reports 577 and 691. Neither is flagged as fixed.

Tim Hespe (t.hespe@unsw.edu.au)
Comment 2 Jeff Johnson 1999-02-19 13:01:59 EST
*** This bug has been marked as a duplicate of 276 ***

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