Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libqt5xdg for openSUSE:Factory checked in at 2022-05-01 20:51:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libqt5xdg (Old) and /work/SRC/openSUSE:Factory/.libqt5xdg.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libqt5xdg" Sun May 1 20:51:21 2022 rev:16 rq:973871 version:3.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libqt5xdg/libqt5xdg.changes 2021-11-09 23:54:29.095948787 +0100 +++ /work/SRC/openSUSE:Factory/.libqt5xdg.new.1538/libqt5xdg.changes 2022-05-01 20:51:27.724603134 +0200 @@ -1,0 +2,7 @@ +Wed Apr 27 19:19:43 UTC 2022 - Michael Vetter <[email protected]> + +- Update to 3.9.0: + * String literals are supported in Exec keys of desktop entries. + * Enhancements to qtxdg-mat. + +------------------------------------------------------------------- Old: ---- libqtxdg-3.8.0.tar.xz libqtxdg-3.8.0.tar.xz.asc New: ---- libqtxdg-3.9.0.tar.xz libqtxdg-3.9.0.tar.xz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libqt5xdg.spec ++++++ --- /var/tmp/diff_new_pack.xlTIKf/_old 2022-05-01 20:51:28.396603748 +0200 +++ /var/tmp/diff_new_pack.xlTIKf/_new 2022-05-01 20:51:28.404603756 +0200 @@ -1,7 +1,7 @@ # # spec file for package libqt5xdg # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define _name libqtxdg Name: libqt5xdg -Version: 3.8.0 +Version: 3.9.0 Release: 0 Summary: Qt implementation of xdg specs for lxqt License: GPL-3.0-only @@ -31,7 +31,7 @@ BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: libQt5Gui-private-headers-devel -BuildRequires: lxqt-build-tools-devel >= 0.10.0 +BuildRequires: lxqt-build-tools-devel >= 0.11.0 BuildRequires: pkgconfig BuildRequires: pkgconfig(Qt5Core) >= 5.15 BuildRequires: pkgconfig(Qt5DBus) @@ -39,7 +39,7 @@ BuildRequires: pkgconfig(Qt5Test) BuildRequires: pkgconfig(Qt5Widgets) BuildRequires: pkgconfig(Qt5Xml) -BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(glib-2.0) >= 2.41 %description Qt implementation of freedesktop.org XDG specs for LXQt ++++++ libqtxdg-3.8.0.tar.xz -> libqtxdg-3.9.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/CHANGELOG new/libqtxdg-3.9.0/CHANGELOG --- old/libqtxdg-3.8.0/CHANGELOG 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/CHANGELOG 2022-04-16 14:19:37.000000000 +0200 @@ -1,3 +1,11 @@ +libqtxdg-3.9.0 / 2022-04-15 +=========================== + * Improved email client command line handling in qtxdg-mat. + * Handled '--help-all' option in qtxdg-mat. + * Supported string literals in Exec keys of desktop entries. + * Updated `README.md`. + * Fixed config file name with empty `XDG_CURRENT_DESKTOP`. + libqtxdg-3.8.0 / 2021-11-04 =========================== * Handle relative paths in qtxdg-desktop-file-start. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/CMakeLists.txt new/libqtxdg-3.9.0/CMakeLists.txt --- old/libqtxdg-3.8.0/CMakeLists.txt 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/CMakeLists.txt 2022-04-16 14:19:37.000000000 +0200 @@ -13,11 +13,11 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(QTXDG_MAJOR_VERSION 3) -set(QTXDG_MINOR_VERSION 8) +set(QTXDG_MINOR_VERSION 9) set(QTXDG_PATCH_VERSION 0) set(QTXDG_VERSION_STRING ${QTXDG_MAJOR_VERSION}.${QTXDG_MINOR_VERSION}.${QTXDG_PATCH_VERSION}) -set(LXQTBT_MINIMUM_VERSION "0.10.0") +set(LXQTBT_MINIMUM_VERSION "0.11.0") set(QT_MINIMUM_VERSION "5.15.0") set(GLIB_MINIMUM_VERSION "2.41.0") # Mime Apps new implementation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/README.md new/libqtxdg-3.9.0/README.md --- old/libqtxdg-3.8.0/README.md 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/README.md 2022-04-16 14:19:37.000000000 +0200 @@ -13,7 +13,7 @@ ### Sources At runtime qtbase is needed. gtk-update-icon-cache represents an optional runtime dependency for the reasons stated above. -Additional build dependencies are CMake, qtsvg, qttools and optionally Git to pull latest VCS checkouts. +Additional build dependencies are CMake, qtsvg, qttools, [lxqt-build-tools](https://github.com/lxqt/lxqt-build-tools) and optionally Git to pull latest VCS checkouts. The code configuration is handled by CMake so all corresponding generic instructions apply. Specific CMake variables are * BUILD_TESTS to build tests. Disabled by default (`OFF`). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/qtxdg/xdgdefaultapps.cpp new/libqtxdg-3.9.0/src/qtxdg/xdgdefaultapps.cpp --- old/libqtxdg-3.8.0/src/qtxdg/xdgdefaultapps.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/qtxdg/xdgdefaultapps.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -80,7 +80,7 @@ // first find the DE's qtxdg.conf file QByteArray qtxdgConfig("qtxdg"); QList<QByteArray> desktopsList = qgetenv("XDG_CURRENT_DESKTOP").toLower().split(':'); - if (!desktopsList.isEmpty()) { + if (!desktopsList.isEmpty() && !desktopsList.at(0).isEmpty()) { qtxdgConfig = desktopsList.at(0) + '-' + qtxdgConfig; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/qtxdg/xdgdesktopfile.cpp new/libqtxdg-3.9.0/src/qtxdg/xdgdesktopfile.cpp --- old/libqtxdg-3.8.0/src/qtxdg/xdgdesktopfile.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/qtxdg/xdgdesktopfile.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -89,7 +89,8 @@ // Helper functions prototypes QString &doEscape(QString& str, const QHash<QChar,QChar> &repl); -QString &doUnEscape(QString& str, const QHash<QChar,QChar> &repl); +QString &doSimpleUnEscape(QString& str, const QHash<QChar,QChar> &repl); +QString &doUnEscape(QString& str, const QHash<QChar,QChar> &repl, QList<int> &literals); QString &escape(QString& str); QString &escapeExec(QString& str); QString expandDynamicUrl(QString url); @@ -97,11 +98,11 @@ QStringList expandEnvVariables(const QStringList &strs); QString findDesktopFile(const QString& dirName, const QString& desktopName); QString findDesktopFile(const QString& desktopName); -static QStringList parseCombinedArgString(const QString &program); +static QStringList parseCombinedArgString(const QString &program, const QList<int> &literals); bool read(const QString &prefix); void replaceVar(QString &str, const QString &varName, const QString &after); -QString &unEscape(QString& str); -QString &unEscapeExec(QString& str); +QString &unEscape(QString& str, bool exec); +QString &unEscapeExec(QString& str, QList<int> &literals); namespace { @@ -199,7 +200,8 @@ } -QString &doUnEscape(QString& str, const QHash<QChar,QChar> &repl) + +QString &doSimpleUnEscape(QString& str, const QHash<QChar,QChar> &repl) { int n = 0; while (true) @@ -219,13 +221,66 @@ return str; } +// The list of start and end positions of string literals is also found by this function. +// It is assumed that a string literal starts with a non-escaped, non-quoted single/double +// quote and ends with the next single/double quote. +// If a literal has no end, the string is considered malformed. +QString &doUnEscape(QString& str, const QHash<QChar,QChar> &repl, QList<int> &literals) +{ + int n = 0; + bool inQuote = false; + static const QRegularExpression slashOrLiteralStart(QString::fromLatin1(R"(\\|(?<!\\)('|"))")); + while (true) + { + if (!inQuote) // string literals cannot be double quoted + { + n = str.indexOf(slashOrLiteralStart, n); + if (n < 0) + break; + if (str.at(n) != QLatin1Char('\\')) // perhaps a literal start + { + int end = str.indexOf(str.at(n), n + 1); + if (end < 0) + { // no literal end; the string is malformed + str.clear(); + break; + } + else + { + // add the start and end positions to the list + literals << n << end; + // skip the literal + n = end + 1; + continue; + } + } + } + else + n = str.indexOf(QLatin1String("\\"), n); + if (n < 0 || n > str.length() - 2) + break; + + if (str.at(n + 1) == QLatin1Char('"')) + inQuote = !inQuote; + + if (repl.contains(str.at(n+1))) + { + str.replace(n, 2, repl.value(str.at(n+1))); + } + + n++; + } + + return str; +} + /************************************************ The escape sequences \s, \n, \t, \r, and \\ are supported for values of type string and localestring, meaning ASCII space, newline, tab, carriage return, and backslash, respectively. ************************************************/ -QString &unEscape(QString& str) +QString &unEscape(QString& str, bool exec) { QHash<QChar,QChar> repl; repl.insert(QLatin1Char('\\'), QLatin1Char('\\')); @@ -234,7 +289,12 @@ repl.insert(QLatin1Char('t'), QLatin1Char('\t')); repl.insert(QLatin1Char('r'), QLatin1Char('\r')); - return doUnEscape(str, repl); + if (exec) + { + QList<int> l; + return doUnEscape(str, repl, l); + } + return doSimpleUnEscape(str, repl); } @@ -277,9 +337,9 @@ Likewise, a literal dollar sign in a quoted argument in a desktop entry file is unambiguously represented with ("\\$"). ************************************************/ -QString &unEscapeExec(QString& str) +QString &unEscapeExec(QString& str, QList<int> &literals) { - unEscape(str); + unEscape(str, true); QHash<QChar,QChar> repl; // The parseCombinedArgString() splits the string by the space symbols, // we temporarily replace them on the special characters. @@ -305,7 +365,7 @@ repl.insert(QLatin1Char(')'), QLatin1Char(')')); // parenthesis (")") repl.insert(QLatin1Char('`'), QLatin1Char('`')); // backtick character ("`"). - return doUnEscape(str, repl); + return doUnEscape(str, repl, literals); } namespace @@ -749,7 +809,7 @@ if (res.type() == QVariant::String) { QString s = res.toString(); - return unEscape(s); + return unEscape(s, false); } return res; @@ -1000,17 +1060,32 @@ } -static QStringList parseCombinedArgString(const QString &program) +static QStringList parseCombinedArgString(const QString &program, const QList<int> &literals) { QStringList args; QString tmp; int quoteCount = 0; bool inQuote = false; + bool isLiteral = false; // handle quoting. tokens can be surrounded by double quotes // "hello world". three consecutive double quotes represent // the quote character itself. for (int i = 0; i < program.size(); ++i) { + // skip string literals + int n = literals.indexOf(i); + if (n >= 0 && n % 2 == 0) { + // This is the start of a string literal. + // Add the literal to the arguments and jump to its end. + int length = literals.at(n + 1) - literals.at(n) - 1; + if (length > 0) { + tmp += program.mid(literals.at(n) + 1, length); + isLiteral = true; + } + i = literals.at(n + 1); + continue; + } + if (program.at(i) == QLatin1Char('"')) { ++quoteCount; if (quoteCount == 3) { @@ -1027,6 +1102,12 @@ } if (!inQuote && program.at(i).isSpace()) { if (!tmp.isEmpty()) { + if (isLiteral) { + // add a dummy argument to mark the next argument as a string literal + // and to prevent its expanding in expandExecString() + args += QString(); + isLiteral = false; + } args += tmp; tmp.clear(); } @@ -1103,11 +1184,25 @@ QStringList result; QString execStr = value(execKey).toString(); - unEscapeExec(execStr); - const QStringList tokens = parseCombinedArgString(execStr); + QList<int> literals; + unEscapeExec(execStr, literals); + const QStringList tokens = parseCombinedArgString(execStr, literals); + bool isLiteral = false; for (QString token : tokens) { + if (token.isEmpty()) + { // a dummy argument marked by parseCombinedArgString() + isLiteral = true; + continue; + } + else if (isLiteral) + { // do not expand string literals + result << token; + isLiteral = false; + continue; + } + // The parseCombinedArgString() splits the string by the space symbols, // we temporarily replaced them on the special characters. // Now we reverse it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/defappmatcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/defappmatcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/defappmatcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/defappmatcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -69,7 +69,7 @@ return CommandLineVersionRequested; } - if (parser->isSet(helpOption)) { + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { return CommandLineHelpRequested; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/defemailclientmatcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/defemailclientmatcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/defemailclientmatcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/defemailclientmatcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -74,7 +74,7 @@ return CommandLineVersionRequested; } - if (parser->isSet(helpOption)) { + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { return CommandLineHelpRequested; } @@ -94,6 +94,11 @@ return CommandLineError; } + if (!isDefEmailClientNameSet && !posArgs.empty()) { + *errorMessage = QSL("To set the default email client use the -s/--set option"); + return CommandLineError; + } + if (isListAvailableSet && (isDefEmailClientNameSet || !posArgs.empty())) { *errorMessage = QSL("list-available can't be used with other options and doesn't take arguments"); return CommandLineError; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/deffilemanagermatcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/deffilemanagermatcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/deffilemanagermatcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/deffilemanagermatcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -74,7 +74,7 @@ return CommandLineVersionRequested; } - if (parser->isSet(helpOption)) { + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { return CommandLineHelpRequested; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/defterminalmatcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/defterminalmatcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/defterminalmatcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/defterminalmatcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -75,7 +75,7 @@ return CommandLineVersionRequested; } - if (parser->isSet(helpOption)) { + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { return CommandLineHelpRequested; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/defwebbrowsermatcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/defwebbrowsermatcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/defwebbrowsermatcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/defwebbrowsermatcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -74,7 +74,7 @@ return CommandLineVersionRequested; } - if (parser->isSet(helpOption)) { + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { return CommandLineHelpRequested; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/mimetypematcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/mimetypematcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/mimetypematcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/mimetypematcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -54,10 +54,22 @@ parser->addPositionalArgument(QL1S("mimetype"), QSL("file | URL"), QCoreApplication::tr("[file | URL]")); - parser->addHelpOption(); - parser->addVersionOption(); + const QCommandLineOption helpOption = parser->addHelpOption(); + const QCommandLineOption versionOption = parser->addVersionOption(); + + if (!parser->parse(QCoreApplication::arguments())) { + *errorMessage = parser->errorText(); + return CommandLineError; + } + + if (parser->isSet(versionOption)) { + return CommandLineVersionRequested; + } + + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { + return CommandLineHelpRequested; + } - parser->process(QCoreApplication::arguments()); QStringList fs = parser->positionalArguments(); if (fs.size() < 2) { *errorMessage = QSL("No file given"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/openmatcommand.cpp new/libqtxdg-3.9.0/src/tools/mat/openmatcommand.cpp --- old/libqtxdg-3.8.0/src/tools/mat/openmatcommand.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/openmatcommand.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -55,10 +55,22 @@ parser->addPositionalArgument(QL1S("open"), QSL("files | URLs"), QCoreApplication::tr("[files | URLs]")); - parser->addHelpOption(); - parser->addVersionOption(); + const QCommandLineOption helpOption = parser->addHelpOption(); + const QCommandLineOption versionOption = parser->addVersionOption(); + + if (!parser->parse(QCoreApplication::arguments())) { + *errorMessage = parser->errorText(); + return CommandLineError; + } + + if (parser->isSet(versionOption)) { + return CommandLineVersionRequested; + } + + if (parser->isSet(helpOption) || parser->isSet(QSL("help-all"))) { + return CommandLineHelpRequested; + } - parser->process(QCoreApplication::arguments()); QStringList fs = parser->positionalArguments(); if (fs.size() < 2) { *errorMessage = QSL("No file or URL given"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqtxdg-3.8.0/src/tools/mat/qtxdg-mat.cpp new/libqtxdg-3.9.0/src/tools/mat/qtxdg-mat.cpp --- old/libqtxdg-3.8.0/src/tools/mat/qtxdg-mat.cpp 2021-11-05 10:57:03.000000000 +0100 +++ new/libqtxdg-3.9.0/src/tools/mat/qtxdg-mat.cpp 2022-04-16 14:19:37.000000000 +0200 @@ -95,9 +95,26 @@ // Find out the positional arguments. parser.parse(QCoreApplication::arguments()); const QStringList args = parser.positionalArguments(); - const QString command = args.isEmpty() ? QString() : args.first(); - bool cmdFound = false; + if (args.isEmpty()) { + const QCommandLineOption helpOption = parser.addHelpOption(); + const QCommandLineOption versionOption = parser.addVersionOption(); + parser.parse(QCoreApplication::arguments()); + if (parser.isSet(helpOption) || parser.isSet(QSL("help-all"))) { + showHelp(parser.helpText(), manager->descriptionsHelpText(), EXIT_SUCCESS); + Q_UNREACHABLE(); + } + if (parser.isSet(versionOption)) { + parser.showVersion(); + Q_UNREACHABLE(); + } + showHelp(parser.helpText(), manager->descriptionsHelpText(), EXIT_FAILURE); + Q_UNREACHABLE(); + } + + // we got a command + const QString command = args.first(); + bool cmdFound = false; const QList <MatCommandInterface *> commands = manager->commands(); for (auto *const cmd : commands) { if (command == cmd->name()) { @@ -112,14 +129,6 @@ const QCommandLineOption helpOption = parser.addHelpOption(); const QCommandLineOption versionOption = parser.addVersionOption(); parser.parse(QCoreApplication::arguments()); - if (parser.isSet(helpOption)) { - showHelp(parser.helpText(), manager->descriptionsHelpText(), EXIT_SUCCESS); - Q_UNREACHABLE(); - } - if (parser.isSet(versionOption)) { - parser.showVersion(); - Q_UNREACHABLE(); - } showHelp(parser.helpText(), manager->descriptionsHelpText(), EXIT_FAILURE); Q_UNREACHABLE(); } else {
