From owner-svn-src-all@freebsd.org Mon May 16 12:56:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24459B3CA66; Mon, 16 May 2016 12:56:30 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DABDD1865; Mon, 16 May 2016 12:56:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4GCuTC0080660; Mon, 16 May 2016 12:56:29 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4GCuSOO080658; Mon, 16 May 2016 12:56:28 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201605161256.u4GCuSOO080658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Mon, 16 May 2016 12:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299942 - in head/usr.bin/xinstall: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2016 12:56:30 -0000 Author: jilles Date: Mon May 16 12:56:28 2016 New Revision: 299942 URL: https://svnweb.freebsd.org/changeset/base/299942 Log: install: Revert utimensat usage (r299850). This should fix the build on older stable/10, since install is a bootstrap tool. Pending a decision how to fix this properly, revert utimensat usage. Copies with the -p option will again appear older than the original almost always, but -p is not commonly used. Modified: head/usr.bin/xinstall/tests/install_test.sh head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/tests/install_test.sh ============================================================================== --- head/usr.bin/xinstall/tests/install_test.sh Mon May 16 12:18:30 2016 (r299941) +++ head/usr.bin/xinstall/tests/install_test.sh Mon May 16 12:56:28 2016 (r299942) @@ -64,12 +64,6 @@ copy_to_nonexistent_backup_safe_body() { copy_to_nonexistent_with_opts -b -B.bak -S } -atf_test_case copy_to_nonexistent_preserving -copy_to_nonexistent_preserving_body() { - copy_to_nonexistent_with_opts -p - [ ! testf -ot copyf ] || atf_fail "bad timestamp 2" -} - copy_self_with_opts() { printf 'test\n123\r456\r\n789\0z' >testf printf 'test\n123\r456\r\n789\0z' >testf2 @@ -313,7 +307,6 @@ atf_init_test_cases() { atf_add_test_case copy_to_nonexistent_safe_comparing atf_add_test_case copy_to_nonexistent_backup atf_add_test_case copy_to_nonexistent_backup_safe - atf_add_test_case copy_to_nonexistent_preserving atf_add_test_case copy_self atf_add_test_case copy_self_safe atf_add_test_case copy_self_comparing Modified: head/usr.bin/xinstall/xinstall.c ============================================================================== --- head/usr.bin/xinstall/xinstall.c Mon May 16 12:18:30 2016 (r299941) +++ head/usr.bin/xinstall/xinstall.c Mon May 16 12:56:28 2016 (r299942) @@ -131,7 +131,7 @@ static void do_symlink(const char *, con static void makelink(const char *, const char *, const struct stat *); static void install(const char *, const char *, u_long, u_int); static void install_dir(char *); -static void metadata_log(const char *, const char *, struct timespec *, +static void metadata_log(const char *, const char *, struct timeval *, const char *, const char *, off_t); static int parseid(const char *, id_t *); static void strip(const char *); @@ -722,7 +722,7 @@ static void install(const char *from_name, const char *to_name, u_long fset, u_int flags) { struct stat from_sb, temp_sb, to_sb; - struct timespec tsb[2]; + struct timeval tvb[2]; int devnull, files_match, from_fd, serrno, target; int tempcopy, temp_fd, to_fd; char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN]; @@ -857,9 +857,11 @@ install(const char *from_name, const cha * Need to preserve target file times, though. */ if (to_sb.st_nlink != 1) { - tsb[0] = to_sb.st_atim; - tsb[1] = to_sb.st_mtim; - (void)utimensat(AT_FDCWD, tempfile, tsb, 0); + tvb[0].tv_sec = to_sb.st_atime; + tvb[0].tv_usec = 0; + tvb[1].tv_sec = to_sb.st_mtime; + tvb[1].tv_usec = 0; + (void)utimes(tempfile, tvb); } else { files_match = 1; (void)unlink(tempfile); @@ -914,9 +916,11 @@ install(const char *from_name, const cha * Preserve the timestamp of the source file if necessary. */ if (dopreserve && !files_match && !devnull) { - tsb[0] = from_sb.st_atim; - tsb[1] = from_sb.st_mtim; - (void)utimensat(AT_FDCWD, to_name, tsb, 0); + tvb[0].tv_sec = from_sb.st_atime; + tvb[0].tv_usec = 0; + tvb[1].tv_sec = from_sb.st_mtime; + tvb[1].tv_usec = 0; + (void)utimes(to_name, tvb); } if (fstat(to_fd, &to_sb) == -1) { @@ -985,7 +989,7 @@ install(const char *from_name, const cha if (!devnull) (void)close(from_fd); - metadata_log(to_name, "file", tsb, NULL, digestresult, to_sb.st_size); + metadata_log(to_name, "file", tvb, NULL, digestresult, to_sb.st_size); free(digestresult); } @@ -1297,7 +1301,7 @@ again: * or to allow integrity checks to be performed. */ static void -metadata_log(const char *path, const char *type, struct timespec *ts, +metadata_log(const char *path, const char *type, struct timeval *tv, const char *slink, const char *digestresult, off_t size) { static const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' }; @@ -1351,9 +1355,9 @@ metadata_log(const char *path, const cha } if (*type == 'f') /* type=file */ fprintf(metafp, " size=%lld", (long long)size); - if (ts != NULL && dopreserve) - fprintf(metafp, " time=%lld.%09ld", - (long long)ts[1].tv_sec, ts[1].tv_nsec); + if (tv != NULL && dopreserve) + fprintf(metafp, " time=%lld.%ld", + (long long)tv[1].tv_sec, (long)tv[1].tv_usec); if (digestresult && digest) fprintf(metafp, " %s=%s", digest, digestresult); if (fflags)