From owner-freebsd-arch@FreeBSD.ORG Tue Jul 27 16:36:52 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F07BD16A4D4; Tue, 27 Jul 2004 16:36:52 +0000 (GMT) Received: from out014.verizon.net (out014pub.verizon.net [206.46.170.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id 918DC43D2F; Tue, 27 Jul 2004 16:36:52 +0000 (GMT) (envelope-from babkin@bellatlantic.net) Received: from bellatlantic.net ([138.89.157.57]) by out014.verizon.net (InterMail vM.5.01.06.06 201-253-122-130-106-20030910) with ESMTP id <20040727163650.UYMC24490.out014.verizon.net@bellatlantic.net>; Tue, 27 Jul 2004 11:36:50 -0500 Sender: root@FreeBSD.ORG Message-ID: <410684A0.5C65ED42@bellatlantic.net> Date: Tue, 27 Jul 2004 12:36:48 -0400 From: Sergey Babkin X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 4.7-RELEASE i386) X-Accept-Language: en, ru MIME-Version: 1.0 To: Giorgos Keramidas References: <20040718184008.GC57678@darkness.comp.waw.pl> <20040719075952.GG57678@darkness.comp.waw.pl> <20040719.081356.51946167.imp@bsdimp.com> <200407191855.19885.max@love2party.net> <4105987E.5FC50517@bellatlantic.net> <20040727032253.GA24778@gothmog.gr> <20040727032917.GA24942@gothmog.gr> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Authentication-Info: Submitted using SMTP AUTH at out014.verizon.net from [138.89.157.57] at Tue, 27 Jul 2004 11:36:49 -0500 cc: Max Laier cc: pjd@freebsd.org cc: zeratul2@wanadoo.es cc: nsouch@free.fr cc: freebsd-arch@freebsd.org Subject: Re: some PRs X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2004 16:36:53 -0000 Giorgos Keramidas wrote: > > On 2004-07-26 19:49, Sergey Babkin wrote: > > Max Laier wrote: > > > The question to me is, do we really want to support (read fertilize) > > > such a stupid thing? Given the chance that once we do support it > > > people will use it. In my opinion it is bad to integrate something > > > into base that we agree is nothing one should ever have created (at > > > least that's my reading of the thread so far). I see no user-pessure > > > for this. > > > > I'm about a week behind :-) but here are my 2 cents: it's a VERY > > useful device for testing. Not checking the error code of write(), > > printf() and such is a typical bug, so making it easy to detect by > > switching the output to /dev/full (or creating a symlink to it) is a > > very good idea. Like this: > > > > yourprogram >/dev/full \ > > && echo "The program does not check for success of write()" > > If a program doesn't check the return code of write() but merrily goes > on doing other stuff or even terminates with a zero return value, how > will the redirection affect its operation? I think it won't, as shown > in the test below (run on a Linux machine): If you run a test in which you know the program must fail (such as writing to /dev/full) yet it does not, this means that there is abug in the program. > : $ ls -ld /dev/full > : crw-rw-rw- 1 root root 1, 7 Jun 14 00:24 /dev/full > : $ cat -n lala.c > : 1 #include > : 2 #include > : 3 #include > : 4 > : 5 int > : 6 main(void) > : 7 { > : 8 char buf[] = "hello world\n"; > : 9 size_t len; > : 10 > : 11 len = strlen(buf); > : 12 write(1, buf, len); > : 13 return 0; > : 14 } > : $ cc -O -W -Wall -o lala lala.c > : $ ./lala > : hello world > : $ ./lala >/dev/full > : $ echo $? > : 0 > : $ > > The fact that /dev/full was used as the output device didn't reveal the > potential write() problem. That's _exactly my point: if the program writes to /dev/full and yet does produce an error exit code or an error message, there is a bug in the program. > I must have misunderstood something. How do you mean that we could use > /dev/full for testing? Well, as described above: for each file that your program can produce, try to substitute it with /dev/full and watch the prgoram fail. If it does not fail, there is a bug. That's much easier than producing an actual full filesystem. -SB