Package: qhelpgenerator-qt5
Followup-For: Bug #1059631
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

My apologies: I had indeed misdiagnosed the problem here.

The code that inserts into the SettingsTable, where the problem reported here
manifests, is unrelated to the patch from bug #875847 - there is a separate
check for SOURCE_CODE_EPOCH in the src/assistant/qhelpgenerator/main.cpp file.

To test a fix, I used the following commands to replicate the problem:

  $ SOURCE_DATE_EPOCH=1503951538 qhelpgenerator 
examples/assistant/simpletextviewer/documentation/simpletextviewer.qhcp -o 
foo.qch
  $ TZ=GMT+8 SOURCE_DATE_EPOCH=1503951538 qhelpgenerator 
examples/assistant/simpletextviewer/documentation/simpletextviewer.qhcp -o 
bar.qch


Please find attached a patch to address the problem.  Note that I decided to
patch both SOURCE_CODE_EPOCH locations for consistency, despite the fact that
only the main.cpp code site was confirmed affected.
Description: helpgenerator: clear UTC offset to zero when reading 
SOURCE_DATE_EPOCH value
Author: James Addison <j...@jp-hosting.net>
Bug-Debian: https://bugs.debian.org/1059631

--- 
qttools-opensource-src-5.15.10.orig/src/assistant/help/qhelpcollectionhandler.cpp
+++ qttools-opensource-src-5.15.10/src/assistant/help/qhelpcollectionhandler.cpp
@@ -2202,8 +2202,10 @@ bool QHelpCollectionHandler::registerInd
         const QString sourceDateEpochStr = 
qEnvironmentVariable("SOURCE_DATE_EPOCH");
         bool ok;
         const qlonglong sourceDateEpoch = sourceDateEpochStr.toLongLong(&ok);
-        if (ok && sourceDateEpoch < lastModified.toSecsSinceEpoch())
+        if (ok && sourceDateEpoch < lastModified.toSecsSinceEpoch()) {
+            lastModified.setOffsetFromUtc(0);
             lastModified.setSecsSinceEpoch(sourceDateEpoch);
+        }
     }
     m_query->addBindValue(lastModified.toString(Qt::ISODate));
     if (!m_query->exec())
--- qttools-opensource-src-5.15.10.orig/src/assistant/qhelpgenerator/main.cpp
+++ qttools-opensource-src-5.15.10/src/assistant/qhelpgenerator/main.cpp
@@ -116,6 +116,7 @@ int generateCollectionFile(const QByteAr
     if (!config.filesToRegister().isEmpty()) {
         if (Q_UNLIKELY(qEnvironmentVariableIsSet("SOURCE_DATE_EPOCH"))) {
             QDateTime dt;
+            dt.setOffsetFromUtc(0);
             
dt.setSecsSinceEpoch(qEnvironmentVariableIntValue("SOURCE_DATE_EPOCH"));
             CollectionConfiguration::updateLastRegisterTime(helpEngine, dt);
         } else {

Reply via email to