Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jun 2007 17:11:01 -0700
From:      Tim Kientzle <kientzle@freebsd.org>
To:        Robin Gruyters <r.gruyters@yirdis.nl>
Cc:        freebsd-stable@freebsd.org
Subject:   Listing tar archives from tape (was Re: Unrecognized archive format with RELENG_6_2 and RELENG_6)
Message-ID:  <4675CD95.9040004@freebsd.org>
In-Reply-To: <20070607153845.24h3nl968skg4scc@server.yirdis.nl>
References:  <20070601114047.z6qgi686os4ogw4o@server.yirdis.nl>	<46658EEB.5000008@freebsd.org>	<20070606084406.8v6nkbtv9csgs880@server.yirdis.nl>	<200706061715.06603.doconnor@gsoft.com.au>	<20070606095820.83tast6s0804osos@server.yirdis.nl>	<46679117.5060909@freebsd.org> <20070607153845.24h3nl968skg4scc@server.yirdis.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------050302020900060504030805
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

>> After that I try to read/list the tar from tape with tar -t:
>> $ sudo tar -tf /dev/sa0
>> archive.dmp
>> tar: Unrecognized archive format: Inappropriate file type or format
>>
>> But when I extract the archive from tape, it works perfectly:
>> $ sudo tar -xvf /dev/sa0

Please try the most recent -STABLE version of libarchive
and bsdtar, with the attached patch.

This simply disables the skip optimization when
reading archives from character or block
devices.

Tim Kientzle

--------------050302020900060504030805
Content-Type: text/x-patch;
 name="libarchive_tape_drive_fix.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="libarchive_tape_drive_fix.patch"

Index: archive_read_open_filename.c
===================================================================
--- archive_read_open_filename.c	(revision 124)
+++ archive_read_open_filename.c	(working copy)
@@ -165,6 +165,15 @@
 	struct read_file_data *mine = (struct read_file_data *)client_data;
 	off_t old_offset, new_offset;
 
+	/*
+	 * Workaround for broken tape interfaces that don't support
+	 * seek(), but return success if you ask them to seek().  This
+	 * also, of course, slows down archive scanning significantly
+	 * on devices that can seek.  Yuck.
+	 */
+	if (S_ISCHR(mine->st_mode) || S_ISBLK(mine->st_mode))
+		return (0);
+
 	/* Reduce request to the next smallest multiple of block_size */
 	request = (request / mine->block_size) * mine->block_size;
 	/*

--------------050302020900060504030805--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4675CD95.9040004>