bin/111711: cat(1) misbehaves with directories as parameters

Ricardo Nabinger Sanchez rnsanchez at wait4.org
Tue Apr 17 16:38:00 UTC 2007


On Tue, 17 Apr 2007 18:49:52 +1000 (EST)
Charlie ROOT <root at zeta.org.au> wrote:

> >> Description:
> > If a directory is passed to cat, it outputs its contents, (sometimes)
> > mangles the terminal, and may misbehave, like in the second run with ".
> > Makefile" as parameters.
> 
> This is the expected behaviour.  Directories are files, and directory files
> are readable except on broken file systems.

You mean UFS2?  :)

% mount
/dev/ad1s3a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad1s2d on /home (ufs, local, soft-updates)
/dev/ad1s3d on /tmp (ufs, local, soft-updates)
procfs on /proc (procfs, local)

(The test was under /home.)

Thanks for the info.  In any case, cat do misbehave when both directories and
files are passed as parameters, as it doesn't cat anything else after the
directory:

% cat -n Makefile Makefile . Makefile Makefile
     1  #       @(#)Makefile    8.1 (Berkeley) 5/31/93
     2  # $FreeBSD: src/bin/cat/Makefile,v 1.7 2001/12/04 01:57:37 obrien Exp
$ 3
     4  PROG=   cat
     5
     6  .include <bsd.prog.mk>
     1  #       @(#)Makefile    8.1 (Berkeley) 5/31/93
     2  # $FreeBSD: src/bin/cat/Makefile,v 1.7 2001/12/04 01:57:37 obrien Exp
$ 3
     4  PROG=   cat
     5
     6  .include <bsd.prog.mk>
     1  !g
          .cat.1.gzÙåø.Øö/~...src/usr.bin/cat%


Regards.

-- 
Ricardo Nabinger Sanchez     <rnsanchez@{gmail.com,wait4.org}>
Powered by FreeBSD

  "Left to themselves, things tend to go from bad to worse."


More information about the freebsd-bugs mailing list