Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Apr 2007 13:37:49 -0300
From:      Ricardo Nabinger Sanchez <rnsanchez@wait4.org>
To:        Charlie ROOT <root@zeta.org.au>
Cc:        freebsd-bugs@freebsd.org, freebsd-gnats-submit@freebsd.org
Subject:   Re: bin/111711: cat(1) misbehaves with directories as parameters
Message-ID:  <20070417133749.bf710cec.rnsanchez@wait4.org>
In-Reply-To: <20070417184639.F4118@besplex.bde.org>
References:  <200704161750.l3GHoPvi047606@www.freebsd.org> <20070417184639.F4118@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 17 Apr 2007 18:49:52 +1000 (EST)
Charlie ROOT <root@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.
>=20
> This is the expected behaviour.  Directories are files, and directory fil=
es
> 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 a=
nd
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 E=
xp
$ 3
     4  PROG=3D   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 E=
xp
$ 3
     4  PROG=3D   cat
     5
     6  .include <bsd.prog.mk>
     1  !g
          .cat.1.gz=D9=E5=F8.=D8=F6/~...src/usr.bin/cat%


Regards.

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

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070417133749.bf710cec.rnsanchez>