NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/48060: netbsd32_utimensat() doesn't work



>Number:         48060
>Category:       kern
>Synopsis:       netbsd32_utimensat() doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 18 13:00:01 +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



Home | Main Index | Thread Index | Old Index