Merge lp:~dpniel/reminders-app/improve_binary into lp:reminders-app

Proposed by Dan Chapman 
Status: Merged
Approved by: Michael Zanetti
Approved revision: 97
Merged at revision: 94
Proposed branch: lp:~dpniel/reminders-app/improve_binary
Merge into: lp:reminders-app
Diff against target: 102 lines (+19/-22)
2 files modified
src/app/main.cpp (+19/-20)
tests/autopilot/reminders/tests/__init__.py (+0/-2)
To merge this branch: bzr merge lp:~dpniel/reminders-app/improve_binary
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Michael Zanetti (community) Approve
Review via email: mp+213621@code.launchpad.net

Commit message

removed -q option from src/app/main.cpp and autopilot/reminders/tests/__init__.py

Now looks for reminders.qml in relation to the path of the application executable

Description of the change

Improvements to app/main.cpp,

  * For command line options switched to using QCommandLineParser
  * Fixed build warnings when setting phone/tablet context properties, (Required QVariant(true/false) and not bool true/false)
  * Removed -q option and instead search for reminders.qml using the path to the application binary and not need to be passing around relative file paths
    which could be a security issue and dumb things could happen when called from inside an attacker-controlled directory.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:94
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~dpniel/reminders-app/improve_binary/+merge/213621/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/242/
Executed test runs:
    UNSTABLE: http://91.189.93.70:8080/job/generic-mediumtests-trusty/1930
    FAILURE: http://91.189.93.70:8080/job/reminders-app-saucy-amd64-ci/242/console
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-trusty-amd64-ci/242

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/242/rebuild

review: Needs Fixing (continuous-integration)
95. By Dan Chapman 

removed -q option in autopilot test

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:95
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~dpniel/reminders-app/improve_binary/+merge/213621/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/243/
Executed test runs:
    UNSTABLE: http://91.189.93.70:8080/job/generic-mediumtests-trusty/1931
    FAILURE: http://91.189.93.70:8080/job/reminders-app-saucy-amd64-ci/243/console
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-trusty-amd64-ci/243

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/243/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> which could be a security issue and dumb things could happen when called from inside an attacker-controlled directory.

I don't really agree with this one... If an attacker can create and inject a qml file, he just as well might call qmlscene with that qml file, or place the "bad" qml file relative to the app binary to inject it in your bianary... I don't see any more harm being done by neither the original approach nor this one. Anyways... dropping the -q parameter is fine with me.

===

please clean up the -q option in the autopilot scripts then (If its already in there).

==

please change "DO NOT USE: autopilot sets this automatically" to "Enable loading of testability driver". Note that this would also load any other's platform testability driver and is not related to autopilot in any way (except that on ubuntu we inject our self-made testability driver coming with autopilot).

review: Needs Fixing
96. By Dan Chapman 

revert changes

Revision history for this message
Dan Chapman  (dpniel) wrote :

Ok, i have reverted the changes on this anyway as QCommandLineParser is new in Qt5.2 I didn't realise that builds were still done against saucy as well.

I'll change looking up the qmlfile and not pass the relative path with autopilot to clean that up a bit

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:96
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~dpniel/reminders-app/improve_binary/+merge/213621/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/244/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-trusty/1932
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-saucy-amd64-ci/244
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-trusty-amd64-ci/244

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/244/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Ok, i have reverted the changes on this anyway as QCommandLineParser is new in
> Qt5.2 I didn't realise that builds were still done against saucy as well.
>
> I'll change looking up the qmlfile and not pass the relative path with
> autopilot to clean that up a bit

Too bad. I would have loved to see QCommandLineParser coming in. Also, in another branch of mine I'm using the new QMessageLogger already. Do you know how long we have to keep compatibility with saucy?

97. By Dan Chapman 

removed -q option from src/app/main.cpp and autopilot/reminders/tests/__init__.py

Now looks for reminders.qml in relation to the path of the application executable

Revision history for this message
Dan Chapman  (dpniel) wrote :

> Too bad. I would have loved to see QCommandLineParser coming in. Also, in
> another branch of mine I'm using the new QMessageLogger already. Do you know
> how long we have to keep compatibility with saucy?

I don't atm :-(, i'd presume it would be after this release, but i'm going to find out to make sure. Once it's changed over i'll re-propose using QCommandLineParser

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:97
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~dpniel/reminders-app/improve_binary/+merge/213621/+edit-commit-message

http://91.189.93.70:8080/job/reminders-app-ci/245/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-trusty/1933
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-saucy-amd64-ci/245
    SUCCESS: http://91.189.93.70:8080/job/reminders-app-trusty-amd64-ci/245

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/reminders-app-ci/245/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Dan Chapman  (dpniel) wrote :

so those changes seem to pass, i've updated the commit message so that should pass next time around.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

lgtm.

review: Approve
Revision history for this message
David Planella (dpm) wrote :

If it makes sense to use them, we can set a separate series for 13.10 and
switch to 5.2 features for trunk already. In fact, I'd suggest that and do
the switch already in this branch.

In terms of supporting 13.10, it's still about 4 months to go (non-LTS
releases are supported for 9 months)

Cheers,
David.

On Tue, Apr 1, 2014 at 1:06 PM, Dan Chapman <email address hidden> wrote:

> The proposal to merge lp:~dpniel/reminders-app/improve_binary into
> lp:reminders-app has been updated.
>
> Commit Message changed to:
>
> removed -q option from src/app/main.cpp and
> autopilot/reminders/tests/__init__.py
>
> Now looks for reminders.qml in relation to the path of the application
> executable
>
> For more details, see:
>
> https://code.launchpad.net/~dpniel/reminders-app/improve_binary/+merge/213621
> --
>
> https://code.launchpad.net/~dpniel/reminders-app/improve_binary/+merge/213621
> Your team Ubuntu Reminders app developers is subscribed to branch
> lp:reminders-app.
>

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/main.cpp'
2--- src/app/main.cpp 2014-03-17 22:26:42 +0000
3+++ src/app/main.cpp 2014-04-01 10:40:25 +0000
4@@ -47,11 +47,10 @@
5 qDebug() << " -t|--tablet If running on Desktop, start in a tablet sized window.";
6 qDebug() << " -h|--help Print this help.";
7 qDebug() << " -I <path> Give a path for an additional QML import directory. May be used multiple times.";
8- qDebug() << " -q <qmlfile> Give an alternative location for the main qml file.";
9 return 0;
10 }
11
12- QString qmlfile;
13+
14 for (int i = 0; i < args.count(); i++) {
15 if (args.at(i) == "-I" && args.count() > i + 1) {
16 QString addedPath = args.at(i+1);
17@@ -60,8 +59,6 @@
18 addedPath.prepend(QDir::currentPath());
19 }
20 importPathList.append(addedPath);
21- } else if (args.at(i) == "-q" && args.count() > i + 1) {
22- qmlfile = args.at(i+1);
23 }
24 }
25
26@@ -80,17 +77,17 @@
27 }
28 }
29
30- view.engine()->rootContext()->setContextProperty("tablet", false);
31- view.engine()->rootContext()->setContextProperty("phone", false);
32+ view.engine()->rootContext()->setContextProperty("tablet", QVariant(false));
33+ view.engine()->rootContext()->setContextProperty("phone", QVariant(false));
34 if (args.contains("-t") || args.contains("--tablet")) {
35 qDebug() << "running in tablet mode";
36- view.engine()->rootContext()->setContextProperty("tablet", true);
37+ view.engine()->rootContext()->setContextProperty("tablet", QVariant(true));
38 } else if (args.contains("-p") || args.contains("--phone")){
39 qDebug() << "running in phone mode";
40- view.engine()->rootContext()->setContextProperty("phone", true);
41+ view.engine()->rootContext()->setContextProperty("phone", QVariant(true));
42 } else if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient") {
43 // Default to tablet size on X11
44- view.engine()->rootContext()->setContextProperty("tablet", true);
45+ view.engine()->rootContext()->setContextProperty("tablet", QVariant(true));
46 }
47
48 view.engine()->setImportPathList(importPathList);
49@@ -103,18 +100,20 @@
50 AccountPreference preferences;
51 view.engine()->rootContext()->setContextProperty("accountPreference", &preferences);
52
53- // load the qml file
54+ QString qmlfile;
55+ const QString filePath = QLatin1String("qml/reminders.qml");
56+ QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
57+ paths.prepend(QCoreApplication::applicationDirPath());
58+ Q_FOREACH (const QString &path, paths) {
59+ QString myPath = path + QLatin1Char('/') + filePath;
60+ if (QFile::exists(myPath)) {
61+ qmlfile = myPath;
62+ break;
63+ }
64+ }
65+ // sanity check
66 if (qmlfile.isEmpty()) {
67- QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
68- paths.prepend(".");
69-
70- foreach (const QString &path, paths) {
71- QFileInfo fi(path + "/qml/reminders.qml");
72- if (fi.exists()) {
73- qmlfile = path + "/qml/reminders.qml";
74- break;
75- }
76- }
77+ qFatal("File: %s does not exist at any of the standard paths!", qPrintable(filePath));
78 }
79 qDebug() << "using main qml file from:" << qmlfile;
80 view.setSource(QUrl::fromLocalFile(qmlfile));
81
82=== modified file 'tests/autopilot/reminders/tests/__init__.py'
83--- tests/autopilot/reminders/tests/__init__.py 2014-03-17 22:57:31 +0000
84+++ tests/autopilot/reminders/tests/__init__.py 2014-04-01 10:40:25 +0000
85@@ -43,7 +43,6 @@
86 scenarios = [('with touch', dict(input_device_class=Touch))]
87
88 local_location_binary = "../../src/app/reminders"
89- local_location_qml = "../../src/app/qml/reminders.qml"
90 installed_location_binary= "/usr/bin/reminders"
91 installed_location_qml = "/usr/share/reminders/qml/reminders.qml"
92
93@@ -62,7 +61,6 @@
94 logger.debug("Launching via local")
95 self.app = self.launch_test_application(
96 self.local_location_binary,
97- "-q " + self.local_location_qml,
98 app_type='qt',
99 emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
100
101
102=== modified file 'tests/autopilot/run' (properties changed: -x to +x)

Subscribers

People subscribed via source and target branches