From owner-freebsd-bugs Mon Aug 19 15: 0:16 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D37537B400 for ; Mon, 19 Aug 2002 15:00:11 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C07AB43E4A for ; Mon, 19 Aug 2002 15:00:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7JM0AJU075324 for ; Mon, 19 Aug 2002 15:00:10 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7JM0Al2075323; Mon, 19 Aug 2002 15:00:10 -0700 (PDT) Date: Mon, 19 Aug 2002 15:00:10 -0700 (PDT) Message-Id: <200208192200.g7JM0Al2075323@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: misc/41792: lseek after ftruncate fails Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/41792; it has been noted by GNATS. From: Bruce Evans To: Yury Izrailevsky Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: misc/41792: lseek after ftruncate fails Date: Tue, 20 Aug 2002 07:58:51 +1000 (EST) On Mon, 19 Aug 2002, Yury Izrailevsky wrote: > >Description: > File operation problem. Running the following: > > write(fd, buffer, 8K); > ftruncate(fd, 0); > write(fd, buffer, 1); > off = lseek(fd, 0, SEEK_END); > printf("%d", off); > > Output: 24576, expected: 1. > > The size of the actual file is 1 (if you ls -l on it). However, lseek goes way past it... > > Noticed this while running connectathon rewind test (part of special test suite). But fails even if don't go over NFS but just run on the local file system. > > I suspect the problem is with the FS cache. Or perhaps lseek and/or ftruncate are just broken... This only fails over nfs under -current. stat(2) and thus ls(1) shows that the file size is 24576 until the next read(2) of the file. Then the size becomes 1. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message