GNU bug report logs - #17384
"bug" in the Unix "cat" command

Previous Next

Package: coreutils;

Reported by: Peter Rowat <peter <at> pelican.ucsd.edu>

Date: Thu, 1 May 2014 19:12:02 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Peter Rowat <peter <at> pelican.ucsd.edu>
To: 17384 <at> debbugs.gnu.org
Subject: bug#17384: "bug" in the Unix "cat" command
Date: Thu, 1 May 2014 11:50:38 -0700
[Message part 1 (text/plain, inline)]
Hello Gnu folks,

  I had 3 files  matching “isi.*.02p0:

wc -l isi.*.02p0
   20000 isi.R.0400.02p0
   15500 isi.Ra.0400.02p0
   15600 isi.Rb.0400.02p0
   51100 total

I wanted to combine them into one big file, while knowing *not* to cat into a file with same name as an original file,
 I did this:

cat isi.*.02p0 >isi.Rall.0400.02p0


But it never returned!! 
By the time I hit Ctrl-C, the file isi.Rall.0400.02p0 was already 3000 times bigger than the biggest of the original files.

A hidden loop was made. 

Because the destination file was created before concatenation started, it became a match for the
pattern "isi.*.02p0”.

It might be worth adding a warning about this on the  cat man-page ??

Cheers,

— Peter Rowat
[Message part 2 (text/html, inline)]

This bug report was last modified 10 years and 356 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.