Merge lp:click into lp:~ubuntu-managed-branches/click/click

Proposed by Colin Watson
Status: Merged
Merged at revision: 343
Proposed branch: lp:click
Merge into: lp:~ubuntu-managed-branches/click/click
Diff against target: 92 lines (+47/-3)
4 files modified
click/tests/test_hooks.py (+24/-0)
debian/changelog (+16/-0)
lib/click/hooks.vala (+6/-2)
lib/click/user.vala (+1/-1)
To merge this branch: bzr merge lp:click
Reviewer Review Type Date Requested Status
Ubuntu CI managed package branches Pending
Review via email: mp+210579@code.launchpad.net

Commit message

Fix crash in "click hook run-user".

Description of the change

  * Make "click hook run-user" ensure that the user registration directory
    exists before dropping privileges and trying to create symlinks in it
    (LP: #1291192).

To post a comment you must log in.
lp:click updated
380. By Colin Watson

Avoid ensure_dbing multiple times.

381. By Colin Watson

releasing package click version 0.4.18.2

382. By Colin Watson

Take a slightly different approach to fixing "click hook run-user": only
try to update user registration symlinks if they already exist in the
overlay database.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click/tests/test_hooks.py'
2--- click/tests/test_hooks.py 2014-03-11 17:15:54 +0000
3+++ click/tests/test_hooks.py 2014-03-12 12:01:04 +0000
4@@ -833,6 +833,30 @@
5 os.readlink(path_2))
6 self.assertFalse(os.path.lexists(path_3))
7
8+ def test_sync_without_user_db(self):
9+ with self.run_in_subprocess(
10+ "click_get_hooks_dir", "click_get_user_home",
11+ ) as (enter, preloads):
12+ enter()
13+ preloads["click_get_user_home"].return_value = "/home/test-user"
14+ with mkfile(
15+ os.path.join(self.temp_dir, "hooks", "test.hook")) as f:
16+ print("User-Level: yes", file=f)
17+ print("Pattern: %s/${id}.test" % self.temp_dir, file=f)
18+ with mkfile(os.path.join(
19+ self.temp_dir, "test-package", "1.0", ".click", "info",
20+ "test-package.manifest")) as f:
21+ json.dump({"hooks": {"test-app": {"test": "target"}}}, f)
22+ all_users_db = Click.User.for_all_users(self.db)
23+ all_users_db.set_version("test-package", "1.0")
24+ self._setup_hooks_dir(
25+ preloads, hooks_dir=os.path.join(self.temp_dir, "hooks"))
26+ hook = Click.Hook.open(self.db, "test")
27+ hook.sync(user_name="test-user")
28+ self.assertFalse(os.path.exists(os.path.join(
29+ self.temp_dir, ".click", "users", "test-user",
30+ "test-package")))
31+
32 def test_sync_uses_deepest_copy(self):
33 # If the same version of a package is unpacked in multiple
34 # databases, then we make sure the user link points to the deepest
35
36=== modified file 'debian/changelog'
37--- debian/changelog 2014-03-11 17:22:10 +0000
38+++ debian/changelog 2014-03-12 12:01:04 +0000
39@@ -1,3 +1,19 @@
40+click (0.4.18.3) UNRELEASED; urgency=medium
41+
42+ * Take a slightly different approach to fixing "click hook run-user": only
43+ try to update user registration symlinks if they already exist in the
44+ overlay database.
45+
46+ -- Colin Watson <cjwatson@ubuntu.com> Wed, 12 Mar 2014 11:59:49 +0000
47+
48+click (0.4.18.2) trusty; urgency=medium
49+
50+ * Make "click hook run-user" ensure that the user registration directory
51+ exists before dropping privileges and trying to create symlinks in it
52+ (LP: #1291192).
53+
54+ -- Colin Watson <cjwatson@ubuntu.com> Wed, 12 Mar 2014 11:59:31 +0000
55+
56 click (0.4.18.1) trusty; urgency=medium
57
58 [ Colin Watson ]
59
60=== modified file 'lib/click/hooks.vala'
61--- lib/click/hooks.vala 2014-03-11 17:15:54 +0000
62+++ lib/click/hooks.vala 2014-03-12 12:01:04 +0000
63@@ -950,10 +950,14 @@
64 if (is_user_level) {
65 var user_db = new User.for_user
66 (db, user_name);
67+ var overlay_path = Path.build_filename
68+ (user_db.get_overlay_db (),
69+ package);
70 user_db.drop_privileges ();
71 try {
72- user_db.raw_set_version
73- (package, version);
74+ if (exists (overlay_path))
75+ user_db.raw_set_version
76+ (package, version);
77 install_link (package, version,
78 app_name,
79 app.relative_path,
80
81=== modified file 'lib/click/user.vala'
82--- lib/click/user.vala 2014-03-11 17:15:54 +0000
83+++ lib/click/user.vala 2014-03-12 12:01:04 +0000
84@@ -301,7 +301,7 @@
85 return db_for_user (db.overlay, name);
86 }
87
88- private void
89+ internal void
90 ensure_db () throws UserError
91 {
92 if (users == null)

Subscribers

People subscribed via source and target branches