Commit ea6855a4 authored by Felix Lechner's avatar Felix Lechner

Delete patches accepted upstream

parent f12f33f7
Author: Felix Lechner <felix.lechner@lease-up.com>
Date: Sat Feb 3 04:42:49 2018 -0800
Subject: Fix assignment error in Unix2syscall
Origin: https://github.com/rfjakob/gocryptfs/commit/5b986288cf0139a612710de728e82192d1f63fa2
Bug-Vendor: https://github.com/rfjakob/gocryptfs/pull/203
Applied-Upstream: https://github.com/rfjakob/gocryptfs/commit/5b986288cf0139a612710de728e82192d1f63fa2
Fix assignment error in Unix2syscall by converting Timespec into Nsec (#203)
$ go.gcc build
# github.com/rfjakob/gocryptfs/internal/syscallcompat
internal/syscallcompat/unix2syscall_linux.go:32:13: error: incompatible types in assignment (cannot use type int64 as type syscall.Timespec_sec_t)
s.Atim.Sec = u.Atim.Sec
^
diff --git a/internal/syscallcompat/unix2syscall_linux.go b/internal/syscallcompat/unix2syscall_linux.go
index 3162025..87ac522 100644
--- a/internal/syscallcompat/unix2syscall_linux.go
+++ b/internal/syscallcompat/unix2syscall_linux.go
@@ -21,8 +21,8 @@ func Unix2syscall(u unix.Stat_t) syscall.Stat_t {
Size: u.Size,
Blksize: u.Blksize,
Blocks: u.Blocks,
- Atim: syscall.Timespec(u.Atim),
- Mtim: syscall.Timespec(u.Mtim),
- Ctim: syscall.Timespec(u.Ctim),
+ Atim: syscall.NsecToTimespec(unix.TimespecToNsec(u.Atim)),
+ Mtim: syscall.NsecToTimespec(unix.TimespecToNsec(u.Mtim)),
+ Ctim: syscall.NsecToTimespec(unix.TimespecToNsec(u.Ctim)),
}
}
Author: Jakob Unterwurzacher <jakobunt@gmail.com>
Date: Thu Jan 25 21:40:48 2018 +0100
Subject: Fix reversed warning output in syscallcompat
Bug-Vendor: https://github.com/rfjakob/gocryptfs/issues/197
Applied-Upstream: https://github.com/rfjakob/gocryptfs/commit/b31857
syscallcompat: fix reversed warning output
We used to print somewhat strange messages:
Getdents: corrupt entry #1: Reclen=276 > 280. Returning EBADR
Reported at https://github.com/rfjakob/gocryptfs/issues/197
--- a/internal/syscallcompat/getdents_linux.go
+++ b/internal/syscallcompat/getdents_linux.go
@@ -64,7 +64,7 @@ func Getdents(dir string) ([]fuse.DirEnt
}
if int(s.Reclen) > sizeofDirent {
tlog.Warn.Printf("Getdents: corrupt entry #%d: Reclen=%d > %d. Returning EBADR",
- numEntries, sizeofDirent, s.Reclen)
+ numEntries, s.Reclen, sizeofDirent)
return nil, syscall.EBADR
}
offset += int(s.Reclen)
Author: Jakob Unterwurzacher <jakobunt@gmail.com>
Date: Thu Jan 25 22:22:13 2018 +0100
Subject: Hardcode maxReclen = 280
Bug-Vendor: https://github.com/rfjakob/gocryptfs/issues/197
Applied-Upstream: https://github.com/rfjakob/gocryptfs/commit/f3838c09d841ebdb071981e190c7579e61ee057f
syscallcompat: hardcode maxReclen = 280 for all architectures
Due to padding between entries, it is 280 even on 32-bit architectures.
See https://github.com/rfjakob/gocryptfs/issues/197 for details.
diff --git a/internal/syscallcompat/getdents_linux.go b/internal/syscallcompat/getdents_linux.go
index aaa69ac..146517c 100644
--- a/internal/syscallcompat/getdents_linux.go
+++ b/internal/syscallcompat/getdents_linux.go
@@ -21,6 +21,11 @@ import (
const sizeofDirent = int(unsafe.Sizeof(syscall.Dirent{}))
+// maxReclen sanity check: Reclen should never be larger than this.
+// Due to padding between entries, it is 280 even on 32-bit architectures.
+// See https://github.com/rfjakob/gocryptfs/issues/197 for details.
+const maxReclen = 280
+
// getdents wraps syscall.Getdents and converts the result to []fuse.DirEntry.
func getdents(fd int) ([]fuse.DirEntry, error) {
// Collect syscall result in smartBuf.
@@ -53,9 +58,9 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
// EBADR = Invalid request descriptor
return nil, syscall.EBADR
}
- if int(s.Reclen) > sizeofDirent {
+ if int(s.Reclen) > maxReclen {
tlog.Warn.Printf("Getdents: corrupt entry #%d: Reclen=%d > %d. Returning EBADR",
- numEntries, s.Reclen, sizeofDirent)
+ numEntries, s.Reclen, maxReclen)
return nil, syscall.EBADR
}
offset += int(s.Reclen)
Author: Jakob Unterwurzacher <jakobunt@gmail.com>
Date: Wed Jan 31 18:59:10 2018 +0100
Subject: Switch from syscall.Getdents to unix.Getdents
Bug-Vendor: https://github.com/rfjakob/gocryptfs/issues/200
Applied-Upstream: https://github.com/rfjakob/gocryptfs/commit/26ba810
syscallcompat: switch from syscall.Getdents to unix.Getdents
On mips64le, syscall.Getdents() and struct syscall.Dirent do
not fit together, causing our Getdents implementation to
return garbage ( https://github.com/rfjakob/gocryptfs/issues/200
and https://github.com/golang/go/issues/23624 ).
Switch to unix.Getdents which does not have this problem -
the next Go release with the syscall package fixes is too
far away, and will take time to trickle into distros.
diff --git a/internal/syscallcompat/getdents_linux.go b/internal/syscallcompat/getdents_linux.go
index 146517c..1387023 100644
--- a/internal/syscallcompat/getdents_linux.go
+++ b/internal/syscallcompat/getdents_linux.go
@@ -19,14 +19,14 @@ import (
"github.com/rfjakob/gocryptfs/internal/tlog"
)
-const sizeofDirent = int(unsafe.Sizeof(syscall.Dirent{}))
+const sizeofDirent = int(unsafe.Sizeof(unix.Dirent{}))
// maxReclen sanity check: Reclen should never be larger than this.
// Due to padding between entries, it is 280 even on 32-bit architectures.
// See https://github.com/rfjakob/gocryptfs/issues/197 for details.
const maxReclen = 280
-// getdents wraps syscall.Getdents and converts the result to []fuse.DirEntry.
+// getdents wraps unix.Getdents and converts the result to []fuse.DirEntry.
func getdents(fd int) ([]fuse.DirEntry, error) {
// Collect syscall result in smartBuf.
// "bytes.Buffer" is smart about expanding the capacity and avoids the
@@ -34,7 +34,7 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
var smartBuf bytes.Buffer
tmp := make([]byte, 10000)
for {
- n, err := syscall.Getdents(fd, tmp)
+ n, err := unix.Getdents(fd, tmp)
if err != nil {
return nil, err
}
@@ -51,7 +51,7 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
// a fuse.DirEntry slice of the correct size at once.
var numEntries, offset int
for offset < len(buf) {
- s := *(*syscall.Dirent)(unsafe.Pointer(&buf[offset]))
+ s := *(*unix.Dirent)(unsafe.Pointer(&buf[offset]))
if s.Reclen == 0 {
tlog.Warn.Printf("Getdents: corrupt entry #%d: Reclen=0 at offset=%d. Returning EBADR",
numEntries, offset)
@@ -73,7 +73,7 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
entries := make([]fuse.DirEntry, 0, numEntries)
offset = 0
for offset < len(buf) {
- s := *(*syscall.Dirent)(unsafe.Pointer(&buf[offset]))
+ s := *(*unix.Dirent)(unsafe.Pointer(&buf[offset]))
name, err := getdentsName(s)
if err != nil {
return nil, err
@@ -100,7 +100,7 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
// getdentsName extracts the filename from a Dirent struct and returns it as
// a Go string.
-func getdentsName(s syscall.Dirent) (string, error) {
+func getdentsName(s unix.Dirent) (string, error) {
// After the loop, l contains the index of the first '\0'.
l := 0
for l = range s.Name {
Author: Jakob Unterwurzacher <jakobunt@gmail.com>
Date: Thu Feb 1 23:46:02 2018 +0100
Subject: Replace syscall.NAME_MAX with unix.NAME_MAX
Bug-Vendor: https://github.com/rfjakob/gocryptfs/issues/201
Applied-Upstream: https://github.com/rfjakob/gocryptfs/commit/9f8d0d8
gccgo: replace syscall.NAME_MAX with unix.NAME_MAX
For some reason the syscall.NAME_MAX constant does not exist
on gccgo, and it does not hurt us to use unix.NAME_MAX instead.
https://github.com/rfjakob/gocryptfs/issues/201
diff --git a/internal/fusefrontend_reverse/ctlsock_interface.go b/internal/fusefrontend_reverse/ctlsock_interface.go
index 5f61f37..c8ac379 100644
--- a/internal/fusefrontend_reverse/ctlsock_interface.go
+++ b/internal/fusefrontend_reverse/ctlsock_interface.go
@@ -3,7 +3,8 @@ package fusefrontend_reverse
import (
"path/filepath"
"strings"
- "syscall"
+
+ "golang.org/x/sys/unix"
"github.com/rfjakob/gocryptfs/internal/ctlsock"
"github.com/rfjakob/gocryptfs/internal/pathiv"
@@ -23,7 +24,7 @@ func (rfs *ReverseFS) EncryptPath(plainPath string) (string, error) {
for _, part := range parts {
dirIV := pathiv.Derive(cipherPath, pathiv.PurposeDirIV)
encryptedPart := rfs.nameTransform.EncryptName(part, dirIV)
- if rfs.args.LongNames && len(encryptedPart) > syscall.NAME_MAX {
+ if rfs.args.LongNames && len(encryptedPart) > unix.NAME_MAX {
encryptedPart = rfs.nameTransform.HashLongName(encryptedPart)
}
cipherPath = filepath.Join(cipherPath, encryptedPart)
diff --git a/internal/fusefrontend_reverse/reverse_longnames.go b/internal/fusefrontend_reverse/reverse_longnames.go
index 5ea7c0a..46f7399 100644
--- a/internal/fusefrontend_reverse/reverse_longnames.go
+++ b/internal/fusefrontend_reverse/reverse_longnames.go
@@ -7,6 +7,8 @@ import (
"syscall"
"time"
+ "golang.org/x/sys/unix"
+
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
@@ -80,7 +82,7 @@ func (rfs *ReverseFS) findLongnameParent(dir string, dirIV []byte, longname stri
continue
}
cName := rfs.nameTransform.EncryptName(plaintextName, dirIV)
- if len(cName) <= syscall.NAME_MAX {
+ if len(cName) <= unix.NAME_MAX {
// Entry should have been skipped by the "continue" above
log.Panic("logic error or wrong shortNameMax constant?")
}
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index f9dde19..1523c18 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -288,7 +288,7 @@ func (rfs *ReverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
cName = configfile.ConfDefaultName
} else {
cName = rfs.nameTransform.EncryptName(entries[i].Name, dirIV)
- if len(cName) > syscall.NAME_MAX {
+ if len(cName) > unix.NAME_MAX {
cName = rfs.nameTransform.HashLongName(cName)
dotNameFile := fuse.DirEntry{
Mode: virtualFileMode,
diff --git a/internal/nametransform/diriv.go b/internal/nametransform/diriv.go
index 527ccce..06f029e 100644
--- a/internal/nametransform/diriv.go
+++ b/internal/nametransform/diriv.go
@@ -9,6 +9,8 @@ import (
"strings"
"syscall"
+ "golang.org/x/sys/unix"
+
"github.com/rfjakob/gocryptfs/internal/cryptocore"
"github.com/rfjakob/gocryptfs/internal/syscallcompat"
"github.com/rfjakob/gocryptfs/internal/tlog"
@@ -111,7 +113,7 @@ func WriteDirIV(dirfd *os.File, dir string) error {
// too long.
func (be *NameTransform) encryptAndHashName(name string, iv []byte) string {
cName := be.EncryptName(name, iv)
- if be.longNames && len(cName) > syscall.NAME_MAX {
+ if be.longNames && len(cName) > unix.NAME_MAX {
return be.HashLongName(cName)
}
return cName
@@ -128,7 +130,7 @@ func (be *NameTransform) EncryptPathDirIV(plainPath string, rootDir string) (str
}
// Reject names longer than 255 bytes.
baseName := filepath.Base(plainPath)
- if len(baseName) > syscall.NAME_MAX {
+ if len(baseName) > unix.NAME_MAX {
return "", syscall.ENAMETOOLONG
}
// If we have the iv and the encrypted directory name in the cache, we
diff --git a/internal/syscallcompat/getdents_test.go b/internal/syscallcompat/getdents_test.go
index 131ffee..4b50575 100644
--- a/internal/syscallcompat/getdents_test.go
+++ b/internal/syscallcompat/getdents_test.go
@@ -9,6 +9,8 @@ import (
"syscall"
"testing"
+ "golang.org/x/sys/unix"
+
"github.com/hanwen/go-fuse/fuse"
)
@@ -28,7 +30,7 @@ func testGetdents(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- for i := 1; i <= syscall.NAME_MAX; i++ {
+ for i := 1; i <= unix.NAME_MAX; i++ {
n := strings.Repeat("x", i)
err = ioutil.WriteFile(testDir+"/"+n, nil, 0600)
if err != nil {
Description: Fix spelling
Author: Felix Lechner <felix.lechner@lease-up.com>
Forwarded: https://github.com/rfjakob/gocryptfs/pull/205/commits/efb9a325889e8b04a0716ec8eeb2868410ceb04c
Last-Update: 2018-02-03
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/internal/ctlsock/ctlsock_serve.go
+++ b/internal/ctlsock/ctlsock_serve.go
@@ -117,7 +117,7 @@ func (ch *ctlSockHandler) handleRequest(
var inPath, outPath, clean, warnText string
// You cannot perform both decryption and encryption in one request
if in.DecryptPath != "" && in.EncryptPath != "" {
- err = errors.New("Ambigous")
+ err = errors.New("Ambiguous")
sendResponse(conn, err, "", "")
return
}
--- a/main.go
+++ b/main.go
@@ -141,7 +141,7 @@ func main() {
}
if args.wpanic {
tlog.Warn.Wpanic = true
- tlog.Debug.Printf("Panicing on warnings")
+ tlog.Debug.Printf("Panicking on warnings")
}
// Every operation below requires CIPHERDIR. Exit if we don't have it.
if flagSet.NArg() == 0 {
001-convert-timespec-to-nsec.patch
002-fix-reversed-warning-output.patch
003-hardcode-maxreclen.patch
004-switch-from-syscall-getdents-to-unix-getdents.patch
005-replace-syscall-name_max-with-unix-name_max.patch
006-fix-spelling.patch
007-disable-emulated-getdents.patch
008-disable-getdents-test.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment