Merge lp:~phablet-team/media-hub/add-unity8-exception into lp:media-hub
- add-unity8-exception
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alfonso Sanchez-Beato |
Approved revision: | 174 |
Merged at revision: | 172 |
Proposed branch: | lp:~phablet-team/media-hub/add-unity8-exception |
Merge into: | lp:media-hub |
Diff against target: |
95 lines (+22/-6) 2 files modified
src/core/media/apparmor/ubuntu.cpp (+18/-6) src/core/media/apparmor/ubuntu.h (+4/-0) |
To merge this branch: | bzr merge lp:~phablet-team/media-hub/add-unity8-exception |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alfonso Sanchez-Beato | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Paweł Stołowski (community) | Approve | ||
Review via email: mp+285627@code.launchpad.net |
Commit message
Add apparmor exception to media-hub for unity8
Description of the change
Add apparmor exception to media-hub for unity8
PS Jenkins bot (ps-jenkins) wrote : | # |
Paweł Stołowski (stolowski) wrote : | # |
Thanks for that Jim! There is one problem though, it throws early in Context constructor, because there is no package name set for unity8-dash:
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
terminate called after throwing an instance of 'std::logic_error'
what(): apparmor:
If this is because unity8-dash doesn't come from a click package, then I think the ctor of Context also needs an exception for unity8-dash (making unity8-dash a .click is not in our plans).
Please let me know if there is any other way for me to make this constraint happy on my side.
- 171. By Jim Hodapp
-
Add an exception for unity to not require a package_name since it will not have one
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:171
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Paweł Stołowski (stolowski) wrote : | # |
Yep, that helped, thanks!
Paweł Stołowski (stolowski) wrote : | # |
Hi Jim, I think there is one more case - I'm getting this when pressing play button from the confined Dash:
Adding track file://
Failed to add track ' "file:/
- 172. By Jim Hodapp
-
Add debugging output
Jim Hodapp (jhodapp) wrote : | # |
@Pawel: try rebuilding and get me a clean media-hub.log. I added a couple of debug statements that I want to see the output for since I should already have a working exception (but obviously isn't).
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:172
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Paweł Stołowski (stolowski) wrote : | # |
Hi Jim, here you are:
virtual void core::ubuntu:
Updating MPRIS TrackList properties; Tracks: 0, has_previous: false, has_next: false
*** void core::ubuntu:
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
Warning: Not adding track file://
void core::ubuntu:
Current player state is already stopped - no need to change state to stopped
virtual void core::ubuntu:
Updating MPRIS TrackList properties; Tracks: 0, has_previous: false, has_next: false
*** void core::ubuntu:
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
Warning: Not adding track file://
void core::ubuntu:
Current player state is already stopped - no need to change state to stopped
virtual void core::ubuntu:
Updating MPRIS TrackList properties; Tracks: 0, has_previous: false, has_next: false
*** void core::ubuntu:
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
Warning: Not adding track file://
Paweł Stołowski (stolowski) wrote : | # |
Ok, this one has the debug you added:
Session created by request of: :1.121, key: 2, uuid: 2533cb52-
audio_sink: pulsesink
video_sink: mirsink
Audio stream role: props,media.
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
operator()():149 -- app_name=
void core::ubuntu:
bool gstreamer:
Setting state for parent: 0xabe37254
virtual bool gstreamer:
Emiting playback_
virtual void core::ubuntu:
Updating MPRIS TrackList properties; Tracks: 0, has_previous: false, has_next: false
virtual void core::ubuntu:
Updating MPRIS TrackList properties; Tracks: 0, has_previous: false, has_next: false
*** void core::ubuntu:
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
context.
parsed_uri.path: /home/phablet/
Warning: Not adding track file://
void core::ubuntu:
Current player state is already stopped - no need to change state to stopped
virtual void core::ubuntu:
Updating MPRIS TrackList properties; Tracks: 0, has_previous: false, has_next: false
*** void core::ubuntu:
apparmor profile name: unity8-dash, is_unconfined(): false, has_package_name(): false
context.
parsed_uri.path: /home/phablet/
Warning: Not adding track file://
- 173. By Jim Hodapp
-
Add unity8 exception for calculating the profile_name
Jim Hodapp (jhodapp) wrote : | # |
I uploaded what should be a fix (untested). Please go ahead and build in your silo and give it a try.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:173
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Paweł Stołowski (stolowski) wrote : | # |
> I uploaded what should be a fix (untested). Please go ahead and build in your
> silo and give it a try.
Yeah, playback works now, thanks!
Jim Hodapp (jhodapp) wrote : | # |
No problem, glad it's working now! I'll have Alfonso do a quick code review so that we can get this landed when you're ready with your silo.
- 174. By Jim Hodapp
-
Use the const unity_name everywhere
Paweł Stołowski (stolowski) wrote : | # |
+1 from me, feel free to land it, thanks!
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:174
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote : | # |
LGTM
- 175. By Jim Hodapp
-
Merged with trunk
Preview Diff
1 | === modified file 'src/core/media/apparmor/ubuntu.cpp' |
2 | --- src/core/media/apparmor/ubuntu.cpp 2016-01-15 15:44:04 +0000 |
3 | +++ src/core/media/apparmor/ubuntu.cpp 2016-02-23 16:29:54 +0000 |
4 | @@ -72,6 +72,7 @@ |
5 | |
6 | static constexpr std::size_t index_package{1}; |
7 | static constexpr std::size_t index_app{2}; |
8 | +static const std::string unity_name{"unity8-dash"}; |
9 | |
10 | // Returns true if the context name is a valid Ubuntu app id. |
11 | // If it is, out is populated with the package and app name. |
12 | @@ -83,7 +84,7 @@ |
13 | static const std::regex full_re{"(.*)_(.*)_(.*)"}; |
14 | static const std::regex trust_store_re{"(.*)-(.*)"}; |
15 | |
16 | - if (s == "messaging-app" |
17 | + if ((s == "messaging-app" or s == unity_name) |
18 | and std::regex_match(s, out, trust_store_re)) |
19 | { |
20 | pkg_name = s; |
21 | @@ -103,15 +104,17 @@ |
22 | apparmor::ubuntu::Context::Context(const std::string& name) |
23 | : apparmor::Context{name}, |
24 | unconfined_{str() == ubuntu::unconfined}, |
25 | + unity_{name == unity_name}, |
26 | has_package_name_{process_context_name(str(), match_, pkg_name_)} |
27 | { |
28 | std::cout << "apparmor profile name: " << name; |
29 | std::cout << ", is_unconfined(): " << is_unconfined(); |
30 | std::cout << ", has_package_name(): " << has_package_name() << std::endl; |
31 | - if (not is_unconfined() && not has_package_name()) throw std::logic_error |
32 | - { |
33 | - "apparmor::ubuntu::Context: Invalid profile name " + str() |
34 | - }; |
35 | + if (not is_unconfined() and not is_unity() and not has_package_name()) |
36 | + throw std::logic_error |
37 | + { |
38 | + "apparmor::ubuntu::Context: Invalid profile name " + str() |
39 | + }; |
40 | } |
41 | |
42 | bool apparmor::ubuntu::Context::is_unconfined() const |
43 | @@ -119,6 +122,11 @@ |
44 | return unconfined_; |
45 | } |
46 | |
47 | +bool apparmor::ubuntu::Context::is_unity() const |
48 | +{ |
49 | + return unity_; |
50 | +} |
51 | + |
52 | bool apparmor::ubuntu::Context::has_package_name() const |
53 | { |
54 | return has_package_name_; |
55 | @@ -155,6 +163,9 @@ |
56 | |
57 | Uri parsed_uri = parse_uri(uri); |
58 | |
59 | + std::cout << "context.profile_name(): " << context.profile_name() << std::endl; |
60 | + std::cout << "parsed_uri.path: " << parsed_uri.path << std::endl; |
61 | + |
62 | // All confined apps can access their own files |
63 | if (parsed_uri.path.find(std::string(".local/share/" + context.package_name() + "/")) != std::string::npos || |
64 | parsed_uri.path.find(std::string(".cache/" + context.package_name() + "/")) != std::string::npos) |
65 | @@ -194,7 +205,8 @@ |
66 | // Check in ~/Music and ~/Videos |
67 | // TODO: when the trust store lands, check it to see if this app can access the dirs and |
68 | // then remove the explicit whitelist of the music-app, and gallery-app |
69 | - else if ((context.package_name() == "com.ubuntu.music" || context.package_name() == "com.ubuntu.gallery") && |
70 | + else if ((context.package_name() == "com.ubuntu.music" || context.package_name() == "com.ubuntu.gallery" || |
71 | + context.profile_name() == unity_name) && |
72 | (parsed_uri.path.find(std::string("Music/")) != std::string::npos || |
73 | parsed_uri.path.find(std::string("Videos/")) != std::string::npos || |
74 | parsed_uri.path.find(std::string("/media")) != std::string::npos)) |
75 | |
76 | === modified file 'src/core/media/apparmor/ubuntu.h' |
77 | --- src/core/media/apparmor/ubuntu.h 2016-01-15 15:44:04 +0000 |
78 | +++ src/core/media/apparmor/ubuntu.h 2016-02-23 16:29:54 +0000 |
79 | @@ -67,6 +67,9 @@ |
80 | // Returns true iff the context is unconfined. |
81 | virtual bool is_unconfined() const; |
82 | |
83 | + // Returns true iff the context matches Unity. |
84 | + virtual bool is_unity() const; |
85 | + |
86 | // Returns true iff the context contains a package name. |
87 | virtual bool has_package_name() const; |
88 | |
89 | @@ -79,6 +82,7 @@ |
90 | std::smatch match_; |
91 | std::string pkg_name_; |
92 | const bool unconfined_; |
93 | + const bool unity_; |
94 | const bool has_package_name_; |
95 | }; |
96 |
PASSED: Continuous integration, rev:170 jenkins. qa.ubuntu. com/job/ media-hub- ci/392/ jenkins. qa.ubuntu. com/job/ media-hub- vivid-amd64- ci/232 jenkins. qa.ubuntu. com/job/ media-hub- vivid-armhf- ci/232 jenkins. qa.ubuntu. com/job/ media-hub- vivid-armhf- ci/232/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ media-hub- vivid-i386- ci/232
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/media- hub-ci/ 392/rebuild
http://