diff --git a/CMakeLists.txt b/CMakeLists.txt index b50ce73..1e4d104 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ ELSE() ENDIF() -PROJECT(AusweisApp2 VERSION 1.16.0 LANGUAGES ${LANGUAGES}) +PROJECT(AusweisApp2 VERSION 1.16.1 LANGUAGES ${LANGUAGES}) # Set TWEAK if not defined in PROJECT_VERSION above to # have a valid tweak version without propagating it diff --git a/docs/releasenotes/1.16.1.rst b/docs/releasenotes/1.16.1.rst new file mode 100644 index 0000000..c8a9531 --- /dev/null +++ b/docs/releasenotes/1.16.1.rst @@ -0,0 +1,15 @@ +AusweisApp2 1.16.1 +^^^^^^^^^^^^^^^^^^ + +**Releasedatum:** 21. Dezember 2018 + + + +Anwender +"""""""" + - Deaktivieren der automatischen Bereinigung von alten Log-Dateien, da + diese in 1.16.0 zu einem Programmabsturz führen kann. + + +Entwickler +"""""""""" diff --git a/docs/releasenotes/appcast.rst b/docs/releasenotes/appcast.rst index 64130f4..ecd1d4d 100644 --- a/docs/releasenotes/appcast.rst +++ b/docs/releasenotes/appcast.rst @@ -4,6 +4,7 @@ Release Notes .. toctree:: :maxdepth: 1 + 1.16.1 1.16.0 announce issues diff --git a/docs/releasenotes/versions.rst b/docs/releasenotes/versions.rst index 62d6c75..863ec00 100644 --- a/docs/releasenotes/versions.rst +++ b/docs/releasenotes/versions.rst @@ -6,6 +6,7 @@ Versionszweig 1.16 .. toctree:: :maxdepth: 1 + 1.16.1 1.16.0 diff --git a/resources/jenkins/dsl/Reviews/Review_FreeBSD.groovy b/resources/jenkins/dsl/Reviews/Review_FreeBSD.groovy index a4f2906..b87c995 100644 --- a/resources/jenkins/dsl/Reviews/Review_FreeBSD.groovy +++ b/resources/jenkins/dsl/Reviews/Review_FreeBSD.groovy @@ -6,7 +6,7 @@ def j = new Review name: 'FreeBSD', libraries: ['FreeBSD'], label: 'FreeBSD', - artifacts: 'tmp/*.log', + artifacts: 'tmp/AusweisApp2.*.log', allowEmptyArtifacts: true, xunit: true, ).generate(this) diff --git a/resources/jenkins/dsl/Reviews/Review_Linux.groovy b/resources/jenkins/dsl/Reviews/Review_Linux.groovy index 6da3069..4c16f54 100644 --- a/resources/jenkins/dsl/Reviews/Review_Linux.groovy +++ b/resources/jenkins/dsl/Reviews/Review_Linux.groovy @@ -7,7 +7,7 @@ def j = new Review name: 'Linux', libraries: ['Linux'], label: 'Linux', - artifacts: 'tmp/*.log', + artifacts: 'tmp/AusweisApp2.*.log', allowEmptyArtifacts: true, xunit: true, jobType: JobType.Matrix diff --git a/resources/jenkins/dsl/Reviews/Review_MacOS.groovy b/resources/jenkins/dsl/Reviews/Review_MacOS.groovy index 92cb143..9ee6f19 100644 --- a/resources/jenkins/dsl/Reviews/Review_MacOS.groovy +++ b/resources/jenkins/dsl/Reviews/Review_MacOS.groovy @@ -6,7 +6,7 @@ def j = new Review name: 'MacOS', libraries: ['MacOS'], label: 'MacOS', - artifacts: 'tmp/*.log', + artifacts: 'tmp/AusweisApp2.*.log', allowEmptyArtifacts: true, xunit: true ).generate(this) diff --git a/resources/jenkins/dsl/Reviews/Review_Win32_GNU.groovy b/resources/jenkins/dsl/Reviews/Review_Win32_GNU.groovy index 0f2ca38..27034f0 100644 --- a/resources/jenkins/dsl/Reviews/Review_Win32_GNU.groovy +++ b/resources/jenkins/dsl/Reviews/Review_Win32_GNU.groovy @@ -6,7 +6,7 @@ def j = new Review name: 'Win32_GNU', libraries: ['Win32_GNU'], label: 'Windows', - artifacts: 'tmp/*.log', + artifacts: 'tmp/AusweisApp2.*.log', allowEmptyArtifacts: true, xunit: true ).generate(this) diff --git a/resources/jenkins/dsl/Reviews/Review_Win32_MSVC.groovy b/resources/jenkins/dsl/Reviews/Review_Win32_MSVC.groovy index cf6a1ae..e114d91 100644 --- a/resources/jenkins/dsl/Reviews/Review_Win32_MSVC.groovy +++ b/resources/jenkins/dsl/Reviews/Review_Win32_MSVC.groovy @@ -5,7 +5,7 @@ def j = new Review name: 'Win32_MSVC', libraries: ['Win32_MSVC_dev'], label: 'MSVC', - artifacts: 'tmp/*.log', + artifacts: 'tmp/AusweisApp2.*.log', allowEmptyArtifacts: true, xunit: true ).generate(this) diff --git a/src/global/LogHandler.cpp b/src/global/LogHandler.cpp index fb19efd..1fc70bd 100644 --- a/src/global/LogHandler.cpp +++ b/src/global/LogHandler.cpp @@ -7,9 +7,7 @@ #include "BreakPropertyBindingDiagnosticLogFilter.h" #include "SingletonHelper.h" -#include #include -#include using namespace governikus; @@ -28,7 +26,8 @@ LogHandler::LogHandler() , mBacklogPosition(0) , mMessagePattern(QStringLiteral("%{category} %{time yyyy.MM.dd hh:mm:ss.zzz} %{if-debug} %{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif} %{function}(%{file}:%{line}) %{message}")) , mDefaultMessagePattern(QStringLiteral("%{if-category}%{category}: %{endif}%{message}")) // as defined in qlogging.cpp - , mLogFile(getLogFileTemplate()) + , mLogFileTemplate(QDir::tempPath() + QStringLiteral("/AusweisApp2.XXXXXX.log")) // if you change value you need to adjust getOtherLogfiles() + , mLogFile(mLogFileTemplate) , mHandler(nullptr) , mFilePrefix("/src/") , mMutex() @@ -51,13 +50,6 @@ LogHandler& LogHandler::getInstance() } -QString LogHandler::getLogFileTemplate() -{ - // if you change value you need to adjust getOtherLogfiles() - return QDir::tempPath() % QLatin1Char('/') % QCoreApplication::applicationName() % QStringLiteral(".XXXXXX.log"); -} - - void LogHandler::reset() { const QMutexLocker mutexLocker(&mMutex); @@ -79,7 +71,6 @@ void LogHandler::init() mLogFile.open(); } mHandler = qInstallMessageHandler(&LogHandler::messageHandler); - removeOldLogfiles(); } } @@ -296,7 +287,7 @@ QFileInfoList LogHandler::getOtherLogfiles() const QDir tmpPath = QDir::temp(); tmpPath.setSorting(QDir::Time); tmpPath.setFilter(QDir::Files); - tmpPath.setNameFilters(QStringList({QCoreApplication::applicationName() + QStringLiteral(".*.log")})); + tmpPath.setNameFilters(QStringList({QStringLiteral("AusweisApp2.*.log")})); QFileInfoList list = tmpPath.entryInfoList(); list.removeAll(mLogFile); @@ -305,20 +296,6 @@ QFileInfoList LogHandler::getOtherLogfiles() const } -void LogHandler::removeOldLogfiles() -{ - const auto& threshold = QDateTime::currentDateTime().addDays(-14); - const QFileInfoList& logfileInfos = getOtherLogfiles(); - for (const QFileInfo& entry : logfileInfos) - { - if (entry.fileTime(QFileDevice::FileModificationTime) < threshold) - { - qDebug() << "Auto-remove old log file:" << entry.absoluteFilePath() << '|' << QFile::remove(entry.absoluteFilePath()); - } - } -} - - bool LogHandler::removeOtherLogfiles() { const auto otherLogFiles = getOtherLogfiles(); @@ -339,7 +316,7 @@ void LogHandler::setLogfile(bool pEnable) { if (!mLogFile.isOpen()) { - mLogFile.setFileTemplate(getLogFileTemplate()); + mLogFile.setFileTemplate(mLogFileTemplate); mLogFile.open(); } } diff --git a/src/global/LogHandler.h b/src/global/LogHandler.h index 5798a83..d9e5e92 100644 --- a/src/global/LogHandler.h +++ b/src/global/LogHandler.h @@ -33,12 +33,11 @@ class LogHandler friend class ::test_LogHandler; private: - static QString getLogFileTemplate(); - const bool mEnvPattern; const int mFunctionFilenameSize; qint64 mBacklogPosition; const QString mMessagePattern, mDefaultMessagePattern; + const QString mLogFileTemplate; QTemporaryFile mLogFile; QtMessageHandler mHandler; const QByteArray mFilePrefix; @@ -52,7 +51,6 @@ class LogHandler QString getPaddedLogMsg(const QMessageLogContext& pContext, const QString& pMsg); void handleMessage(QtMsgType pType, const QMessageLogContext& pContext, const QString& pMsg); - void removeOldLogfiles(); static void messageHandler(QtMsgType pType, const QMessageLogContext& pContext, const QString& pMsg); friend QDebug operator<<(QDebug, const LogHandler&); diff --git a/test/qt/global/test_LogHandler.cpp b/test/qt/global/test_LogHandler.cpp index b58ba54..6a4058a 100644 --- a/test/qt/global/test_LogHandler.cpp +++ b/test/qt/global/test_LogHandler.cpp @@ -8,12 +8,6 @@ #include -#ifndef Q_OS_WIN -#include -#include -#include -#endif - using namespace governikus; class test_LogHandler @@ -21,26 +15,6 @@ class test_LogHandler { Q_OBJECT - void fakeLastModifiedAndLastAccessTime(const QString& pPath) - { - #ifdef Q_OS_WIN - Q_UNUSED(pPath); - #else - struct timeval tv[2]; - - struct timeval& accessTime = tv[0]; - gettimeofday(&accessTime, nullptr); - - struct timeval& modifyTime = tv[1]; - gettimeofday(&modifyTime, nullptr); - - time_t fiveteenDays = 60 * 60 * 24 * 15; - modifyTime.tv_sec -= fiveteenDays; - utimes(pPath.toLatin1().constData(), tv); - #endif - } - - private Q_SLOTS: void initTestCase() { @@ -194,32 +168,6 @@ class test_LogHandler } - void removeUpOldLogfiles() - { - #ifdef Q_OS_WIN - QSKIP("File time stamp mocking unimplemented on windows"); - #endif - - const auto& logger = Env::getSingleton(); - - const auto& initialFiles = logger->getOtherLogfiles(); - QTemporaryFile tmp(LogHandler::getLogFileTemplate()); - QVERIFY(tmp.open()); - tmp.fileName(); // touch it - const auto& filesWithMock = logger->getOtherLogfiles(); - QVERIFY(filesWithMock.size() > initialFiles.size()); - - logger->removeOldLogfiles(); - QVERIFY(tmp.exists()); - QCOMPARE(filesWithMock.size(), logger->getOtherLogfiles().size()); - - fakeLastModifiedAndLastAccessTime(tmp.fileName()); - logger->removeOldLogfiles(); - QCOMPARE(initialFiles.size(), logger->getOtherLogfiles().size()); - QVERIFY(!tmp.exists()); - } - - }; QTEST_GUILESS_MAIN(test_LogHandler)