Subject: bin/31054: struct stat broken on LP64 with !defined(_NETBSD_SOURCE)
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <mrt@notwork.org>
List: netbsd-bugs
Date: 08/24/2005 07:51:00
>Number:         31054
>Category:       bin
>Synopsis:       struct stat broken on LP64 with !defined(_NETBSD_SOURCE)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 24 07:51:00 +0000 2005
>Originator:     mrt@notwork.org
>Release:        NetBSD 3.99.8
>Organization:
>Environment:
System: NetBSD fons-adae 3.99.8 NetBSD 3.99.8 (WILLIAM) #42: Tue Aug 23 19:12:30 JST 2005 mrt@fons-adae:/sys/arch/amd64/compile/WILLIAM amd64
Architecture: x86_64
Machine: amd64
>Description:
After size of ino_t has beed chaged, struct stat has unneeded padding if
LP64 and !defined(_NETBSD_SOURCE). This causes some problems around stat()
calls.  Especially, broken nbinstall is made while tool build.
>How-To-Repeat:
"sh build.sh tools" on amd64 (or other LP64) NetBSD host.
Print "offsetof(struct stat, st_size)" with !defined(_NETBSD_SOURCE).
>Fix:
Apply following to /sys/sys/stat.h.

Index: stat.h
===================================================================
RCS file: /home/mrt/src/netbsdcvs/src/sys/sys/stat.h,v
retrieving revision 1.49
diff -u -r1.49 stat.h
--- stat.h	19 Aug 2005 02:04:04 -0000	1.49
+++ stat.h	24 Aug 2005 07:18:32 -0000
@@ -159,18 +159,17 @@
 	struct	  timespec st_ctimespec;/* time of last file status change */
 	struct 	  timespec st_birthtimespec; /* time of creation */
 #else
-	__STATPAD(__pad0)
 	time_t	  st_atime;		/* time of last access */
-	__STATPAD(__pad1)
+	__STATPAD(__pad0)
 	long	  st_atimensec;		/* nsec of last access */
 	time_t	  st_mtime;		/* time of last data modification */
-	__STATPAD(__pad2)
+	__STATPAD(__pad1)
 	long	  st_mtimensec;		/* nsec of last data modification */
 	time_t	  st_ctime;		/* time of last file status change */
-	__STATPAD(__pad3)
+	__STATPAD(__pad2)
 	long	  st_ctimensec;		/* nsec of last file status change */
 	time_t	  st_birthtime;		/* time of creation */
-	__STATPAD(__pad4)
+	__STATPAD(__pad3)
 	long	  st_birthtimensec;	/* nsec of time of creation */
 #endif
 	off_t	  st_size;		/* file size, in bytes */