Merge lp:~sylvain-pineau/checkbox/fix-1382321 into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3460
Merged at revision: 3460
Proposed branch: lp:~sylvain-pineau/checkbox/fix-1382321
Merge into: lp:checkbox
Diff against target: 15 lines (+5/-0)
1 file modified
providers/plainbox-provider-checkbox/bin/pm_test (+5/-0)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/fix-1382321
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Sylvain Pineau (community) Needs Resubmitting
Review via email: mp+243510@code.launchpad.net

Description of the change

Fixes the linked bug where ~/.config/autostart was owned by root after pm tests.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1, nice, thanks

Could we please use providers:checkbox: as the leading commit tag though please?

3460. By Sylvain Pineau

providers:checkbox:bin:pm_test: Ensure that ~/.config/autostart is not owned by root

pm_test has to be run by the root user, by using pkexec or sudo.
Problem is that if ~/.config/autostart does not exists the script did make
it without chown it back to the normal user.

The fix just calls os.chown() on both .config and autostart with normal uid/gid

Fixes: https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1382321

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Fixed

review: Needs Resubmitting
Revision history for this message
Zygmunt Krynicki (zyga) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'providers/plainbox-provider-checkbox/bin/pm_test'
2--- providers/plainbox-provider-checkbox/bin/pm_test 2014-03-20 14:01:58 +0000
3+++ providers/plainbox-provider-checkbox/bin/pm_test 2014-12-03 11:33:06 +0000
4@@ -617,6 +617,11 @@
5 autostart_directory = os.path.join(config_directory, 'autostart')
6 if not os.path.exists(autostart_directory):
7 os.makedirs(autostart_directory)
8+ user_id = os.getenv('PKEXEC_UID') or os.getenv('SUDO_UID')
9+ group_id = os.getenv('PKEXEC_UID') or os.getenv('SUDO_GID')
10+ if user_id:
11+ os.chown(config_directory, int(user_id), int(group_id))
12+ os.chown(autostart_directory, int(user_id), int(group_id))
13
14 basename = '{0}.desktop'.format(os.path.basename(__file__))
15 self.desktop_filename = os.path.join(autostart_directory,

Subscribers

People subscribed via source and target branches