From owner-freebsd-standards@FreeBSD.ORG Sun Jul 28 22:31:58 2013 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 39A4B6F5 for ; Sun, 28 Jul 2013 22:31:58 +0000 (UTC) (envelope-from chrisj@rtems.org) Received: from nschwqsrv03p.mx.bigpond.com (nschwqsrv03p.mx.bigpond.com [61.9.189.237]) by mx1.freebsd.org (Postfix) with ESMTP id C4B422DDE for ; Sun, 28 Jul 2013 22:31:57 +0000 (UTC) Received: from nschwcmgw05p ([61.9.190.165]) by nschwmtas02p.mx.bigpond.com with ESMTP id <20130728203830.FIWS24.nschwmtas02p.mx.bigpond.com@nschwcmgw05p> for ; Sun, 28 Jul 2013 20:38:30 +0000 Received: from kiwi.contemporary.net.au ([58.172.130.193]) by nschwcmgw05p with BigPond Outbound id 5weW1m00K4AWQ0y01weWoW; Sun, 28 Jul 2013 20:38:30 +0000 X-Authority-Analysis: v=2.0 cv=QJDqt33L c=1 sm=1 a=52MaS7aVRqv1DZ1aF93/eg==:17 a=rJ9FApbKPKgA:10 a=keqgt9dXCDEA:10 a=sLc0rD4f83wA:10 a=8nJEP1OIZ-IA:10 a=DU0EyFXtAAAA:8 a=LJf-Lilay-UA:10 a=r7mCciVOk2UeGrPK8RwA:9 a=wPNLvfGTeEIA:10 a=52MaS7aVRqv1DZ1aF93/eg==:117 Received: from takapu.local ([12.104.145.50]) (authenticated bits=0) by kiwi.contemporary.net.au (8.14.7/8.14.5) with ESMTP id r6SKcN0v074171 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Mon, 29 Jul 2013 06:38:25 +1000 (EST) (envelope-from chrisj@rtems.org) X-Authentication-Warning: kiwi.contemporary.net.au: Host [12.104.145.50] claimed to be takapu.local Message-ID: <51F5813D.2030806@rtems.org> Date: Mon, 29 Jul 2013 06:38:21 +1000 From: Chris Johns User-Agent: Postbox 3.0.8 (Macintosh/20130427) MIME-Version: 1.0 To: freebsd-standards@freebsd.org Subject: truncate and open(O_TRUNC) times. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.3 required=5.0 tests=RDNS_NONE autolearn=no version=3.3.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on kiwi.contemporary.net.au X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jul 2013 22:31:58 -0000 Hello, In the RTEMS project we have some test code that appears to fail on FreeBSD. You can find a stripped down version at http://www.rtems.org/ftp/pub/rtems/people/chrisj/fstimes/truncate-time-test.c The code does .. fd = open (file01, O_CREAT | O_WRONLY, mode); n = write (fd, databuf, len); assert (n == len); status = close (fd); assert (status == 0); sleep(2); status = truncate (file01, len); assert (status == 0); The length does not change and given the file does not change our interpretation of the truncate call is the times should not change. In the case of .. fd = open (file03, O_CREAT | O_WRONLY, mode); status = close (fd); assert (status == 0); sleep(2); fd = open (file03, O_TRUNC | O_WRONLY, mode); status = close (fd); assert (status == 0); the times do change as expected. Chris