Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2000 14:10:02 -0700 (PDT)
From:      Kelly Yancey <kbyanc@posi.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/19514: patch to prevent tail'ing directories
Message-ID:  <200006282110.OAA16700@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/19514; it has been noted by GNATS.

From: Kelly Yancey <kbyanc@posi.net>
To: Bruce Evans <bde@zeta.org.au>
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




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