mirror of
https://github.com/hanzoai/s3.git
synced 2026-11-03 03:07:41 +00:00
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.
- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
"Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
(replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
keep their upstream import paths with zero churn. Internal identifiers and
import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
help/usage/flag strings, shell autocomplete program name, and the product name
in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
(e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
`cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
updated to ignore the `s3` build output.
63 lines
2.0 KiB
Go
63 lines
2.0 KiB
Go
//go:build !freebsd
|
|
|
|
package mount
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/seaweedfs/go-fuse/v2/fuse"
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
|
)
|
|
|
|
// TestSetXAttrCopiesValueBuffer reproduces the bug from
|
|
// https://github.com/seaweedfs/seaweedfs/discussions/9275 where `cp -a`
|
|
// of a file with an extended attribute leaves the destination with a
|
|
// corrupted value. The root cause is that go-fuse hands SetXAttr a
|
|
// `data` slice that aliases the per-request input buffer; when the
|
|
// buffer is returned to the pool and reused for another FUSE request,
|
|
// any reference still held by entry.Extended sees garbage.
|
|
//
|
|
// The bug only manifested when the file was open during setxattr (the
|
|
// open-fh path defers persistence to flush). We simulate that by
|
|
// mutating the caller-supplied buffer after SetXAttr returns.
|
|
func TestSetXAttrCopiesValueBuffer(t *testing.T) {
|
|
wfs := newCopyRangeTestWFS()
|
|
|
|
path := util.FullPath("/aaa.txt")
|
|
inode := wfs.inodeToPath.Lookup(path, 1, false, false, 0, true)
|
|
fh := wfs.fhMap.AcquireFileHandle(wfs, inode, &filer_pb.Entry{
|
|
Name: "aaa.txt",
|
|
Attributes: &filer_pb.FuseAttributes{
|
|
FileMode: 0100644,
|
|
Inode: inode,
|
|
},
|
|
})
|
|
fh.RememberPath(path)
|
|
|
|
// Caller buffer aliases a pool that the kernel will overwrite on
|
|
// the very next request. SetXAttr must defensively copy.
|
|
buf := []byte("test,in")
|
|
status := wfs.SetXAttr(make(chan struct{}), &fuse.SetXAttrIn{
|
|
InHeader: fuse.InHeader{NodeId: inode},
|
|
}, "user.xtags", buf)
|
|
if status != fuse.OK {
|
|
t.Fatalf("SetXAttr status = %v, want OK", status)
|
|
}
|
|
|
|
// Simulate the request buffer being recycled and reused for an
|
|
// unrelated payload.
|
|
for i := range buf {
|
|
buf[i] = 0xff
|
|
}
|
|
|
|
dest := make([]byte, 64)
|
|
n, status := wfs.GetXAttr(make(chan struct{}), &fuse.InHeader{NodeId: inode}, "user.xtags", dest)
|
|
if status != fuse.OK {
|
|
t.Fatalf("GetXAttr status = %v, want OK", status)
|
|
}
|
|
if got := string(dest[:n]); got != "test,in" {
|
|
t.Fatalf("GetXAttr value = %q, want %q (buffer aliasing leaked into stored xattr)", got, "test,in")
|
|
}
|
|
}
|