Merge lp:~mvo/snappy/snappy-clickpkg-snappypkg-meh into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Vogt
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 549
Merged at revision: 550
Proposed branch: lp:~mvo/snappy/snappy-clickpkg-snappypkg-meh
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 39 lines (+15/-3)
1 file modified
cmd/snappy/cmd_internal_unpack.go (+15/-3)
To merge this branch: bzr merge lp:~mvo/snappy/snappy-clickpkg-snappypkg-meh
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Review via email: mp+263681@code.launchpad.net

Commit message

Try both clickpkg and snappypkg when dropping privs.

Description of the change

Try both clickpkg and snappypkg when dropping privs.

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

it seems like it is going to work

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

once this lands we need to push it to wily and tools-proposed

works like a charm for building 15.04 and rolling.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/snappy/cmd_internal_unpack.go'
2--- cmd/snappy/cmd_internal_unpack.go 2015-06-26 12:56:53 +0000
3+++ cmd/snappy/cmd_internal_unpack.go 2015-07-02 16:02:25 +0000
4@@ -49,9 +49,11 @@
5 // }
6 import "C"
7
8-// for compat with the old snappy, once that is gone we can drop to a
9-// different user
10-const dropPrivsUser = "snappypkg"
11+// we keep supporting clickpkg for compat with older images
12+var dropPrivsUsers = []string{
13+ "snappypkg",
14+ "clickpkg",
15+}
16
17 type cmdInternalUnpack struct {
18 Positional struct {
19@@ -123,8 +125,18 @@
20 defer d.Close()
21
22 if helpers.ShouldDropPrivs() {
23+ var dropPrivsUser string
24
25+ // first find out what user to use
26 passFile := passwdFile(rootDir, "passwd")
27+ for _, dropPrivsUser = range dropPrivsUsers {
28+ _, err := readUID(dropPrivsUser, passFile)
29+ if err == nil {
30+ break
31+ }
32+ }
33+
34+ // then get uid/gid
35 uid, err := readUID(dropPrivsUser, passFile)
36 if err != nil {
37 return err
38
39=== renamed file 'cmd/snappy/cmd_low_level_unpack_test.go' => 'cmd/snappy/cmd_internal_unpack_test.go'

Subscribers

People subscribed via source and target branches