From owner-freebsd-bugs Wed Jun 28 14:10:11 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id ED29737C136 for ; Wed, 28 Jun 2000 14:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id OAA16700; Wed, 28 Jun 2000 14:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Wed, 28 Jun 2000 14:10:02 -0700 (PDT) Message-Id: <200006282110.OAA16700@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Kelly Yancey Subject: Re: bin/19514: patch to prevent tail'ing directories Reply-To: Kelly Yancey Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/19514; it has been noted by GNATS. From: Kelly Yancey To: Bruce Evans Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/19514: patch to prevent tail'ing directories Date: Wed, 28 Jun 2000 17:01:36 -0400 (EDT) On Tue, 27 Jun 2000, Bruce Evans wrote: > POSIX.2 (in the old draft that I have) specifically requires "tail -c" > to accept arbitrary data. tail(1) without -c is only required to handle > text files. head(1) is only required to handle text files. cat(1) is > required to handle all types of files. Hmm. Sounds like a misfeature of POSIX :( What sense can cat/head/tailing a directory possibly make. > > > patch alerts the user when they try to tail a directory. In > > addition, it also adds checks for reading symlink contents and > > whiteout entries, however I can't imagine how either of these > > scenarios would occur. > > At least the symlink case can't happen, so don't obfuscate the code > checking for it. Noted. Personally, I like leaving tidbits like that in my source code so I can remember why I did (or did not do) things. > > > --- usr.bin/tail/tail.c.orig Mon Jun 26 01:30:01 2000 > > +++ usr.bin/tail/tail.c Mon Jun 26 01:38:38 2000 > > @@ -171,6 +171,16 @@ > > ierr(); > > continue; > > } > > + if (sb.st_mode & S_IFDIR) > > + errx(1, "%s is a directory", fname); > > Exiting for a non-error is a bug. The current tail(1) doesn't even exit > for errors on individual files. > > Bruce Also noted. If the POSIX hadn't ruled the current (in my opinion, broken) behaviour to be the law, then I would fix the patch. As it stands, I regretfully have to ask for the PR be closed and declare this bug a feature. :( Kelly -- Kelly Yancey - kbyanc@posi.net - Belmont, CA System Administrator, eGroups.com http://www.egroups.com/ Maintainer, BSD Driver Database http://www.posi.net/freebsd/drivers/ Coordinator, Team FreeBSD http://www.posi.net/freebsd/Team-FreeBSD/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message