Ubuntu Pastebin

Paste from mwhudson at Thu, 10 Aug 2017 22:22:42 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 snapd (2.27-1~test) UNRELEASED; urgency=medium
 .
   * Just testing.
Author: Michael Hudson-Doyle <michael.hudson@ubuntu.com>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- snapd-2.27.orig/cmd/snap-confine/snap-confine.apparmor.in
+++ snapd-2.27/cmd/snap-confine/snap-confine.apparmor.in
@@ -387,4 +387,9 @@
 
     # Allow snap-confine to be killed
     signal (receive) peer=unconfined,
+
+    # Required when using unpatched upstream kernel
+    capability sys_ptrace,
+    # Debian compiles snap-confine without AppArmor, so allow running snaps unconfined
+    /usr/lib/snapd/snap-exec uxr,
 }
--- snapd-2.27.orig/cmd/snap-seccomp/export_test.go
+++ snapd-2.27/cmd/snap-seccomp/export_test.go
@@ -1,5 +1,7 @@
 // -*- Mode: Go; indent-tabs-mode: t -*-
 
+// +build ignore
+
 /*
  * Copyright (C) 2017 Canonical Ltd
  *
--- snapd-2.27.orig/cmd/snap-seccomp/main.go
+++ snapd-2.27/cmd/snap-seccomp/main.go
@@ -151,7 +151,7 @@ import (
 	// FIXME: we want github.com/seccomp/libseccomp-golang but that
 	// will not work with trusty because libseccomp-golang checks
 	// for the seccomp version and errors if it find one < 2.2.0
-	"github.com/mvo5/libseccomp-golang"
+	"github.com/seccomp/libseccomp-golang"
 
 	"github.com/snapcore/snapd/arch"
 	"github.com/snapcore/snapd/osutil"
--- snapd-2.27.orig/cmd/snap-seccomp/main_test.go
+++ snapd-2.27/cmd/snap-seccomp/main_test.go
@@ -1,5 +1,7 @@
 // -*- Mode: Go; indent-tabs-mode: t -*-
 
+// +build ignore
+
 /*
  * Copyright (C) 2017 Canonical Ltd
  *
@@ -33,7 +35,7 @@ import (
 
 	. "gopkg.in/check.v1"
 
-	"github.com/mvo5/libseccomp-golang"
+	"github.com/seccomp/libseccomp-golang"
 
 	// forked from "golang.org/x/net/bpf"
 	// until https://github.com/golang/go/issues/20556
--- snapd-2.27.orig/cmd/snap/cmd_interfaces_test.go
+++ snapd-2.27/cmd/snap/cmd_interfaces_test.go
@@ -62,7 +62,8 @@ Help Options:
       -i=                          Constrain listing to specific interfaces
 
 [interfaces command arguments]
-  <snap>:<slot or plug>:           Constrain listing to a specific snap or snap:name
+  <snap>:<slot or plug>:           Constrain listing to a specific snap or
+                                   snap:name
 `
 	rest, err := Parser().ParseArgs([]string{"interfaces", "--help"})
 	c.Assert(err.Error(), Equals, msg)
--- snapd-2.27.orig/i18n/i18n.go
+++ snapd-2.27/i18n/i18n.go
@@ -21,86 +21,7 @@ package i18n
 
 //go:generate update-pot
 
-import (
-	"fmt"
-	"os"
-	"path/filepath"
-	"strings"
-
-	"github.com/ojii/gettext.go"
-
-	"github.com/snapcore/snapd/dirs"
-	"github.com/snapcore/snapd/osutil"
-)
-
-// TEXTDOMAIN is the message domain used by snappy; see dgettext(3)
-// for more information.
-var (
-	TEXTDOMAIN   = "snappy"
-	locale       gettext.Catalog
-	translations gettext.Translations
-)
-
-func init() {
-	bindTextDomain(TEXTDOMAIN, "/usr/share/locale")
-	setLocale("")
-}
-
-func langpackResolver(baseRoot string, locale string, domain string) string {
-	// first check for the real locale (e.g. de_DE)
-	// then try to simplify the locale (e.g. de_DE -> de)
-	locales := []string{locale, strings.SplitN(locale, "_", 2)[0]}
-	for _, locale := range locales {
-		r := filepath.Join(locale, "LC_MESSAGES", fmt.Sprintf("%s.mo", domain))
-
-		// look into the core snaps first for translations,
-		// then the main system
-		candidateDirs := []string{
-			filepath.Join(dirs.SnapMountDir, "/core/current/", baseRoot),
-			baseRoot,
-		}
-		for _, root := range candidateDirs {
-			// ubuntu uses /usr/lib/locale-langpack and patches the glibc gettext
-			// implementation
-			langpack := filepath.Join(root, "..", "locale-langpack", r)
-			if osutil.FileExists(langpack) {
-				return langpack
-			}
-
-			regular := filepath.Join(root, r)
-			if osutil.FileExists(regular) {
-				return regular
-			}
-		}
-	}
-
-	return ""
-}
-
-func bindTextDomain(domain, dir string) {
-	translations = gettext.NewTranslations(dir, domain, langpackResolver)
-}
-
-func setLocale(loc string) {
-	if loc == "" {
-		loc = os.Getenv("LC_MESSAGES")
-		if loc == "" {
-			loc = os.Getenv("LANG")
-		}
-	}
-	// de_DE.UTF-8, de_DE@euro all need to get simplified
-	loc = strings.Split(loc, "@")[0]
-	loc = strings.Split(loc, ".")[0]
-
-	locale = translations.Locale(loc)
-}
-
 // G is the shorthand for Gettext
 func G(msgid string) string {
-	return locale.Gettext(msgid)
-}
-
-// NG is the shorthand for NGettext
-func NG(msgid string, msgidPlural string, n uint32) string {
-	return locale.NGettext(msgid, msgidPlural, n)
+	return msgid
 }
--- snapd-2.27.orig/i18n/i18n_test.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// -*- Mode: Go; indent-tabs-mode: t -*-
-
-/*
- * Copyright (C) 2014-2015 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package i18n
-
-import (
-	"io/ioutil"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"testing"
-
-	. "gopkg.in/check.v1"
-
-	"github.com/snapcore/snapd/dirs"
-)
-
-// Hook up check.v1 into the "go test" runner
-func Test(t *testing.T) { TestingT(t) }
-
-var mockLocalePo = []byte(`
-msgid ""
-msgstr ""
-"Project-Id-Version: snappy-test\n"
-"Report-Msgid-Bugs-To: snappy-devel@lists.ubuntu.com\n"
-"POT-Creation-Date: 2015-06-16 09:08+0200\n"
-"Language: en_DK\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;>\n"
-
-msgid "plural_1"
-msgid_plural "plural_2"
-msgstr[0] "translated plural_1"
-msgstr[1] "translated plural_2"
-
-msgid "singular"
-msgstr "translated singular"
-`)
-
-func makeMockTranslations(c *C, localeDir string) {
-	fullLocaleDir := filepath.Join(localeDir, "en_DK", "LC_MESSAGES")
-	err := os.MkdirAll(fullLocaleDir, 0755)
-	c.Assert(err, IsNil)
-
-	po := filepath.Join(fullLocaleDir, "snappy-test.po")
-	mo := filepath.Join(fullLocaleDir, "snappy-test.mo")
-	err = ioutil.WriteFile(po, mockLocalePo, 0644)
-	c.Assert(err, IsNil)
-
-	cmd := exec.Command("msgfmt", po, "--output-file", mo)
-	cmd.Stdout = os.Stdout
-	cmd.Stderr = os.Stderr
-	err = cmd.Run()
-	c.Assert(err, IsNil)
-}
-
-type i18nTestSuite struct {
-	origLang       string
-	origLcMessages string
-}
-
-var _ = Suite(&i18nTestSuite{})
-
-func (s *i18nTestSuite) SetUpTest(c *C) {
-	// this dir contains a special hand-crafted en_DK/snappy-test.mo
-	// file
-	localeDir := c.MkDir()
-	makeMockTranslations(c, localeDir)
-
-	// we use a custom test mo file
-	TEXTDOMAIN = "snappy-test"
-
-	s.origLang = os.Getenv("LANG")
-	s.origLcMessages = os.Getenv("LC_MESSAGES")
-
-	bindTextDomain("snappy-test", localeDir)
-	os.Setenv("LANG", "en_DK.UTF-8")
-	setLocale("")
-}
-
-func (s *i18nTestSuite) TearDownTest(c *C) {
-	os.Setenv("LANG", s.origLang)
-	os.Setenv("LC_MESSAGES", s.origLcMessages)
-}
-
-func (s *i18nTestSuite) TestTranslatedSingular(c *C) {
-	// no G() to avoid adding the test string to snappy-pot
-	var Gtest = G
-	c.Assert(Gtest("singular"), Equals, "translated singular")
-}
-
-func (s *i18nTestSuite) TestTranslatesPlural(c *C) {
-	// no NG() to avoid adding the test string to snappy-pot
-	var NGtest = NG
-	c.Assert(NGtest("plural_1", "plural_2", 1), Equals, "translated plural_1")
-}
-
-func (s *i18nTestSuite) TestTranslatedMissingLangNoCrash(c *C) {
-	setLocale("invalid")
-
-	// no G() to avoid adding the test string to snappy-pot
-	var Gtest = G
-	c.Assert(Gtest("singular"), Equals, "singular")
-}
-
-func (s *i18nTestSuite) TestInvalidTextDomainDir(c *C) {
-	bindTextDomain("snappy-test", "/random/not/existing/dir")
-	setLocale("invalid")
-
-	// no G() to avoid adding the test string to snappy-pot
-	var Gtest = G
-	c.Assert(Gtest("singular"), Equals, "singular")
-}
-
-func (s *i18nTestSuite) TestLangpackResolverFromLangpack(c *C) {
-	root := c.MkDir()
-	localeDir := filepath.Join(root, "/usr/share/locale")
-	err := os.MkdirAll(localeDir, 0755)
-	c.Assert(err, IsNil)
-
-	d := filepath.Join(root, "/usr/share/locale-langpack")
-	makeMockTranslations(c, d)
-	bindTextDomain("snappy-test", localeDir)
-	setLocale("")
-
-	// no G() to avoid adding the test string to snappy-pot
-	var Gtest = G
-	c.Assert(Gtest("singular"), Equals, "translated singular", Commentf("test with %q failed", d))
-}
-
-func (s *i18nTestSuite) TestLangpackResolverFromCore(c *C) {
-	origSnapMountDir := dirs.SnapMountDir
-	defer func() { dirs.SnapMountDir = origSnapMountDir }()
-	dirs.SnapMountDir = c.MkDir()
-
-	d := filepath.Join(dirs.SnapMountDir, "/core/current/usr/share/locale")
-	makeMockTranslations(c, d)
-	bindTextDomain("snappy-test", "/usr/share/locale")
-	setLocale("")
-
-	// no G() to avoid adding the test string to snappy-pot
-	var Gtest = G
-	c.Assert(Gtest("singular"), Equals, "translated singular", Commentf("test with %q failed", d))
-}
--- snapd-2.27.orig/progress/progress.go
+++ snapd-2.27/progress/progress.go
@@ -25,7 +25,7 @@ import (
 	"os"
 	"unicode"
 
-	"github.com/cheggaaa/pb"
+	"gopkg.in/cheggaaa/pb.v1"
 	"golang.org/x/crypto/ssh/terminal"
 )
 
--- snapd-2.27.orig/tests/main/i18n/task.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-summary: Test that i18n works
-
-execute: |
-    # The snapd deb from the archive does not contain .mo files, those
-    # are stripped out by the langpack buildd stuff and put into the
-    # the various langpacks.
-    # Therefore this test only makes sense when we build snapd from
-    # the local source. When running against an official snapd deb
-    # or against the core we will not see translations
-    if [ ! -f /usr/share/locale/de/LC_MESSAGES/snappy.mo ]; then
-        echo "SKIP: No mo files for snapd available"
-        exit 0
-    fi
-
-    echo "Ensure that i18n works"
-    LANG=de_DE.UTF-8 snap changes everything | MATCH "Ja, ja, allerdings."
Download as text