NetBSD Problem Report #38413
From taca@back-street.net Sat Apr 12 11:27:16 2008
Return-Path: <taca@back-street.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 1B54063B8C8
for <gnats-bugs@gnats.NetBSD.org>; Sat, 12 Apr 2008 11:27:16 +0000 (UTC)
Message-Id: <20080412101155.3C0785D876@ns.back-street.net>
Date: Sat, 12 Apr 2008 19:11:55 +0900 (JST)
From: taca@back-street.net
Reply-To: taca@back-street.net
To: gnats-bugs@gnats.NetBSD.org
Subject: mt(1) print some junk output when using remote tape
X-Send-Pr-Version: 3.95
>Number: 38413
>Category: bin
>Synopsis: mt(1) print some junk output when using remote tape
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Apr 12 11:30:00 +0000 2008
>Closed-Date: Sat Nov 19 16:32:13 +0000 2011
>Last-Modified: Sat Nov 19 16:32:13 +0000 2011
>Originator: Takahiro Kambe
>Release: NetBSD 4.0_STABLE
>Organization:
>Environment:
System: NetBSD ns.back-street.net 4.0_STABLE NetBSD 4.0_STABLE (EPIA) #7: Sat Mar 22 17:53:01 JST 2008 taca@boy.a.back-street.net:/data/i386/obj4/sys/arch/i386/compile/EPIA i386
Architecture: i386
Machine: i386
>Description:
NetBSD's mt(1) support remote tape which dosen't exist old
4.3 (or 4.4?) BSD days.
But when print tape's status, it output some junk output.
>How-To-Repeat:
% mt -f remote:/dev/nrst0 status
SCSI tape drive, residual=0
ds=3<Mounted>
er=0
blocksize: 0 (-1077942312, -1145412916, -1145206232, -1077942196)
density: 64 (-1077942312, -1145412809, -1145087944, 0)
current file number: 25
current block number: -1
When locally execute it:
% mt stat
SCSI tape drive, residual=0
ds=3<Mounted>
er=0
blocksize: 0 (0, 0, 0, 0)
density: 64 (0, 0, 0, 0)
current file number: 25
current block number: -1
>Fix:
Original rmt protocol supports only 24 bytes for room which
return MTIOCGET ioctl()'s result and remaining fields of
mtget structure aren't aveilable: mt_blksiz, mt_density,
mt_mblksiz and mt_mdensity.
If mt(1) handles remote tape, it should be clear these field
or don't display correspoding information.
>Release-Note:
>Audit-Trail:
From: Takahiro Kambe <taca@back-street.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/38413: mt(1) print some junk output when using remote tape
Date: Mon, 23 May 2011 16:12:08 +0900 (JST)
This is fairly an old problem and I sent wrong address long ago.
The attached patch solves mt(1) shows illegal output which dosen't
supported by rmt protocol. And we should add a note to librmt(3) or
mt(1) that not all mt(1)'s output are supported when using remote
tape.
--
Takahiro Kambe <taca@back-street.net>
Message-Id: <20080422.120322.59485195.taca@back-street.net>
Subject: Re: bin/38413: mt(1) print some junk output when using remote tape
Date: Tue, 22 Apr 2008 12:03:22 +0900 (JST)
From: Takahiro Kambe <taca@back-street.net>
To: gnats-admin@netbsd.org
X-Mailer: Mew version 5.2 on Emacs 22.1 / Mule 5.0 (SAKAKI)
X-Antivirus: Scanned by F-Prot Antivirus (http://www.f-prot.com)
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
This is simple patch for librmt(3) which avoid return junk to mt(1).
Works for me but it isn't tested well.
Index: lib/librmt/rmtlib.c
===================================================================
RCS file: /cvs/src-4/lib/librmt/rmtlib.c,v
retrieving revision 1.1.1.1
diff -u -p -d -u -r1.1.1.1 rmtlib.c
--- lib/librmt/rmtlib.c 7 Feb 2007 01:42:25 -0000 1.1.1.1
+++ lib/librmt/rmtlib.c 22 Apr 2008 01:40:50 -0000
@@ -534,6 +534,7 @@ _rmt_ioctl(int fildes, unsigned long op,
if (command(fildes, "S") == -1 || (rv = status(fildes)) == -1)
return (-1);
+ memset(arg, '\0', sizeof(struct mtget));
for (rc = rv, p = arg; rc > 0; rc -= cnt, p += cnt) {
if ((cnt = read(READ(fildes), p, rc)) <= 0) {
rmtabort(fildes);
--
Takahiro Kambe <taca@back-street.net>
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/38413 CVS commit: src/lib/librmt
Date: Tue, 31 May 2011 08:24:33 -0400
Module Name: src
Committed By: christos
Date: Tue May 31 12:24:33 UTC 2011
Modified Files:
src/lib/librmt: rmtlib.c
Log Message:
PR/38413: Takahiro Kambe: mt(1) print some junk output when using remote tape
Not all fields are valid in the ioctl to get tape info in the rmt protocol.
Zero out the struct so that we don't print junk.
While here, KNF.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/librmt/rmtlib.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 14 Aug 2011 21:59:00 +0000
State-Changed-Why:
pullup-5 #1660, pullup-4 #1432
From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/38413 CVS commit: [netbsd-5] src/lib/librmt
Date: Sat, 17 Sep 2011 18:50:46 +0000
Module Name: src
Committed By: bouyer
Date: Sat Sep 17 18:50:46 UTC 2011
Modified Files:
src/lib/librmt [netbsd-5]: rmtlib.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1660):
lib/librmt/rmtlib.c: revisions 1.23, 1.24
Improve isrmt() check: it cannot be a rmt fd if there are no pipes
open for the fd. Prevents collision with rumphijack.
Also, prevent potential hyperspace memory access.
Does someone want to write tests for this facility?
PR/38413: Takahiro Kambe: mt(1) print some junk output when using remote tape
Not all fields are valid in the ioctl to get tape info in the rmt protocol.
Zero out the struct so that we don't print junk.
While here, KNF.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.26.1 src/lib/librmt/rmtlib.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/38413 CVS commit: [netbsd-4] src/lib/librmt
Date: Sat, 19 Nov 2011 14:18:29 +0000
Module Name: src
Committed By: bouyer
Date: Sat Nov 19 14:18:29 UTC 2011
Modified Files:
src/lib/librmt [netbsd-4]: rmtlib.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1432):
lib/librmt/rmtlib.c: revision 1.23
lib/librmt/rmtlib.c: revision 1.24
Improve isrmt() check: it cannot be a rmt fd if there are no pipes
open for the fd. Prevents collision with rumphijack.
Also, prevent potential hyperspace memory access.
Does someone want to write tests for this facility?
PR/38413: Takahiro Kambe: mt(1) print some junk output when using remote tape
Not all fields are valid in the ioctl to get tape info in the rmt protocol.
Zero out the struct so that we don't print junk.
While here, KNF.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.4.1 src/lib/librmt/rmtlib.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 19 Nov 2011 16:32:13 +0000
State-Changed-Why:
Pulled up.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.