Bug 1085 - mt mangles command line when -f option used.
Summary: mt mangles command line when -f option used.
Keywords:
Status: CLOSED DUPLICATE of bug 276
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mt-st
Version: 5.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: David Lawrence
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-02-08 22:51 UTC by t.hespe
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-02-19 18:01:09 UTC
Embargoed:


Attachments (Terms of Use)

Description t.hespe 1999-02-08 22:51:25 UTC
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.au)
Thank you,
              Tim Hespe t.hespe.au

Comment 1 t.hespe 1999-02-09 01:36:59 UTC
This was apparently fixed by the maintainer Kai Makisara
(Kai.Makisara) 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.au)

Comment 2 Jeff Johnson 1999-02-19 18:01:59 UTC
*** 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.