NetBSD Problem Report #48060

From nakayosh@leto.eonet.ne.jp  Thu Jul 18 12:55:54 2013
Return-Path: <nakayosh@leto.eonet.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 766C571DEF
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 18 Jul 2013 12:55:54 +0000 (UTC)
Message-Id: <20130718125551.7BA7D91B73C@ae0000-mailauth13.eo.k-opti.ad.jp>
Date: Thu, 18 Jul 2013 21:55:51 +0900 (JST)
From: nakayosh@leto.eonet.ne.jp
Reply-To: nakayosh@leto.eonet.ne.jp
To: gnats-bugs@NetBSD.org
Subject: netbsd32_utimensat() doesn't work
X-Send-Pr-Version: 3.95

>Number:         48060
>Category:       kern
>Synopsis:       netbsd32_utimensat() doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 18 13:00:01 +0000 2013
>Closed-Date:    Wed Oct 09 13:27:36 +0000 2013
>Last-Modified:  Wed Oct 09 13:27:36 +0000 2013
>Originator:     NAKAJIMA Yoshihiro
>Release:        NetBSD-current/20130712
>Organization:
>Environment:
System: NetBSD asura 6.99.23 NetBSD 6.99.23 (ASURA) #1: Fri Jul 12 20:39:14 JST 2013 nakayosh@asura:/usr/src/sys/arch/amd64/compile/ASURA amd64
Architecture: x86_64
Machine: amd64
>Description:

The following program compiled on i386 doesn't work on amd64.

> % cat utimensat.c
> #include <sys/time.h>
> #include <sys/stat.h>
> 
> #include <fcntl.h>
> 
> #define FILENAME "TEST"
> 
> int main(void)
> {
> 	struct timespec times[] = {
> 		{ 111111111ULL | 222222222ULL << 32, 333333333 }, /* atime */
> 		{ 444444444ULL | 555555555ULL << 32, 666666666 }, /* mtime */
> 
> 		{ 777777777ULL | 888888888ULL << 32, 0 } /*essentially garbage*/
> 	};
> 	utimensat(AT_FDCWD, FILENAME, times, 0);
> 	return 0;
> }

>How-To-Repeat:

On i386 it works, of course.
Note: Because MFS can't store 64bit time_t, upper 32bit data will be overflowed.

> i386% cd /mfs
> i386% cc -static utimensat.c
> i386% file a.out
> a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for NetBSD 6.99.23, not stripped
> i386% touch TEST
> i386% ./a.out
> i386% stat -f 'atime=%Fa%nmtime=%Fm' TEST
> atime=111111111.333333333
> mtime=444444444.666666666


But on amd64, it doesn't.

> amd64% cd /mfs
> amd64% file a.out
> a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for NetBSD 6.99.23, not stripped
> amd64% touch TEST
> amd64% ./a.out
> amd64% stat -f 'atime=%Fa%nmtime=%Fm' TEST
> atime=111111111.333333333
> mtime=555555555.777777777

>Fix:

N/A

>Release-Note:

>Audit-Trail:
From: "Matt Thomas" <matt@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48060 CVS commit: src/sys/compat/netbsd32
Date: Thu, 18 Jul 2013 14:07:43 +0000

 Module Name:	src
 Committed By:	matt
 Date:		Thu Jul 18 14:07:43 UTC 2013

 Modified Files:
 	src/sys/compat/netbsd32: netbsd32_fs.c

 Log Message:
 Deal with timespecs properly in futimens and utimensat.
 PR/48060


 To generate a diff of this commit:
 cvs rdiff -u -r1.65 -r1.66 src/sys/compat/netbsd32/netbsd32_fs.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 04:00:15 +0000
State-Changed-Why:
fixed?


From: NAKAJIMA Yoshihiro <nakayosh@leto.eonet.ne.jp>
To: gnats-bugs@NetBSD.org, dholland@NetBSD.org
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org,
 gnats-admin@netbsd.org
Subject: Re: kern/48060 (netbsd32_utimensat() doesn't work)
Date: Wed, 09 Oct 2013 22:22:38 +0900 (JST)

 On Mon,  7 Oct 2013 04:00:15 +0000 (UTC),
 dholland@NetBSD.org wrote:

 > Synopsis: netbsd32_utimensat() doesn't work
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: dholland@NetBSD.org
 > State-Changed-When: Mon, 07 Oct 2013 04:00:15 +0000
 > State-Changed-Why:
 > fixed?

 Yes.  Please close the PR. thanks!

State-Changed-From-To: feedback->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Wed, 09 Oct 2013 13:27:36 +0000
State-Changed-Why:
Confirmed fixed, thanks for the PR!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.