Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84745

QHelpEngineCore constructor fails when a file is not owned by the user

    XMLWordPrintable

Details

    • All

    Description

      We're using Qt 5.12.8 , the issue occurs on both Windows and Linux and under my testing, the key is either the file in question is not owned by the current user or the folder(s) about the file in question is not owned by the user.

       

      Listed below is a simple example of the issue. When you toggle the setting g_qsHelpFilePath, you can get the test to work or fail, under the call helpEngine->linksForIdentifier but, it looks like it fails well before this call.

       

       

      PS - this code worked in QT 5.6.2

       

      #include <QProcess>

      #include <QFileInfo>

      #include <QApplication>

      #include  <QMessageBox>

      #include "QtHelp/QHelpEngineCore"

       

      //static members initializations

      static QProcess* g_pAsstProcess = nullptr;

      static QString g_qsHelpFilePath("e:\\hped\\builds\\sr\\doc
      ads.qhc"
      ); // Works

      //static QString g_qsHelpFilePath("z:\\hped\\builds\\sr\\devXXX\\rgdevelop\\debug\\prod\\doc
      ads.qhc"); // Failing

      static QString g_qsAssistantPath("e:\\AdsWrk\\myProdCpy\\bin\\Help
      assistant.exe"
      );

       

      //Internal functions

       

      static bool is_assistant_running()

      {

             if (!g_pAsstProcess)

                    return false;

             return g_pAsstProcess->state() == QProcess::Running;

      {color:#000000}}

       

       

       

      int main(int argc, char* argv[])

      {

             QApplication aTestApp(argc, argv);

             QStringList args;

       

             g_pAsstProcess = new QProcess(qApp);

             g_pAsstProcess->start(g_qsAssistantPath, args);

       

             if (!is_assistant_running())

             {

                    QMessageBox msgBox(QMessageBox::Critical, QString("Assistant"), QString("Failed to run %1\n").arg(g_qsAssistantPath),

                           QMessageBox::Ok);

                    msgBox.exec();

             }

       

             QFile hFile(g_qsHelpFilePath);

       

             if (!hFile.open(QIODevice::ReadOnly))

             {

                    QMessageBox msgBox(QMessageBox::Critical, "Help system problem",

                           QString("Failed to open file: %1\n").arg(hFile.fileName()));

                    msgBox.exec();

             }

       

             QHelpEngineCore* helpEngine = new QHelpEngineCore(g_qsHelpFilePath);

             if (!helpEngine->setupData())

             {

                    QMessageBox msgBox(QMessageBox::Critical, "Help system problem",

                           QString("The help system failed to initialze using the file: %1\n").arg(helpEngine->collectionFile()));

                    msgBox.exec();

             }

       

             QMap<QString, QUrl> links;

             links = helpEngine->linksForIdentifier("Home");

             auto count=links.count();

             if (count == 0)

             {

                    QMessageBox msgBox(QMessageBox::Critical, "Help system problem",

                           QString("The help links not found under: %1\n").arg(helpEngine->collectionFile()));

                    msgBox.exec();

             }

       

       

          return true;

      {color:#000000}}

       

       

       

       

      Attachments

        For Gerrit Dashboard: QTBUG-84745
        # Subject Branch Project Status CR V

        Activity

          People

            jkobus Jarek Kobus
            kamp Kerry Ampuero
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes