[arch-commits] Commit in keybase/repos (6 files)

Felix Yan fyan at archlinux.org
Wed Jun 1 02:37:20 UTC 2016


    Date: Wednesday, June 1, 2016 @ 04:37:20
  Author: fyan
Revision: 177582

archrelease: copy trunk to community-i686, community-x86_64

Added:
  keybase/repos/community-i686/PKGBUILD
    (from rev 177581, keybase/trunk/PKGBUILD)
  keybase/repos/community-i686/gccgo.patch
    (from rev 177581, keybase/trunk/gccgo.patch)
  keybase/repos/community-x86_64/PKGBUILD
    (from rev 177581, keybase/trunk/PKGBUILD)
  keybase/repos/community-x86_64/gccgo.patch
    (from rev 177581, keybase/trunk/gccgo.patch)
Deleted:
  keybase/repos/community-i686/PKGBUILD
  keybase/repos/community-x86_64/PKGBUILD

------------------------------+
 /PKGBUILD                    |   80 ++++++++++++++++++++++++
 community-i686/PKGBUILD      |   36 -----------
 community-i686/gccgo.patch   |  132 +++++++++++++++++++++++++++++++++++++++++
 community-x86_64/PKGBUILD    |   36 -----------
 community-x86_64/gccgo.patch |  132 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 344 insertions(+), 72 deletions(-)

Deleted: community-i686/PKGBUILD
===================================================================
--- community-i686/PKGBUILD	2016-06-01 02:36:52 UTC (rev 177581)
+++ community-i686/PKGBUILD	2016-06-01 02:37:20 UTC (rev 177582)
@@ -1,36 +0,0 @@
-# $Id$
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-# Contributor: Michael Hansen <zrax0111 gmail com>
-
-pkgname=keybase
-pkgdesc='CLI tool for GPG with keybase.io'
-pkgver=1.0.16
-_realver=1.0.16
-pkgrel=1
-arch=('i686' 'x86_64')
-url='http://keybase.io/'
-license=('BSD')
-depends=('gnupg')
-makedepends=('gcc-go' 'git' 'mercurial')
-source=("git+https://github.com/keybase/client.git#tag=v$_realver")
-sha256sums=('SKIP')
-
-prepare() {
-  cd client
-  mkdir -p .gopath/src
-  mv go/vendor/* .gopath/src/
-  mkdir -p .gopath/src/github.com/keybase
-  ln -sf "$PWD" .gopath/src/github.com/keybase/client
-  export GOPATH="$PWD/.gopath"
-}
-
-build() {
-  cd client/go/keybase
-  go build -a -tags production -gccgoflags "$CFLAGS $LDFLAGS" github.com/keybase/client/go/keybase
-}
-
-package() {
-  cd client
-  install -Dm755 go/keybase/keybase "$pkgdir"/usr/bin/keybase
-  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-}

Copied: keybase/repos/community-i686/PKGBUILD (from rev 177581, keybase/trunk/PKGBUILD)
===================================================================
--- community-i686/PKGBUILD	                        (rev 0)
+++ community-i686/PKGBUILD	2016-06-01 02:37:20 UTC (rev 177582)
@@ -0,0 +1,40 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Michael Hansen <zrax0111 gmail com>
+
+pkgname=keybase
+pkgdesc='CLI tool for GPG with keybase.io'
+pkgver=1.0.16
+_realver=1.0.16
+pkgrel=2
+arch=('i686' 'x86_64')
+url='http://keybase.io/'
+license=('BSD')
+depends=('gnupg')
+makedepends=('gcc-go' 'git' 'mercurial')
+source=("git+https://github.com/keybase/client.git#tag=v$_realver"
+        gccgo.patch)
+sha256sums=('SKIP'
+            '75ec94f85e665defd3e2560d31b498e982e9aaf787d6f6edf4b907217d20b8d1')
+
+prepare() {
+  cd client
+  patch -p1 -i ../gccgo.patch
+
+  mkdir -p .gopath/src
+  mv go/vendor/* .gopath/src/
+  mkdir -p .gopath/src/github.com/keybase
+  ln -sf "$PWD" .gopath/src/github.com/keybase/client
+  export GOPATH="$PWD/.gopath"
+}
+
+build() {
+  cd client/go/keybase
+  go build -a -tags production -gccgoflags "$CFLAGS $LDFLAGS" github.com/keybase/client/go/keybase
+}
+
+package() {
+  cd client
+  install -Dm755 go/keybase/keybase "$pkgdir"/usr/bin/keybase
+  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}

Copied: keybase/repos/community-i686/gccgo.patch (from rev 177581, keybase/trunk/gccgo.patch)
===================================================================
--- community-i686/gccgo.patch	                        (rev 0)
+++ community-i686/gccgo.patch	2016-06-01 02:37:20 UTC (rev 177582)
@@ -0,0 +1,132 @@
+From ca023e2d6f9192fd8e923f3113ae4a11cda8b53a Mon Sep 17 00:00:00 2001
+From: Jack O'Connor <oconnor663 at gmail.com>
+Date: Tue, 31 May 2016 15:27:18 -0400
+Subject: [PATCH] avoid undefined behavior in Go assignments
+
+The funky assignment that initialized p.Hash as part of the method on
+the RHS, invoked undefined behavior in the Go compiler, and ended up
+crashing when we built with gcc-go. There was a lot of dirty code there
+anyway, so this diff just goes ahead and rewrites that whole bit.
+---
+ go/libkb/kbpackets.go | 49 +++++++++++++++++++++++++++++--------------------
+ go/libkb/naclwrap.go  | 14 ++------------
+ go/libkb/skb.go       |  8 +-------
+ 3 files changed, 32 insertions(+), 39 deletions(-)
+
+diff --git a/go/libkb/kbpackets.go b/go/libkb/kbpackets.go
+index df553ed..2cc81ee 100644
+--- a/go/libkb/kbpackets.go
++++ b/go/libkb/kbpackets.go
+@@ -49,32 +49,41 @@ type KeybasePacket struct {
+ 
+ type KeybasePackets []*KeybasePacket
+ 
+-func (p *KeybasePacket) hashToBytes() (ret []byte, err error) {
+-	zb := [0]byte{}
+-	if p.Hash == nil {
+-		p.Hash = &KeybasePacketHash{}
++func NewKeybasePacket(body interface{}, tag int, version int) (*KeybasePacket, error) {
++	ret := KeybasePacket{
++		Body:    body,
++		Tag:     tag,
++		Version: version,
+ 	}
+-	tmp := p.Hash.Value
+-	defer func() {
+-		p.Hash.Value = tmp
+-	}()
+-	p.Hash.Value = zb[:]
+-	p.Hash.Type = SHA256Code
+ 
+-	var encoded []byte
+-	if encoded, err = p.Encode(); err != nil {
+-		return
++	hashBytes, hashErr := ret.hashToBytes()
++	if hashErr != nil {
++		return nil, hashErr
+ 	}
+-
+-	sum := sha256.Sum256(encoded)
+-	ret = sum[:]
+-	return
++	ret.Hash = &KeybasePacketHash{
++		Type:  SHA256Code,
++		Value: hashBytes,
++	}
++	return &ret, nil
+ }
+ 
+-func (p *KeybasePacket) HashMe() error {
++func (p *KeybasePacket) hashToBytes() ([]byte, error) {
++	// We don't include the Hash field in the encoded bytes that we hash,
++	// because if we did then the result wouldn't be stable. To work around
++	// that, we make a copy of the packet and overwrite the Hash field with
++	// an empty slice.
++	packetCopy := *p
++	packetCopy.Hash = &KeybasePacketHash{
++		Type:  SHA256Code,
++		Value: []byte{},
++	}
++	var encoded []byte
+ 	var err error
+-	p.Hash.Value, err = p.hashToBytes()
+-	return err
++	if encoded, err = packetCopy.Encode(); err != nil {
++		return nil, err
++	}
++	ret := sha256.Sum256(encoded)
++	return ret[:], nil
+ }
+ 
+ func (p *KeybasePacket) checkHash() error {
+diff --git a/go/libkb/naclwrap.go b/go/libkb/naclwrap.go
+index 61dd69b..9a9a19d 100644
+--- a/go/libkb/naclwrap.go
++++ b/go/libkb/naclwrap.go
+@@ -390,12 +390,7 @@ func (k NaclDHKeyPair) VerifyString(sig string, msg []byte) (id keybase1.SigID,
+ }
+ 
+ func (s *NaclSigInfo) ToPacket() (ret *KeybasePacket, err error) {
+-	ret = &KeybasePacket{
+-		Version: KeybasePacketV1,
+-		Tag:     TagSignature,
+-	}
+-	ret.Body = s
+-	return
++	return NewKeybasePacket(s, TagSignature, KeybasePacketV1)
+ }
+ 
+ func (p KeybasePacket) ToNaclSigInfo() (*NaclSigInfo, error) {
+@@ -647,12 +642,7 @@ func (k NaclDHKeyPair) EncryptToString(plaintext []byte, sender GenericKey) (str
+ 
+ // ToPacket implements the Packetable interface.
+ func (k *NaclEncryptionInfo) ToPacket() (ret *KeybasePacket, err error) {
+-	ret = &KeybasePacket{
+-		Version: KeybasePacketV1,
+-		Tag:     TagEncryption,
+-	}
+-	ret.Body = k
+-	return
++	return NewKeybasePacket(k, TagEncryption, KeybasePacketV1)
+ }
+ 
+ // DecryptFromString decrypts the output of EncryptToString above,
+diff --git a/go/libkb/skb.go b/go/libkb/skb.go
+index 55475d9..52d3430 100644
+--- a/go/libkb/skb.go
++++ b/go/libkb/skb.go
+@@ -171,13 +171,7 @@ func (s *SKB) newLKSec(pps *PassphraseStream) *LKSec {
+ }
+ 
+ func (s *SKB) ToPacket() (ret *KeybasePacket, err error) {
+-	ret = &KeybasePacket{
+-		Version: KeybasePacketV1,
+-		Tag:     TagP3skb,
+-	}
+-	ret.Body = s
+-	err = ret.HashMe()
+-	return
++	return NewKeybasePacket(s, TagP3skb, KeybasePacketV1)
+ }
+ 
+ func (s *SKB) ReadKey() (g GenericKey, err error) {

Deleted: community-x86_64/PKGBUILD
===================================================================
--- community-x86_64/PKGBUILD	2016-06-01 02:36:52 UTC (rev 177581)
+++ community-x86_64/PKGBUILD	2016-06-01 02:37:20 UTC (rev 177582)
@@ -1,36 +0,0 @@
-# $Id$
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-# Contributor: Michael Hansen <zrax0111 gmail com>
-
-pkgname=keybase
-pkgdesc='CLI tool for GPG with keybase.io'
-pkgver=1.0.16
-_realver=1.0.16
-pkgrel=1
-arch=('i686' 'x86_64')
-url='http://keybase.io/'
-license=('BSD')
-depends=('gnupg')
-makedepends=('gcc-go' 'git' 'mercurial')
-source=("git+https://github.com/keybase/client.git#tag=v$_realver")
-sha256sums=('SKIP')
-
-prepare() {
-  cd client
-  mkdir -p .gopath/src
-  mv go/vendor/* .gopath/src/
-  mkdir -p .gopath/src/github.com/keybase
-  ln -sf "$PWD" .gopath/src/github.com/keybase/client
-  export GOPATH="$PWD/.gopath"
-}
-
-build() {
-  cd client/go/keybase
-  go build -a -tags production -gccgoflags "$CFLAGS $LDFLAGS" github.com/keybase/client/go/keybase
-}
-
-package() {
-  cd client
-  install -Dm755 go/keybase/keybase "$pkgdir"/usr/bin/keybase
-  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-}

Copied: keybase/repos/community-x86_64/PKGBUILD (from rev 177581, keybase/trunk/PKGBUILD)
===================================================================
--- community-x86_64/PKGBUILD	                        (rev 0)
+++ community-x86_64/PKGBUILD	2016-06-01 02:37:20 UTC (rev 177582)
@@ -0,0 +1,40 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Michael Hansen <zrax0111 gmail com>
+
+pkgname=keybase
+pkgdesc='CLI tool for GPG with keybase.io'
+pkgver=1.0.16
+_realver=1.0.16
+pkgrel=2
+arch=('i686' 'x86_64')
+url='http://keybase.io/'
+license=('BSD')
+depends=('gnupg')
+makedepends=('gcc-go' 'git' 'mercurial')
+source=("git+https://github.com/keybase/client.git#tag=v$_realver"
+        gccgo.patch)
+sha256sums=('SKIP'
+            '75ec94f85e665defd3e2560d31b498e982e9aaf787d6f6edf4b907217d20b8d1')
+
+prepare() {
+  cd client
+  patch -p1 -i ../gccgo.patch
+
+  mkdir -p .gopath/src
+  mv go/vendor/* .gopath/src/
+  mkdir -p .gopath/src/github.com/keybase
+  ln -sf "$PWD" .gopath/src/github.com/keybase/client
+  export GOPATH="$PWD/.gopath"
+}
+
+build() {
+  cd client/go/keybase
+  go build -a -tags production -gccgoflags "$CFLAGS $LDFLAGS" github.com/keybase/client/go/keybase
+}
+
+package() {
+  cd client
+  install -Dm755 go/keybase/keybase "$pkgdir"/usr/bin/keybase
+  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}

Copied: keybase/repos/community-x86_64/gccgo.patch (from rev 177581, keybase/trunk/gccgo.patch)
===================================================================
--- community-x86_64/gccgo.patch	                        (rev 0)
+++ community-x86_64/gccgo.patch	2016-06-01 02:37:20 UTC (rev 177582)
@@ -0,0 +1,132 @@
+From ca023e2d6f9192fd8e923f3113ae4a11cda8b53a Mon Sep 17 00:00:00 2001
+From: Jack O'Connor <oconnor663 at gmail.com>
+Date: Tue, 31 May 2016 15:27:18 -0400
+Subject: [PATCH] avoid undefined behavior in Go assignments
+
+The funky assignment that initialized p.Hash as part of the method on
+the RHS, invoked undefined behavior in the Go compiler, and ended up
+crashing when we built with gcc-go. There was a lot of dirty code there
+anyway, so this diff just goes ahead and rewrites that whole bit.
+---
+ go/libkb/kbpackets.go | 49 +++++++++++++++++++++++++++++--------------------
+ go/libkb/naclwrap.go  | 14 ++------------
+ go/libkb/skb.go       |  8 +-------
+ 3 files changed, 32 insertions(+), 39 deletions(-)
+
+diff --git a/go/libkb/kbpackets.go b/go/libkb/kbpackets.go
+index df553ed..2cc81ee 100644
+--- a/go/libkb/kbpackets.go
++++ b/go/libkb/kbpackets.go
+@@ -49,32 +49,41 @@ type KeybasePacket struct {
+ 
+ type KeybasePackets []*KeybasePacket
+ 
+-func (p *KeybasePacket) hashToBytes() (ret []byte, err error) {
+-	zb := [0]byte{}
+-	if p.Hash == nil {
+-		p.Hash = &KeybasePacketHash{}
++func NewKeybasePacket(body interface{}, tag int, version int) (*KeybasePacket, error) {
++	ret := KeybasePacket{
++		Body:    body,
++		Tag:     tag,
++		Version: version,
+ 	}
+-	tmp := p.Hash.Value
+-	defer func() {
+-		p.Hash.Value = tmp
+-	}()
+-	p.Hash.Value = zb[:]
+-	p.Hash.Type = SHA256Code
+ 
+-	var encoded []byte
+-	if encoded, err = p.Encode(); err != nil {
+-		return
++	hashBytes, hashErr := ret.hashToBytes()
++	if hashErr != nil {
++		return nil, hashErr
+ 	}
+-
+-	sum := sha256.Sum256(encoded)
+-	ret = sum[:]
+-	return
++	ret.Hash = &KeybasePacketHash{
++		Type:  SHA256Code,
++		Value: hashBytes,
++	}
++	return &ret, nil
+ }
+ 
+-func (p *KeybasePacket) HashMe() error {
++func (p *KeybasePacket) hashToBytes() ([]byte, error) {
++	// We don't include the Hash field in the encoded bytes that we hash,
++	// because if we did then the result wouldn't be stable. To work around
++	// that, we make a copy of the packet and overwrite the Hash field with
++	// an empty slice.
++	packetCopy := *p
++	packetCopy.Hash = &KeybasePacketHash{
++		Type:  SHA256Code,
++		Value: []byte{},
++	}
++	var encoded []byte
+ 	var err error
+-	p.Hash.Value, err = p.hashToBytes()
+-	return err
++	if encoded, err = packetCopy.Encode(); err != nil {
++		return nil, err
++	}
++	ret := sha256.Sum256(encoded)
++	return ret[:], nil
+ }
+ 
+ func (p *KeybasePacket) checkHash() error {
+diff --git a/go/libkb/naclwrap.go b/go/libkb/naclwrap.go
+index 61dd69b..9a9a19d 100644
+--- a/go/libkb/naclwrap.go
++++ b/go/libkb/naclwrap.go
+@@ -390,12 +390,7 @@ func (k NaclDHKeyPair) VerifyString(sig string, msg []byte) (id keybase1.SigID,
+ }
+ 
+ func (s *NaclSigInfo) ToPacket() (ret *KeybasePacket, err error) {
+-	ret = &KeybasePacket{
+-		Version: KeybasePacketV1,
+-		Tag:     TagSignature,
+-	}
+-	ret.Body = s
+-	return
++	return NewKeybasePacket(s, TagSignature, KeybasePacketV1)
+ }
+ 
+ func (p KeybasePacket) ToNaclSigInfo() (*NaclSigInfo, error) {
+@@ -647,12 +642,7 @@ func (k NaclDHKeyPair) EncryptToString(plaintext []byte, sender GenericKey) (str
+ 
+ // ToPacket implements the Packetable interface.
+ func (k *NaclEncryptionInfo) ToPacket() (ret *KeybasePacket, err error) {
+-	ret = &KeybasePacket{
+-		Version: KeybasePacketV1,
+-		Tag:     TagEncryption,
+-	}
+-	ret.Body = k
+-	return
++	return NewKeybasePacket(k, TagEncryption, KeybasePacketV1)
+ }
+ 
+ // DecryptFromString decrypts the output of EncryptToString above,
+diff --git a/go/libkb/skb.go b/go/libkb/skb.go
+index 55475d9..52d3430 100644
+--- a/go/libkb/skb.go
++++ b/go/libkb/skb.go
+@@ -171,13 +171,7 @@ func (s *SKB) newLKSec(pps *PassphraseStream) *LKSec {
+ }
+ 
+ func (s *SKB) ToPacket() (ret *KeybasePacket, err error) {
+-	ret = &KeybasePacket{
+-		Version: KeybasePacketV1,
+-		Tag:     TagP3skb,
+-	}
+-	ret.Body = s
+-	err = ret.HashMe()
+-	return
++	return NewKeybasePacket(s, TagP3skb, KeybasePacketV1)
+ }
+ 
+ func (s *SKB) ReadKey() (g GenericKey, err error) {



More information about the arch-commits mailing list