Skip to content

Commit

Permalink
Reproduce the /proc error in chroot runners.
Browse files Browse the repository at this point in the history
This works fine for regular runners that uses the docker image
user-space. But the next commit enables chroot runners and it starts to
fail.

bazel build \
    --remote_executor=grpc://localhost:8980 \
    --remote_instance_name=fuse \
    --remote_default_exec_properties OSFamily=linux \
    --remote_default_exec_properties container-image="docker://ghcr.io/catthehacker/ubuntu:act-22.04@sha256:5f9c35c25db1d51a8ddaae5c0ba8d3c163c5e9a4a6cc97acd409ac7eae239448" \
    @//:introspection

This is step one of three to verify the solution to:
buildbarn/bb-remote-execution#115
  • Loading branch information
stagnation committed Nov 16, 2023
1 parent 07901a9 commit 4ba26f1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
14 changes: 14 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary")
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")

Expand All @@ -6,3 +7,16 @@ load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
gazelle(
name = "gazelle",
)

# $ bazel build //cmd/ls-proc
# $ cp -f bazel-bin/cmd/ls-proc/ls-proc_/ls-proc ls-proc
run_binary(
name = "introspection",
outs = ["out"],
args = ["$(location out)"],
execution_requirements = {
"no-cache": "1",
},
tool = ":ls-proc",
srcs = ["usr/bin/env"],
)
15 changes: 15 additions & 0 deletions cmd/ls-proc/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/buildbarn/bb-deployments/cmd/ls-proc",
visibility = ["//visibility:private"],
)

go_binary(
name = "ls-proc",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
pure = "on",
)
24 changes: 24 additions & 0 deletions cmd/ls-proc/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"fmt"
"os"
"log"
)

func main() {
entries, err := os.ReadDir("/proc/self")
if err != nil {
log.Fatal("Reading /proc/self:", err)
}

max := 10
for i, e := range entries {
if i > max {
break
}
fmt.Println(e.Name())
}

os.Create(os.Args[1])
}
Binary file added ls-proc
Binary file not shown.
Binary file added usr/bin/env
Binary file not shown.

0 comments on commit 4ba26f1

Please sign in to comment.