Subject: bin/1393: install should keep file times
To: None <gnats-bugs@gnats.netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: netbsd-bugs
Date: 08/21/1995 16:53:32
>Number:         1393
>Category:       bin
>Synopsis:       install should keep file times
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 21 11:05:09 1995
>Last-Modified:
>Originator:     Juergen Hannken-Illjes
>Organization:
TU Braunschweig
>Release:        tar files of Aug, 19.
>Environment:
System: NetBSD home 1.0A NetBSD 1.0A (CUSTOM) #6: Sat Aug 19 23:28:47 MET DST 1995 hannken@home:/usr/src/sys/arch/i386/compile/CUSTOM i386

>Description:
It would be nice for install to set the file times of the destination
to those of the source.
Benefits: once we have done
	(cd lib; make all install) and (make all install)
there will be no further actions on subsequent makes.
Reason: all progs depend on libc, which gets a newer time on every install.
	
>How-To-Repeat:
	
>Fix:
--- usr.bin/xinstall/xinstall.c.orig	Tue Aug 15 18:18:30 1995
+++ usr.bin/xinstall/xinstall.c	Sun Aug 20 17:43:08 1995
@@ -49,6 +49,7 @@
 #include <sys/param.h>
 #include <sys/wait.h>
 #include <sys/mman.h>
+#include <sys/time.h>
 #include <sys/stat.h>
 
 #include <ctype.h>
@@ -199,6 +200,7 @@
 	u_int flags;
 {
 	struct stat from_sb, to_sb;
+	static struct timeval tv[2];
 	int devnull, from_fd, to_fd, serrno;
 	char *p;
 
@@ -272,6 +274,12 @@
 	}
 
 	(void)close(to_fd);
+
+	TIMESPEC_TO_TIMEVAL(&tv[0], &from_sb.st_atimespec);
+	TIMESPEC_TO_TIMEVAL(&tv[1], &from_sb.st_mtimespec);
+	if (utimes(to_name, tv))
+		warn("utimes: %s", to_name);
+
 	if (!docopy && !devnull && unlink(from_name))
 		err(1, "%s", from_name);
 }
--- share/mk/bsd.lib.mk.orig	Tue Aug 15 18:13:00 1995
+++ share/mk/bsd.lib.mk	Sun Aug 20 17:46:34 1995
@@ -157,20 +157,20 @@
 #	ranlib lib${LIB}.a
 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
 	    ${DESTDIR}${LIBDIR}
-	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
+#	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
 	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
 .if !defined(NOPROFILE)
 #	ranlib lib${LIB}_p.a
 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
 	    lib${LIB}_p.a ${DESTDIR}${LIBDIR}
-	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
+#	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
 	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
 .endif
 .if !defined(NOPIC)
 #	ranlib lib${LIB}_pic.a
 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
 	    lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
-	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
+#	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
 	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
 .endif
 .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
>Audit-Trail:
>Unformatted: