From owner-svn-src-all@FreeBSD.ORG Thu Jan 14 11:07:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A54E106566B; Thu, 14 Jan 2010 11:07:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 7B04A8FC12; Thu, 14 Jan 2010 11:07:17 +0000 (UTC) Received: from c122-106-161-214.carlnfd1.nsw.optusnet.com.au (c122-106-161-214.carlnfd1.nsw.optusnet.com.au [122.106.161.214]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o0EB7BmW021064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 14 Jan 2010 22:07:14 +1100 Date: Thu, 14 Jan 2010 22:07:11 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Andrey Chernov In-Reply-To: <20100111121938.GA57442@nagual.pp.ru> Message-ID: <20100114212822.R62635@delplex.bde.org> References: <201001101430.o0AEUURS051917@svn.freebsd.org> <20100110212548.GA47331@nagual.pp.ru> <4B4A5252.9070205@freebsd.org> <20100111134429.F1302@besplex.bde.org> <20100111121938.GA57442@nagual.pp.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Colin Percival , Bruce Evans Subject: Re: svn commit: r201999 - head/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2010 11:07:19 -0000 On Mon, 11 Jan 2010, Andrey Chernov wrote: > On Mon, Jan 11, 2010 at 02:29:03PM +1100, Bruce Evans wrote: >>>> 3) errno should be EOVERFLOW, see other owerflow checks in the stdio. >> >> There are none. I (we?) intentionally didn't set errno when the correct > > F.e. see fseek()/fseeko() stdio checks, as POSIX says: > > [EOVERFLOW] For fseek(), the resulting file offset would be a value which > cannot be represented correctly in an object of type long. > [EOVERFLOW] For fseeko(), the resulting file offset would be a value > which cannot be represented correctly in an object of type off_t. I meant only the i/o functions. Also, vswprintf() returns -1/EOVERFLOW if the buffer is too small, but I don't count it since: - this behaviour is not possible in C99 (no EOVERFLOW, only a negative return value) - this behaviour is not documented in FreeBSD's man page - only th wide char [v]sprintf does this. > Moreover, POSIX tends to introduce EOVERFLOW now in many places like > old system calls too, see read()/pread(): > > [EOVERFLOW] The file is a regular file, nbyte is greater than 0, the > starting position is before the end-of-file, and the starting position is > greater than or equal to the offset maximum established in the open file > description associated with fildes. > > (IEEE P1003.1 Draft 5.1 Issue 7 quoted in both cases) I know, since you fixed this in part of FreeBSD, and I cleaned up the fixes :-). This reminds me that the fixes are incomplete, with most file systems except ffs being unmaintained even if they were cloned from ffs. In /sys/fs only the following file systems reference EOVERFLOW: smbfs (!?), nfs. Many file systems there have a maxfilesize (variable) limit and many others have a compile-time limit. Similarly for /sys/gnu/fs except things are harder to find there. Just noticed a related delicate bug: For write(), the corresponding (and much older) error is EFBIG. POSIX says that it occurs when there is no space to write any bytes, but ffs_write() gives it when there is no space to write all the bytes. Since most programs don't understand short writes, the FreeBSD behaviour is safer. Bruce