Merge lp://qastaging/~mir-team/mir/public-cookie-api into lp://qastaging/mir
- public-cookie-api
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Brandon Schaefer |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3269 |
Proposed branch: | lp://qastaging/~mir-team/mir/public-cookie-api |
Merge into: | lp://qastaging/mir |
Diff against target: |
4380 lines (+1209/-588) 103 files modified
3rd_party/CMakeLists.txt (+1/-0) 3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h (+8/-6) 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h (+4/-4) 3rd_party/android-input/android/frameworks/base/services/input/Input.cpp (+6/-6) 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp (+10/-10) debian/control (+2/-2) debian/libmircookie2.install (+1/-1) include/client/mir/events/event_builders.h (+21/-3) include/client/mir_toolkit/events/event.h (+2/-0) include/client/mir_toolkit/events/input/input_event.h (+18/-1) include/client/mir_toolkit/mir_client_library.h (+1/-0) include/client/mir_toolkit/mir_cookie.h (+71/-0) include/client/mir_toolkit/mir_surface.h (+9/-0) include/cookie/mir/cookie/authority.h (+57/-50) include/cookie/mir/cookie/cookie.h (+57/-0) include/server/mir/server.h (+4/-4) include/server/mir/shell/abstract_shell.h (+1/-1) include/server/mir/shell/shell.h (+1/-1) include/server/mir/shell/shell_wrapper.h (+1/-1) src/client/CMakeLists.txt (+3/-1) src/client/events/event_builders.cpp (+62/-13) src/client/input/android/android_input_lexicon.cpp (+7/-3) src/client/input/input_event.cpp (+97/-1) src/client/mir_cookie.cpp (+49/-0) src/client/mir_cookie.h (+40/-0) src/client/mir_surface.cpp (+5/-5) src/client/mir_surface.h (+1/-2) src/client/mir_surface_api.cpp (+2/-3) src/client/rpc/mir_display_server.cpp (+1/-1) src/client/rpc/mir_display_server.h (+1/-1) src/client/symbols.map (+7/-0) src/cookie/CMakeLists.txt (+5/-3) src/cookie/authority.cpp (+97/-32) src/cookie/format.h (+35/-0) src/cookie/hmac_cookie.cpp (+53/-0) src/cookie/hmac_cookie.h (+51/-0) src/cookie/symbols.map (+5/-5) src/include/common/mir/events/event_private.h (+4/-4) src/include/common/mir/protobuf/display_server.h (+1/-1) src/include/cookie/mir/cookie/blob.h (+19/-30) src/include/server/mir/default_server_configuration.h (+3/-3) src/include/server/mir/frontend/security_check_failed.h (+0/-34) src/include/server/mir/frontend/shell.h (+1/-1) src/include/server/mir/frontend/template_protobuf_message_processor.h (+2/-2) src/include/server/mir/server_configuration.h (+2/-2) src/protobuf/mir_protobuf.proto (+1/-2) src/server/CMakeLists.txt (+1/-0) src/server/default_server_configuration.cpp (+5/-5) src/server/frontend/CMakeLists.txt (+0/-1) src/server/frontend/default_configuration.cpp (+1/-1) src/server/frontend/default_ipc_factory.cpp (+4/-4) src/server/frontend/default_ipc_factory.h (+3/-3) src/server/frontend/protobuf_message_processor.cpp (+4/-4) src/server/frontend/security_check_failed.cpp (+0/-24) src/server/frontend/session_mediator.cpp (+10/-10) src/server/frontend/session_mediator.h (+4/-4) src/server/frontend/shell_wrapper.cpp (+2/-2) src/server/frontend/shell_wrapper.h (+1/-1) src/server/input/android/input_sender.cpp (+3/-3) src/server/input/default_configuration.cpp (+3/-3) src/server/input/default_event_builder.cpp (+18/-11) src/server/input/default_event_builder.h (+3/-3) src/server/input/default_input_device_hub.cpp (+6/-6) src/server/input/default_input_device_hub.h (+4/-4) src/server/input/key_repeat_dispatcher.cpp (+7/-4) src/server/input/key_repeat_dispatcher.h (+3/-3) src/server/input/surface_input_dispatcher.cpp (+1/-2) src/server/input/validator.cpp (+1/-1) src/server/server.cpp (+2/-2) src/server/shell/abstract_shell.cpp (+1/-1) src/server/shell/frontend_shell.cpp (+2/-2) src/server/shell/frontend_shell.h (+1/-1) src/server/shell/shell_wrapper.cpp (+2/-2) src/server/symbols.map (+6/-6) tests/acceptance-tests/test_client_cookie.cpp (+72/-47) tests/acceptance-tests/test_client_input.cpp (+1/-1) tests/acceptance-tests/test_surface_modifications.cpp (+3/-4) tests/acceptance-tests/test_surface_placement.cpp (+1/-2) tests/acceptance-tests/test_surface_raise.cpp (+83/-54) tests/acceptance-tests/test_surface_specification.cpp (+3/-4) tests/include/mir/test/doubles/mock_shell.h (+1/-1) tests/include/mir/test/doubles/stub_display_server.h (+1/-1) tests/integration-tests/CMakeLists.txt (+1/-0) tests/integration-tests/input/test_single_seat_setup.cpp (+3/-3) tests/mir_test_doubles/CMakeLists.txt (+1/-0) tests/unit-tests/CMakeLists.txt (+1/-0) tests/unit-tests/client/input/test_android_input_receiver.cpp (+2/-2) tests/unit-tests/client/input/test_xkb_mapper.cpp (+1/-2) tests/unit-tests/frontend/test_event_sender.cpp (+1/-2) tests/unit-tests/frontend/test_session_mediator.cpp (+10/-11) tests/unit-tests/input/android/test_android_input_lexicon.cpp (+7/-10) tests/unit-tests/input/android/test_android_input_sender.cpp (+8/-13) tests/unit-tests/input/evdev/test_libinput_device.cpp (+3/-3) tests/unit-tests/input/test_default_input_device_hub.cpp (+3/-3) tests/unit-tests/input/test_event_builders.cpp (+7/-12) tests/unit-tests/input/test_event_filter_chain_dispatcher.cpp (+1/-1) tests/unit-tests/input/test_key_repeat_dispatcher.cpp (+5/-5) tests/unit-tests/input/test_surface_input_dispatcher.cpp (+10/-10) tests/unit-tests/input/test_validator.cpp (+1/-1) tests/unit-tests/input/test_x11_platform.cpp (+2/-2) tests/unit-tests/scene/test_abstract_shell.cpp (+4/-4) tests/unit-tests/scene/test_surface.cpp (+2/-2) tests/unit-tests/test_mir_cookie.cpp (+44/-36) |
To merge this branch: | bzr merge lp://qastaging/~mir-team/mir/public-cookie-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alan Griffiths | Abstain | ||
Mir CI Bot | continuous-integration | Approve | |
Andreas Pokorny (community) | Approve | ||
Alexandros Frantzis (community) | Needs Fixing | ||
Alberto Aguirre (community) | Approve | ||
Chris Halse Rogers | Approve | ||
Daniel van Vugt | Abstain | ||
Kevin DuBois (community) | Approve | ||
Review via email:
|
Commit message
Re-add support for get a MirCookie as well as Raising a surface with a MirCookie.
The MirCookie structure is now opaque.
Description of the change
Re-add support for get a MirCookie as well as Raising a surface with a MirCookie.
The MirCookie structure is now opaque.
Different APIs we have considered:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3239
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3239
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3241
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3240
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3241
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3242
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3243
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3243
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Kevin DuBois (kdub) wrote : | # |
> Should the mir_input_
> char*?)
my vote is MirCookie*
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
After ROAF and I talking for a bit we settled on void* since we are send a stream of *unknown* bytes. Since not just the mac is being sent, so is the timestamp
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3244
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3244
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Halse Rogers (raof) wrote : | # |
The Story Of The Void*:
Brandon and I had a *long* back and forth about client API wrt MirCookie, ranging from having a MirCookie type that can be converted into a MirBlob, to essentially duplicating MirBlob's API against a MirCookie, to a non-opaque struct MirCookie { size_t length, void* data };
Neither of us were particularly happy with any of them.
The void* API here is (a) transparent - it's clear to everyone that they've just got a blob of data, (b) quick to implement, and (c) is minimally constraining for future, better, implementations with better APIs.
General comment: I'm pretty sure you don't need reinterpret_cast<> to go between void* and MirCookie*; static_
42 + * \params[in] ev The input event
43 + * \params[in] cookie An allocated void* with exactly cookie_size bytes
44 + * \params[in] size The size of the MirCookie
45 + */
46 +void mir_input_
Two things: do we need to pass size in here? We're only going to assert that it's exactly mir_input_
And: If we do keep the size, you need to update the comment; no MirCookie here ☺.
Also a couple of inline comments.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3245
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3245
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3246
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3246
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Kevin DuBois (kdub) wrote : | # |
not too flummoxed about use of void*, especially if you & Chris gave it more thought than I had behind my comment. Some other things that I'm not too flummoxed about (esp given that (as I understand) this is needed in short order)
+ auto const* pev = mir_input_
no need for * (a few other places)
+ // FIXME Moveing to 160bits soon
typo
+ void* cookie = malloc(size);
would be a bit better to use a RAII type in allocation for this test (and would eliminate the need for a destructor too)
768: std::mutex mutex;
A bit strange to have the mutex be public, and require locking it before accessing some members. Would be better encapsulated to have functions on the object to do that.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> not too flummoxed about use of void*, especially if you & Chris gave it more
> thought than I had behind my comment. Some other things that I'm not too
> flummoxed about (esp given that (as I understand) this is needed in short
> order)
>
> + auto const* pev = mir_input_
> no need for * (a few other places)
I was mainly doing that so you can see its a pointer (I like seeing types sometimes), but yeah auto captures that :). Fixed.
>
> + // FIXME Moveing to 160bits soon
> typo
>
Opps. Fixed.
> + void* cookie = malloc(size);
> would be a bit better to use a RAII type in allocation for this test (and
> would eliminate the need for a destructor too)
Yes! I attempted it but ran into issue when I was using the MirCookie* since the size was not known (should have just written my own destructor for the shared_ptr to cast and delete[].) Fixed.
>
> 768: std::mutex mutex;
> A bit strange to have the mutex be public, and require locking it before
> accessing some members. Would be better encapsulated to have functions on the
> object to do that.
Agreed, and it looks much cleaner :). Fixed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
There's stuff I'm concerned about, but I'm out of time today to review properly - will get to it first thing tomorrow.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
(pushing coming in a few :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
void* is an incomplete type, soo to put it into a shared/unique ptr fails on a static_assert. I suppose for testing i could just cast it to a uint8_t, since its in bytes... or just leave it with a malloc/free :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3247
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3249
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3248
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Halse Rogers (raof) wrote : | # |
Bunch of locking issues still in the tests; marked inline.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3250
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3251
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
Different APIs we have considered:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3250
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Halse Rogers (raof) wrote : | # |
566 + void handle_
567 + {
568 + std::lock_
569 + if (mir_input_
570 + {
571 + auto const size = mir_input_
572 + std::vector<
573 +
574 + mir_input_
575 + out_cookies.
576 + }
577 +
578 + event_count++;
579 + }
580 +
581 + size_t get_event_count() const
582 + {
583 + std::lock_
584 + return event_count;
585 + }
586 +
587 + size_t cookie_size() const
588 + {
589 + std::lock_
590 + return out_cookies.size();
591 + }
592 +
593 + std::vector<
594 + {
595 + std::lock_
596 + return out_cookies.back();
597 + }
598 +
599 + bool cookies_empty() const
600 + {
601 + std::lock_
602 + return out_cookies.
603 + }
While not blocking, this seems to be a bit of a faff for the testcase vs just directly locking the mutex when necessary :).
Otherwise, I'm OK, pending possible API changes :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3252
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3253
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3252
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Halse Rogers (raof) wrote : | # |
Oh, whoops! Missed one thing, sorry.
This would appear to be a libmircookie ABI break, so should be accompanied by a SONAME bump.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3254
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3253
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3254
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandros Frantzis (afrantzis) wrote : | # |
+ typedef struct MirCookie MirCookie;
Not needed (at the moment at least), and also may conflict with mir::cookie:
- virtual MirCookie timestamp_
A *Cookie*Factory that doesn't create cookies seems strange.
Needs discussion/fixing
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3255
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
+// FIXME Remove me when we are no longer returning 8 byte MACS
+// We assert that what we return is 8 bytes, so lets test for that for now!
+TEST(MirCookie
+{
+ std::vector<
+ auto factory = mir::cookie:
+ uint64_t mock_timestamp{
+ auto mac = factory-
+
+ EXPECT_
+}
sizeof(uint64_t) is not a synonym for 8 - although platforms with 16bit characters are of little interest to us.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
Nits to fix and questions:
CookieFactory looks less and less like a "factory" interface. Would "CookieAuthority" be a better name?
~~~~
+ virtual bool attest_
This is the only place in the interface MirCookie is mentioned. Should we simply lose this function and require the user to call the other overload?
~~~~
+void mir_input_
I'm always cautions of APIs that take a target buffer and no buffer size - while not bulletproof the latter is at least a reminder to the user to obtain the size.
~~~~
+void mir_surface_
By using void* we loose the type safety that we have with other Mir APIs. Can you provide some justification for this design choice? E.g. will this function be primarily for clients that obtained the cookie from a non-Mir API?
~~~~
- * Copyright © 2015 Canonical Ltd.
+ * Copyright © 2016 Canonical Ltd.
Don't remove the 2015 copyright claim. (I know these headers are legally unnecessary and PITA, but let's try to do it right.)
~~~~
+ /* No mac == no size! */
+ return 0;
It should be a precondition that there's a MAC. I.e. the function should begin with something like:
mir:
~~~~
+#include "mir/cookie.h"
#include "mir/cookie_
The first include of the source file should be the corresponding header (to ensure it compiles by itself).
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3255
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> +// FIXME Remove me when we are no longer returning 8 byte MACS
> +// We assert that what we return is 8 bytes, so lets test for that for now!
> +TEST(MirCookie
> +{
> + std::vector<
> 0x01 };
> + auto factory = mir::cookie:
> + uint64_t mock_timestamp{
> + auto mac = factory-
> +
> + EXPECT_
> +}
>
> sizeof(uint64_t) is not a synonym for 8 - although platforms with 16bit
> characters are of little interest to us.
Hmm should I just not assert this then? Since really all im assert is that our mac == sizeof(uint64_t). So possibly I should just change the name.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> Nits to fix and questions:
>
> CookieFactory looks less and less like a "factory" interface. Would
> "CookieAuthority" be a better name?
>
> ~~~~
Agreed.
>
> + virtual bool attest_
>
> This is the only place in the interface MirCookie is mentioned. Should we
> simply lose this function and require the user to call the other overload?
>
> ~~~~
The reason for keeping this, is theres no way to de construct a MirCookie in the public. So once the content hub gets a mir cookie it wont know how to *attest* it.
>
> +void mir_input_
>
> I'm always cautions of APIs that take a target buffer and no buffer size -
> while not bulletproof the latter is at least a reminder to the user to obtain
> the size.
>
> ~~~~
Thats sounds quite reasonable to me.
>
> +void mir_surface_
>
> By using void* we loose the type safety that we have with other Mir APIs. Can
> you provide some justification for this design choice? E.g. will this
> function be primarily for clients that obtained the cookie from a non-Mir API?
>
> ~~~~
I agree, and will be switching to a MirCookie* for both the copy and these functions since void* and MirCookie* will both be incomplete types.
>
> - * Copyright © 2015 Canonical Ltd.
> + * Copyright © 2016 Canonical Ltd.
>
> Don't remove the 2015 copyright claim. (I know these headers are legally
> unnecessary and PITA, but let's try to do it right.)
>
> ~~~~
Opps. Yeah Ill fix those!
>
> + /* No mac == no size! */
> + return 0;
>
> It should be a precondition that there's a MAC. I.e. the function should begin
> with something like:
>
> mir::require(
>
> ~~~~
This is true, if we have a function that tells you if an event has a cookie we better require it to actually have one when attempting to construct it!.
>
> +#include "mir/cookie.h"
> #include "mir/cookie_
>
> The first include of the source file should be the corresponding header (to
> ensure it compiles by itself).
Will fix!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> + typedef struct MirCookie MirCookie;
>
> Not needed (at the moment at least), and also may conflict with
> mir::cookie:
Opps thought I removed all thoses... Had an idea at one point that I think made it into a file :)
>
> - virtual MirCookie timestamp_
>
> A *Cookie*Factory that doesn't create cookies seems strange.
>
> Needs discussion/fixing
Right it doesnt create any MirCookies but it creates what a cookie is. With alans comment, changing the name to:
CookieAuthority
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
> > sizeof(uint64_t) is not a synonym for 8 - although platforms with 16bit
> > characters are of little interest to us.
>
> Hmm should I just not assert this then? Since really all im assert is that our
> mac == sizeof(uint64_t). So possibly I should just change the name.
On reflection, if unit8_t exists we're safe to assume 8 bit chars. (And if it doesn't we don't compile.)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
> > + virtual bool attest_
> >
> > This is the only place in the interface MirCookie is mentioned. Should we
> > simply lose this function and require the user to call the other overload?
> >
> > ~~~~
>
> The reason for keeping this, is theres no way to de construct a MirCookie in
> the public. So once the content hub gets a mir cookie it wont know how to
> *attest* it.
are you conflating ::MirCookie and mir::cookie:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> > > + virtual bool attest_
> > >
> > > This is the only place in the interface MirCookie is mentioned. Should we
> > > simply lose this function and require the user to call the other overload?
> > >
> > > ~~~~
> >
> > The reason for keeping this, is theres no way to de construct a MirCookie in
> > the public. So once the content hub gets a mir cookie it wont know how to
> > *attest* it.
>
> are you conflating ::MirCookie and mir::cookie:
Well only mir::cookie:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
Though there will be an issue... if i move from a void* to a MirCookie* in the public API... not sure how to combine a MirCookie* into a mir::cookie:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3258
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
Some concerns addressed. Abstaining until I have time to review again.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3258
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3259
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3259
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
+/*
+ *
+ * \params[in] ev The input event
+ * \params[in] cookie An allocated void* with exactly cookie_size bytes
+ * \params[in] size The size of the allocated void*
+ */
+void mir_input_
When comments and code disagree, both are likely wrong.
While I'm not sure I fully understand the intended usage I suspect that have two scenarios:
1. Getting a MirCookie from an event.
2. Converting a MirCookie to and from a chunk of memory.
In neither of these does it make sense for a user to supply allocate and supply a pointer to an incomplete type.
How about:
MirCookie* mir_input_
and either:
MirCookie* mir_blob_
MirBlob* mir_blob_
Or:
size_t mir_cookie_
void mir_cookie_
MirCookie* mir_cookie_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
[Just comment]
It (still) seems odd that CookieAuthority deals with both MirCookies and with pairs of timestamp and MAC. Surely a /cookie/ authority should deal with Cookies? Would it not make more sense as:
auto make_cookie(
auto authenticated_
Having clients aware of the MAC seems like a leaky abstraction
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3261
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3262
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3263
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3264
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3261
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3264
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3264
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3265
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3265
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3266
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3266
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Halse Rogers (raof) wrote : | # |
394 +/* Returns an allocated MirCookie that you must release with mir_cookie_release
394 + *
395 + * \params[in] ev The input event
396 + * \return An allocated and ref'ed cookie
397 + */
There's no need to say “allocated” or “ref'ed” here.
394 +/* Returns the MirCookie associated with this input event.
394 + *
395 + * \params[in] ev The input event
396 + * \return A reference to the MirCookie associated with this input event.
397 + * This must be released with a call to mir_cookie_
398 + */
Likewise:
415 +/* Turns the user copyed buffer back into a MirCookie, which must be
416 + * released with mir_cookie_release
417 + *
418 + * \params[in] buffer The buffer used to get a MirCookie back
419 + * \return A newely allocated MirCookie
420 + */
421 +MirCookie const* mir_cookie_
should maybe be:
415 +/* Create a MirCookie from a serialised representation.
417 + *
418 + * \params[in] buffer The buffer containing a serialised MirCookie.
418 + * The buffer may be freed immediately after this call.
419 + * \return A reference to a MirCookie.
418 + * This must be released with a call to mir_cookie_
420 + */
421 +MirCookie const* mir_cookie_
This can never return NULL, right?
Actually: we should probably pass in the length of the buffer here and return NULL if it doesn't match what we expect. Clients will get this passed in from other sources, and it'll courteous to tell them if it's easy to detect that it's wrong.
443 +* \param [in] cookie The void* from the input event that you want to raise the window from.
Ba baw!
1143 + mir_surface_
1144 + mir_input_
1145 + mir_cookie_
1146 + mir_input_
1147 + mir_cookie_
1148 + mir_cookie_
1149 + mir_cookie_release;
These should be in MIR_CLIENT_
+ if (raw_cookie.size() < cookie_
Should be !=, right?
Why did you move mir::SecurityCh
2029 + auto const& cookie_ptr = cookie_
I'm surprised this passed valgrind? unmarshall_cookie() returns a std::unique_ptr<>, that you take a *reference* to, and then the std::unique_ptr<> gets *destroyed* at the end of the statement.
Likewise in a bunch of other places. Why doesn't this blow up?
A: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3267
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3267
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
First pass - cosmetic stuff
+/* Returns an allocated MirCookie that you must release with mir_cookie_release
+ *
+ * \params[in] ev The input event
+ * \return An allocated and ref'ed cookie
+ */
+MirCookie const* mir_input_
1. The /precondition/ that the event has a cookie is missing.
2. "An allocated and ref'ed cookie" is implementation detail the user isn't interested in.
~~~~
+ * \return The size needed to allocate a buffer
+ */
+size_t mir_cookie_
While allocation is likely what the client will do, surely this is just the size of buffer needed by mir_cookie_
~~~~
+ * \params[in] buffer The allocated buffer to copy the MirCookie into
+ * \params[in] size The size of the allocated buffer
+ */
+void mir_cookie_
%s/allocated //
~~~~
+MirCookie const* mir_cookie_
I think it would be useful validation for the buffer size to be supplied and checked. While not bulletproof the it is a reminder to the user that size matters.
~~~~
+* \param [in] cookie The void* from the input event that you want to raise the window from.
+*/
+void mir_surface_
The comment and the code disagree
~~~~
+ HMAC_SHA_1_8
Is there a reason for the non standard naming style? https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3270
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel van Vugt (vanvugt) wrote : | # |
From what I've been hearing, I think the terms "cookie" and "marshalling" are over-abstracting the situation. It's better to use more concrete nouns and verbs so the reader more easily understands what's going on. But this is not a review.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3267
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3270
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3270
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3271
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3271
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3271
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3272
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3273
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3272
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Halse Rogers (raof) wrote : | # |
Ok, I think. Two inline nonblocking doc comments.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alberto Aguirre (albaguirre) wrote : | # |
Mostly cosmetic things.
mir::cookie::Array => mir::cookie::Blob
Comment suggestions
---
+
386 +/* Tells if the MirInputEvent has a MirCookie
387 + *
388 + * \params[in] ev The input event
389 + * \return True if the input event has a MirCookie
390 + */
change to:
+
386 +/* Query if an input event contains a cookie
387 + *
388 + * \params[in] ev The input event
389 + * \return True if the input event contains a cookie
390 + */
---
---
/* Returns the MirCookie associated with this input event.
*
* \pre The input event must have a MirCookie
* \params[in] ev The input event
* \return A reference to the MirCookie associated with this input event
* This must be released with a call to mir_cookie_
*/
change to:
/* Returns the cookie associated with an input event.
*
* \pre The input event must have a MirCookie
* \params[in] ev An input event
* \return The cookie associated with the given input event
* The cookie must be released by calling mir_cookie_release
*/
---
/* The size of the buffer needed to serialize this MirCookie
*
* \params[in] cookie The MirCookie
* \return The size needed for a buffer
*/
size_t mir_cookie_
change to:
/* Queries the size needed to serialize a given cookie
*
* \params[in] cookie A cookie instance
* \return The size of the serialized representation of the given cookie
*/
size_t mir_cookie_
---
---
/* Copy the MirCookie into an allocated buffer
*
* \pre The size must be equal to mir_cookie_get_size
* \params[in] cookie The MirCookie
* \params[in] buffer The allocated buffer to copy the MirCookie into
* \params[in] size The size of the allocated buffer
*/
change to:
/* Serializes a cookie into the given buffer
*
* \pre The size must be equal to mir_cookie_get_size
* \params[in] cookie A cookie instance
* \params[in] buffer A buffer which is filled with the serialized representation
* \params[in] size The size of the given buffer
*/
void mir_cookie_
To be consistent with mir_cookie_
mir_cookie_
---
/* Create a MirCookie from a serialised representation
*
* \pre The size must be equal to mir_cookie_get_size
* \params[in] buffer The buffer containing a serialised MirCookie.
* The buffer may be freed immediately after this call.
* \return A reference to a MirCookie.
* This must be released with a call to mir_cookie_
*/
MirCookie const* mir_cookie_
change to:
/* Create a cookie from a serialized representation
*
* \pre The size must be equal to mir_cookie_get_size
* \params[in] buffer The buffer containing a serialized cookie.
* The buffer may be freed immediately after this call.
* \return A MirCookie instance. The instance must be re...
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
+#include "mir/cookie_
Seeing this caused me to notice an existing issue:
It really ought reflect the "namespace == directory" convention used elsewhere: #include "mir/cookie/
Not sure if we should fix, or just live with it as "mir/cookie_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alberto Aguirre (albaguirre) wrote : | # |
Oops on the last one I meant:
---
void mir_cookie_
{
mir:
memcpy(buffer, cookie, size);
}
---
With a client side MirCookie class suggested above would just become:
void mir_cookie_
{
return cookie-
}
and mir_cookie_release turns into:
+void mir_cookie_
{
delete cookie;
}
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3273
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3273
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3276
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3276
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3277
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3277
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3278
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3278
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3279
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3281
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3285
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
+/* Queries the size needed to serialize a given cookie
+ *
+ * \params[in] cookie A cookie instance
+ * \return The size of the serialized representation of the given cookie
+ */
+size_t mir_cookie_
Would mir_cookie_
~~~~
+/* Create a cookie from a serialized representation
+ *
+ * \pre The size must be equal to mir_cookie_size
+ * \params[in] buffer The buffer containing a serialized cookie.
+ * The buffer may be freed immediately after this call.
+ * \return A MirCookie instance. The instance must be released
+ with a call to mir_cookie_release.
+ */
+MirCookie const* mir_cookie_
The precondition is impossible for the client to check - mir_cookie_size() takes a parameter that isn't (in the general case) available to the client.
Perhaps we should drop the cookie parameter from mir_cookie_size()? Or do we expect different cookies to have different sizes?
~~~~
+class Cookie
+{
+public:
+ virtual ~Cookie() = default;
+
+ /**
+ * Returns the timestamp that the cookie is built with
+ *
+ * \return The timestamp
+ */
+ virtual uint64_t timestamp() const = 0;
+
+ /**
+ * Converts the cookie into a stream of bytes.
+ *
+ * \return The stream of bytes formatted
+ */
+ virtual std::vector<
+};
interfaces should delete CopyAssign
~~~~
- void raise_surface_
+ void raise_surface(
Is this API break necessary? It will break downstreams. (And is how it motivated by the purpose of this MP?)
~~~~
inline mir::cookie::Blob const& getCookie() const { return mCookie; }
so getCookie() returns a blob? Confusing! "getCookieAsBlo
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
Non-blocking questions and comments:
mev::make_
- kev->getMac(),
+ {std::begin(
mia::mir_
kev->getScanCode(),
Why do we need to create a "std::vector<
~~~~
+ MirCookie() = delete;
What advantage is there for disabling default construction?
~~~~
+#include "cookie.h"
We usually write the full path in public headers. Vis:
#include "mir/cookie/
~~~~
+ * \return A unique_ptr Authority
I don't think it useful to mention unique_ptr in the doc comment. (And you don't do it consistently.)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3279
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> +/* Queries the size needed to serialize a given cookie
> + *
> + * \params[in] cookie A cookie instance
> + * \return The size of the serialized representation of the given
> cookie
> + */
> +size_t mir_cookie_
>
> Would mir_cookie_
>
> ~~~~
Yes it would. Changing.
>
> +/* Create a cookie from a serialized representation
> + *
> + * \pre The size must be equal to mir_cookie_size
> + * \params[in] buffer The buffer containing a serialized cookie.
> + * The buffer may be freed immediately after this call.
> + * \return A MirCookie instance. The instance must be released
> + with a call to mir_cookie_release.
> + */
> +MirCookie const* mir_cookie_
>
> The precondition is impossible for the client to check - mir_cookie_size()
> takes a parameter that isn't (in the general case) available to the client.
>
> Perhaps we should drop the cookie parameter from mir_cookie_size()? Or do we
> expect different cookies to have different sizes?
>
> ~~~~
While atm the cookie size is consistent, the cookie size is dependent on the cookie authority implementation.
As far as the size, the size for the buffer *must* be mir_cookie_size() and it *must* get that size to allocate said buffer. The only way they could have gotten an allocated buffer, would be by querying the size. So I would think its up to the user to pass the size_t size around which MUST be equal to the mir_cookie_size at one point.
>
> +class Cookie
> +{
> +public:
> + virtual ~Cookie() = default;
> +
> + /**
> + * Returns the timestamp that the cookie is built with
> + *
> + * \return The timestamp
> + */
> + virtual uint64_t timestamp() const = 0;
> +
> + /**
> + * Converts the cookie into a stream of bytes.
> + *
> + * \return The stream of bytes formatted
> + */
> + virtual std::vector<
> +};
>
> interfaces should delete CopyAssign
>
> ~~~~
Reasonable, Changing.
>
> - void raise_surface_
> + void raise_surface(
>
> Is this API break necessary? It will break downstreams. (And is how it
> motivated by the purpose of this MP?)
>
> ~~~~
This API is new, (was removed from the API before the 0.18 release). So just trying to get the correct name for it.
>
> inline mir::cookie::Blob const& getCookie() const { return mCookie; }
>
> so getCookie() returns a blob? Confusing! "getCookieAsBlo
Very confusing, and yes Ill go through and rename that.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> Non-blocking questions and comments:
>
> mev::make_
> kev->getEventTi
> - kev->getMac(),
> + {std::begin(
> mia::mir_
> kev->getRepeatC
> kev->getKeyCode(),
> kev->getScanCode(),
>
> Why do we need to create a "std::vector<
> (called "cookie"!)? What stops make_event taking a blob const&?
>
> ~~~~
>
Since blob const& is a std::array<uint8_t, 17> and the event_builder.h is c++ public API. Since its a public API I move back to std::array so we dont depend on a fix size for the cookie.
> + MirCookie() = delete;
>
> What advantage is there for disabling default construction?
>
>
> ~~~~
>
> +#include "cookie.h"
>
> We usually write the full path in public headers. Vis:
>
> #include "mir/cookie/
>
> ~~~~
Makes sesne, and reads better. Changing.
>
> + * \return A unique_ptr Authority
>
> I don't think it useful to mention unique_ptr in the doc comment. (And you
> don't do it consistently.)
Changing.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> MirCookie() = delete;
> What advantage is there for disabling default construction?
Mainly to force the creation of only valid MirCookies. So if we ever get one we know it must have been created through one of its explicit CTOR.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andreas Pokorny (andreas-pokorny) wrote : | # |
From what I see at the ClientCookies fixture. The test body does not wait for the client surface to be exposed and focused. So there is a chance that the SurfaceInputDis
Is there a reason why you do not throw SecurityCheckErrors with BOOST_THROW_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3286
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
+MirCookie const* mir_cookie_
+{
+ if (size != mir::cookie:
+ return NULL;
+
+ return new MirCookie(buffer, size);
+}
While it is extremely unlikely for operator new() (or any of the other code currently invoked here) to throw I think we should trap exceptions and not allow them to propagate from a C API.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
> Is there a reason why you do not throw SecurityCheckErrors with
> BOOST_THROW_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
> > Is there a reason why you do not throw SecurityCheckErrors with
> > BOOST_THROW_
Rats! the code changed while I was reading it.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> +MirCookie const* mir_cookie_
> +{
> + if (size != mir::cookie:
> + return NULL;
> +
> + return new MirCookie(buffer, size);
> +}
>
> While it is extremely unlikely for operator new() (or any of the other code
> currently invoked here) to throw I think we should trap exceptions and not
> allow them to propagate from a C API.
Fixed!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3287
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
I've looked at this code too many times today to approve it. I'm not seeing what is there anymore.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3289
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandros Frantzis (afrantzis) wrote : | # |
A first pass:
+ static std::unique_
The name 'create_saving' is not very clear.
+ std::copy_
The code as written could overflow the kev.cookie array.
+#include "../mir_cookie.h"
We generally try to avoid pulling headers from parent directories (but it's not a dealbreaker, and it seems we are doing it more on the client side).
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3290
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3291
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3285
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3292
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3291
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3292
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3293
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3293
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3294
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3296
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3296
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andreas Pokorny (andreas-pokorny) wrote : | # |
ok you resolved everything i saw in this or the upcoming MP
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
@"* I guess gcc 4.* assume const for auto = make_unique<..> which causes issues when attempting to return a derived class to a base class. You cannot return a const unique_ptr since it cannot be std::moved"
I guess you're wrong: that would make auto support implausibly broken.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
+ * NULL will be returned if the buffer and size dont describe
s/dont/don't/
~~~~
+ * Construction function used to create a Authority. The secret size must be
s/a Authority/an Authority/
~~~~
+ // TODO Soon to be removed!
+ static std::unique_
Why?
~~~~
/// Sets an override functor for creating the cookie factory.
s/factory/
~~~~
+ mir::cookie::Blob copy_vector_
It's local to the TU, so I wouldn't block, but I'd reserve "copy" for functions that take a target. I'd call it something like "as_blob".
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
This introduces a number of FIXME/TODO comments, without it being clear when or why they will addressed.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> This introduces a number of FIXME/TODO comments, without it being clear when
> or why they will addressed.
All removed in this branch:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> @"* I guess gcc 4.* assume const for auto = make_unique<..> which causes
> issues when attempting to return a derived class to a base class. You cannot
> return a const unique_ptr since it cannot be std::moved"
>
> I guess you're wrong: that would make auto support implausibly broken.
Re looking at the compiler error... just looks like problem with implicit conversions? Not sure how removing the auto fixed it for me now though :(
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
> + * NULL will be returned if the buffer and size dont describe
>
> s/dont/don't/
>
> ~~~~
Fixing
>
> + * Construction function used to create a Authority. The secret size must be
>
> s/a Authority/an Authority/
>
> ~~~~
Fixing
>
> + // TODO Soon to be removed!
> + static std::unique_
>
> Why?
>
> ~~~~
Hmm that fixme shouldnt be there anymore? The reason was because we were going to create a lazy creation method for the secret. So we didnt depend on it on boot. Which ill be making a branch soon for that even though we've a work around in USC for the moment.
>
> /// Sets an override functor for creating the cookie factory.
>
> s/factory/
>
> ~~~~
Fixing.
>
> + mir::cookie::Blob copy_vector_
> vector)
>
> It's local to the TU, so I wouldn't block, but I'd reserve "copy" for
> functions that take a target. I'd call it something like "as_blob".
Sounds good, fixing!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
>+ // TODO Soon to be removed!
>+ static std::unique_
>
>Why?
Opps its a TODO, and yeah removed that this branch no need to have that TODO, and ill be address it very soon!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3297
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3297
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
Doc fixes have been applied.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alberto Aguirre (albaguirre) wrote : | # |
^-Network hiccup
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
Should the mir_input_ event_get_ cookie use MirCookie* or just a uint8_t* (or char*?)