Bug 1315695 - Use Python to adjust pgo.relink mtime; r=ted
☠☠ backed out by 530bbb41afc4 ☠ ☠
authorGregory Szorc <gps@mozilla.com>
Mon, 07 Nov 2016 10:52:11 -0800
changeset 322700 a77fb6a85fc8a56f51ccf6668d7926d167b75817
parent 322699 16568d2ed7cd71497651816835f5929c0caaa7c7
child 322701 25cf55049850a9e07c13a5b68fd5cfb8494e6798
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersted
bugs1315695
milestone53.0a1
Bug 1315695 - Use Python to adjust pgo.relink mtime; r=ted `touch -t` may not correctly handle timezones across DST changes because it accepts a timezone-less date string. Work around this by using Python and UNIX timestamps to adjust the mtime of the pgo.relink file. If this doesn't fix the issue, then signs would seem to point to a bug in MSVC's PGO process not working correctly when run across timezones. MozReview-Commit-ID: KtTHmLSZuES
config/rules.mk
nsprpub/config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -652,18 +652,19 @@ ifdef MSMANIFEST_TOOL
 		fi; \
 	elif test -f '$(srcdir)/$@.manifest'; then \
 		echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
 		$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
 	fi
 endif	# MSVC with manifest tool
 ifdef MOZ_PROFILE_GENERATE
 # touch it a few seconds into the future to work around FAT's
-# 2-second granularity
-	touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
+# 2-second granularity. We can't touch `touch -t` here because it isn't timezone
+# aware.
+	$(PYTHON) -c 'import os, time; now = int(time.time()); os.utime("pgo.relink", (now + 5, now + 5));'
 endif
 else # !WINNT || GNU_CC
 	$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
 	$(call CHECK_BINARY,$@)
 endif # WINNT && !GNU_CC
 
 ifdef ENABLE_STRIP
 	$(STRIP) $(STRIP_FLAGS) $@
--- a/nsprpub/config/rules.mk
+++ b/nsprpub/config/rules.mk
@@ -265,18 +265,19 @@ endif	# MOZ_PROFILE_USE
 ifdef MT
 	@if test -f $@.manifest; then \
 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		rm -f $@.manifest; \
 	fi
 endif	# MSVC with manifest tool
 ifdef MOZ_PROFILE_GENERATE
 # touch it a few seconds into the future to work around FAT's
-# 2-second granularity
-	touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
+# 2-second granularity. We can't touch `touch -t` here because it isn't timezone
+# aware.
+	$(PYTHON) -c 'import os, time; now = int(time.time()); os.utime("pgo.relink", (now + 5, now + 5));'
 endif	# MOZ_PROFILE_GENERATE
 else	# WINNT && !GCC
 	$(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(WRAP_LDFLAGS)
 endif	# WINNT && !GCC
 ifdef ENABLE_STRIP
 	$(STRIP) $@
 endif