D29170: Detect executables without +x permission in $PATH to improve error message

Ahmad Samir noreply at phabricator.kde.org
Sat Apr 25 17:23:49 BST 2020


ahmadsamir added inline comments.

INLINE COMMENTS

> kprocessrunner.cpp:53
> +        // This is a *very* simplified version of QStandardPaths::findExecutable
> +        const QStringList searchPaths = QString::fromLocal8Bit(qgetenv("PATH")).split(QDir::listSeparator(), QString::SkipEmptyParts);
> +        const QDir currentDir = QDir::current();

KProcessRunner tries finding the executable in the current dir too, so to be precise in the reported error message maybe append currentDir.absolutePath() to searchPaths?

Also KProcessRunner only checks that the executable exists in the current dir, "!QFileInfo::exists(realExecutable)", it should also check that it's executable. So that KProcessRunner checks the "exists and is +x" and here we check "exists but not +x", if that makes sense.

I guess you'll have the add an ifdef kludge since QString::SkipEmptyParts is deprecated in Qt 5.15 according to https://lxr.kde.org/source/frameworks/frameworkintegration/src/kpackage-install-handlers/kns/main.cpp#0068 (I am still on 5.14).

> kprocessrunner.cpp:60
> +                if (fileInfo.isExecutable()) {
> +                    qWarning() << "Internal program error. QStandardPaths::findExecutable couldn't find" << executable << "but our own logic found it at" << candidate << ". Please report a bug at http://bugs.kde.org";
> +                } else {

Should be https://

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D29170

To: dfaure, ahmadsamir
Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200425/14cafdda/attachment.html>


More information about the Kde-frameworks-devel mailing list