cat(1) cannot cope with large block size

From: Paul Szabo <psz_at_maths.usyd.edu.au>
Date: Wed, 06 Jun 2001 10:22:51 +1000

There is a problem with the cat(1) command at V5.0 and V5.1: it cannot cope
with block sizes over 8kB. (Compaq broke cat: it worked fine at V4.0.)

We reported this to Compaq in March 2000, and still the problem is not
solved. On 3 May 2001 we got a "patched" cp(1) instead...

Some email exchange for your amusement below.

Paul Szabo - psz_at_maths.usyd.edu.au http://www.maths.usyd.edu.au:8000/u/psz/
School of Mathematics and Statistics University of Sydney 2006 Australia


----------


Date: Wed, 6 Jun 2001 09:50:36 +1000 (EST)
To: Harry.Eleftheriou_at_compaq.com, harrye_at_mail.com, harry_at_stl.dec.com
Subject: RE: AH181079 : cat(1) Update

Dear Harry,

I do not know why you do not understand what I mean. We have repeatedly
stated that the bug is in cat(1), not in cp(1). No amount of fiddling with
cp(1) will fix the problem. I now include a demonstration with dd(1), not
involving cp(1).

On 17 Mar 2000, Jim Richardson wrote to you (this is the original problem
report -- note that the bug has now been outstanding for over 14 months):

  Suppose I write to the tape with the 'cp' command, then 'cat' cannot
  retrieve the correct data. (It is as if the tape was written with 64kB
  blocks, but 'cat' read only the first 8kB off each block.) ...
  It seems likely that the problem is that cat cannot read files with large
  block size, as created by cp.

On 15 Feb 2001 I wrote to you:

  I note that your description on AH181079 "cp/cat does not keep file sizes
  when directed to a tape device" is misleading. The problem occurs from, not
  to. The bug is in cat.

On 3 May 2001 I wrote:

  My problem is with the cat(1) command, not cp(1). I thought that was
  settled...

I then again explained this to you on 18 May 2001:

  The example writes /usr/dict/words, about 200kB, to the tape. When the tape
  is written with cp(1), then cat(1) cannot retrieve the correct data: it
  only gets 32KB instead of the full 200kB. However the data is in fact on
  the tape, as retrieval with cp(1) demonstrates. ...
  The bug is in cat(1): under certain conditions, it is unable to read the
  full data present on the tape. ...
  The bug is not in cp(1) writing the tape. Changing cp(1) to write the tape
  in a way that cat(1) can also read it is no solution: it does not solve the
  problem for tapes that are written in some other way, e.g. for my archived
  tape collection.

Which of the above you do not understand?


In an attempt to make this clearer, here is a demonstration of the problem
using dd(1) to write the tape. I write the tape with several block sizes,
then read the tape. It is seen that cat(1) cannot cope with block sizes
above 8kB, and loses data on larger block sizes. The tape is written
correctly each time: the full data may be recovered using dd(1) or cp(1).

% /sbin/dd if=/usr/dict/words of=/dev/tape/tape0 obs=08k
409+1 records in
25+1 records out
% /sbin/dd if=/dev/tape/tape0 ibs=08k of=out.dd.08k
25+1 records in
409+1 records out
% /sbin/cp /dev/tape/tape0 out.cp.08k
% /sbin/cat < /dev/tape/tape0 > out.cat.08k
% /sbin/dd if=/usr/dict/words of=/dev/tape/tape0 obs=16k
409+1 records in
12+1 records out
% /sbin/dd if=/dev/tape/tape0 ibs=16k of=out.dd.16k
12+1 records in
409+1 records out
% /sbin/cp /dev/tape/tape0 out.cp.16k
% /sbin/cat < /dev/tape/tape0 > out.cat.16k
% /sbin/dd if=/usr/dict/words of=/dev/tape/tape0 obs=32k
409+1 records in
6+1 records out
% /sbin/dd if=/dev/tape/tape0 ibs=32k of=out.dd.32k
6+1 records in
409+1 records out
% /sbin/cp /dev/tape/tape0 out.cp.32k
% /sbin/cat < /dev/tape/tape0 > out.cat.32k
% /sbin/dd if=/usr/dict/words of=/dev/tape/tape0 obs=64k
409+1 records in
3+1 records out
% /sbin/dd if=/dev/tape/tape0 ibs=64k of=out.dd.64k
3+1 records in
409+1 records out
% /sbin/cp /dev/tape/tape0 out.cp.64k
% /sbin/cat < /dev/tape/tape0 > out.cat.64k
% /sbin/ls -l out*
-rw------- 1 psz amstaff 209778 Jun 6 09:30 out.cat.08k
-rw------- 1 psz amstaff 106496 Jun 6 09:31 out.cat.16k
-rw------- 1 psz amstaff 57344 Jun 6 09:32 out.cat.32k
-rw------- 1 psz amstaff 32768 Jun 6 09:33 out.cat.64k
-rw------- 1 psz amstaff 209778 Jun 6 09:30 out.cp.08k
-rw------- 1 psz amstaff 209778 Jun 6 09:31 out.cp.16k
-rw------- 1 psz amstaff 209778 Jun 6 09:32 out.cp.32k
-rw------- 1 psz amstaff 209778 Jun 6 09:33 out.cp.64k
-rw------- 1 psz amstaff 209778 Jun 6 09:30 out.dd.08k
-rw------- 1 psz amstaff 209778 Jun 6 09:31 out.dd.16k
-rw------- 1 psz amstaff 209778 Jun 6 09:32 out.dd.32k
-rw------- 1 psz amstaff 209778 Jun 6 09:33 out.dd.64k

-- 
Paul Szabo - psz_at_maths.usyd.edu.au  http://www.maths.usyd.edu.au:8000/u/psz/
School of Mathematics and Statistics  University of Sydney   2006  Australia
Received on Wed Jun 06 2001 - 00:25:11 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT