Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ git_override(

git_override(
module_name = "com_github_buildbarn_bb_storage",
commit = "6002cad335378bbdcdda4225d47c7dc2c08a6d94",
commit = "6d689475d039c4ac5984f977066cb5249f6a9c6f",
remote = "https://github.com/buildbarn/bb-storage.git",
)

Expand Down
1 change: 1 addition & 0 deletions cmd/bb_noop_worker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ go_library(
"@com_github_buildbarn_bb_storage//pkg/global",
"@com_github_buildbarn_bb_storage//pkg/program",
"@com_github_buildbarn_bb_storage//pkg/util",
"@com_github_buildbarn_bb_storage//pkg/zstd",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
],
Expand Down
4 changes: 3 additions & 1 deletion cmd/bb_noop_worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/buildbarn/bb-storage/pkg/global"
"github.com/buildbarn/bb-storage/pkg/program"
"github.com/buildbarn/bb-storage/pkg/util"
bb_zstd "github.com/buildbarn/bb-storage/pkg/zstd"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -48,7 +49,8 @@ func main() {
configuration.ContentAddressableStorage,
blobstore_configuration.NewCASBlobAccessCreator(
grpcClientFactory,
int(configuration.MaximumMessageSizeBytes)))
int(configuration.MaximumMessageSizeBytes),
bb_zstd.NewPoolFromConfiguration(nil)))
if err != nil {
return util.StatusWrap(err, "Failed to create Content Adddressable Storage")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/bb_scheduler/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ go_library(
"@com_github_buildbarn_bb_storage//pkg/proto/iscc",
"@com_github_buildbarn_bb_storage//pkg/random",
"@com_github_buildbarn_bb_storage//pkg/util",
"@com_github_buildbarn_bb_storage//pkg/zstd",
"@com_github_google_uuid//:uuid",
"@com_github_gorilla_mux//:mux",
"@org_golang_google_grpc//:grpc",
Expand Down
4 changes: 3 additions & 1 deletion cmd/bb_scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/buildbarn/bb-storage/pkg/proto/iscc"
"github.com/buildbarn/bb-storage/pkg/random"
"github.com/buildbarn/bb-storage/pkg/util"
bb_zstd "github.com/buildbarn/bb-storage/pkg/zstd"
"github.com/google/uuid"
"github.com/gorilla/mux"

Expand Down Expand Up @@ -63,7 +64,8 @@ func main() {
configuration.ContentAddressableStorage,
blobstore_configuration.NewCASBlobAccessCreator(
grpcClientFactory,
int(configuration.MaximumMessageSizeBytes)))
int(configuration.MaximumMessageSizeBytes),
bb_zstd.NewPoolFromConfiguration(nil)))
if err != nil {
return util.StatusWrap(err, "Failed to create Content Adddressable Storage")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/bb_worker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ go_library(
"@com_github_buildbarn_bb_storage//pkg/program",
"@com_github_buildbarn_bb_storage//pkg/random",
"@com_github_buildbarn_bb_storage//pkg/util",
"@com_github_buildbarn_bb_storage//pkg/zstd",
"@com_github_google_uuid//:uuid",
"@io_opentelemetry_go_otel//:otel",
"@org_golang_google_grpc//codes",
Expand Down
4 changes: 3 additions & 1 deletion cmd/bb_worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/buildbarn/bb-storage/pkg/program"
"github.com/buildbarn/bb-storage/pkg/random"
"github.com/buildbarn/bb-storage/pkg/util"
bb_zstd "github.com/buildbarn/bb-storage/pkg/zstd"
"github.com/google/uuid"

"golang.org/x/sync/semaphore"
Expand Down Expand Up @@ -88,7 +89,8 @@ func main() {
dependenciesGroup,
configuration.Blobstore,
grpcClientFactory,
int(configuration.MaximumMessageSizeBytes))
int(configuration.MaximumMessageSizeBytes),
bb_zstd.NewPoolFromConfiguration(nil))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/bazelbuild/buildtools v0.0.0-20260211083412-859bfffeef82
github.com/bazelbuild/remote-apis v0.0.0-20260216160025-715b73f3f9e4
github.com/bazelbuild/rules_go v0.59.0
github.com/buildbarn/bb-storage v0.0.0-20260303071613-6002cad33537
github.com/buildbarn/bb-storage v0.0.0-20260316192935-6d689475d039
github.com/buildbarn/go-xdr v0.0.0-20240702182809-236788cf9e89
github.com/golang/protobuf v1.5.4
github.com/google/uuid v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ github.com/bazelbuild/rules_go v0.59.0/go.mod h1:Pn30cb4M513fe2rQ6GiJ3q8QyrRsgC7
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/buildbarn/bb-storage v0.0.0-20260303071613-6002cad33537 h1:81k5KiFlYyaQaheb5pe9p/nz4Ao8jGWcNK5LC9z+8vE=
github.com/buildbarn/bb-storage v0.0.0-20260303071613-6002cad33537/go.mod h1:96kqnkrdkHHi94Agje3NM8qwrYMxJRSkAqsb7oXRhNI=
github.com/buildbarn/bb-storage v0.0.0-20260316192935-6d689475d039 h1:vqWwW9H2R6ACSWkJisorYsSn9qsAbv9nbjqMM0BJhyI=
github.com/buildbarn/bb-storage v0.0.0-20260316192935-6d689475d039/go.mod h1:96kqnkrdkHHi94Agje3NM8qwrYMxJRSkAqsb7oXRhNI=
github.com/buildbarn/go-sha256tree v0.0.0-20250310211320-0f70f20e855b h1:IKUxixGBm9UxobU7c248z0BF0ojG19uoSLz8MFZM/KA=
github.com/buildbarn/go-sha256tree v0.0.0-20250310211320-0f70f20e855b/go.mod h1:e7g3/yWApcg+PpDqd4eQEEV8pexQmfCgK3frP+1Wuvk=
github.com/buildbarn/go-xdr v0.0.0-20240702182809-236788cf9e89 h1:Wtpgk4CIkoEJ7Qx3BwjaMp3TOVv834heqyCC9jMKStM=
Expand Down
2 changes: 2 additions & 0 deletions pkg/filesystem/virtual/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ go_library(
"leaf.go",
"linkable_leaf.go",
"named_attributes_factory.go",
"native_symlink_target_unix.go",
"native_symlink_target_windows.go",
"nfs_handle_allocator.go",
"node.go",
"permissions.go",
Expand Down
2 changes: 1 addition & 1 deletion pkg/filesystem/virtual/base_symlink_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (f symlink) readlinkParser() (path.Parser, error) {
if !utf8.Valid(f.target) {
return nil, status.Error(codes.InvalidArgument, "Symbolic link contents are not valid UTF-8")
}
return path.UNIXFormat.NewParser(string(f.target)), nil
return path.LocalFormat.NewParser(string(f.target)), nil
}

func (f symlink) readlinkString() (string, error) {
Expand Down
9 changes: 8 additions & 1 deletion pkg/filesystem/virtual/cas_initial_contents_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@ func (icf *casInitialContentsFetcher) fetchContentsUnwrapped(fileReadMonitorFact
return nil, status.Errorf(codes.InvalidArgument, "Directory contains multiple children named %#v", entry.Name)
}

leaf := icf.options.symlinkFactory.LookupSymlink([]byte(entry.Target))
// REv2 symlink targets use UNIX path separators. Convert
// to the native platform format so that the stored bytes
// can be returned verbatim by VirtualReadlink.
target, err := nativeSymlinkTarget(entry.Target)
if err != nil {
return nil, util.StatusWrapf(err, "Failed to normalize target of symlink %#v", entry.Name)
}
leaf := icf.options.symlinkFactory.LookupSymlink(target)
children[component] = InitialChild{}.FromLeaf(leaf)
leavesToUnlink = append(leavesToUnlink, leaf)
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/filesystem/virtual/native_symlink_target_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build !windows

package virtual

// nativeSymlinkTarget converts a REv2 symlink target (UNIX format)
// to the native platform format. On UNIX this is a no-op, as REv2
// already uses UNIX path separators.
func nativeSymlinkTarget(target string) ([]byte, error) {
return []byte(target), nil
}
22 changes: 22 additions & 0 deletions pkg/filesystem/virtual/native_symlink_target_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build windows

package virtual

import "github.com/buildbarn/bb-storage/pkg/filesystem/path"

// nativeSymlinkTarget converts a REv2 symlink target (UNIX format)
// to the native platform format. On Windows this converts forward
// slashes to backslashes and strips trailing directory separators
// that would cause issues in reparse point substitute names.
func nativeSymlinkTarget(target string) ([]byte, error) {
targetParser := path.UNIXFormat.NewParser(target)
targetPath, scopeWalker := path.EmptyBuilder.Join(path.VoidScopeWalker)
if err := path.Resolve(targetParser, scopeWalker); err != nil {
return nil, err
}
s, err := targetPath.GetWindowsString(path.WindowsPathFormatStandard)
if err != nil {
return nil, err
}
return []byte(s), nil
}
5 changes: 5 additions & 0 deletions pkg/filesystem/virtual/winfsp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,17 @@ go_test(
tags = ["manual"],
deps = select({
"@rules_go//go/platform:windows": [
"//pkg/cas",
"//pkg/filesystem/pool",
"//pkg/filesystem/virtual",
"//pkg/filesystem/virtual/configuration",
"//pkg/proto/configuration/filesystem/virtual",
"@bazel_remote_apis//build/bazel/remote/execution/v2:remote_execution_go_proto",
"@com_github_buildbarn_bb_storage//pkg/blockdevice",
"@com_github_buildbarn_bb_storage//pkg/clock",
"@com_github_buildbarn_bb_storage//pkg/digest",
"@com_github_buildbarn_bb_storage//pkg/filesystem",
"@com_github_buildbarn_bb_storage//pkg/filesystem/path",
"@com_github_buildbarn_bb_storage//pkg/program",
"@com_github_buildbarn_bb_storage//pkg/util",
"@com_github_stretchr_testify//require",
Expand Down
10 changes: 5 additions & 5 deletions pkg/filesystem/virtual/winfsp/file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -1352,17 +1352,17 @@ func getReparsePointForLeaf(ctx context.Context, leaf virtual.Leaf, buffer []byt
return 0, nil
}

// Parse the path to determine if it's absolute
// Symlink targets are stored in native (Windows) format, so
// we can pass them directly to FillSymlinkReparseBuffer.
w := relativePathChecker{}
if err := path.Resolve(path.LocalFormat.NewParser(string(target)), &w); err != nil {
return 0, err
}
var flags int
var flags uint32
if w.isRelative {
flags = windowsext.SYMLINK_FLAG_RELATIVE
flags = uint32(windowsext.SYMLINK_FLAG_RELATIVE)
}

return FillSymlinkReparseBuffer(string(target), uint32(flags), buffer)
return FillSymlinkReparseBuffer(string(target), flags, buffer)
}

func (fs *FileSystem) GetReparsePoint(ref *ffi.FileSystemRef, file uintptr, name string, buffer []byte) (int, error) {
Expand Down
Loading