Skip to content

x/telemetry: [email protected]/ directory is mode 0555, not 0755, in the go mod cache after go mod vendor -modcacherw #69239

Closed as not planned
@Mikcl

Description

@Mikcl

Go version

go version go1.23.0 linux/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3287513302=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I have somewhat an interesting setup but for the sake of a reproducible I ran the following commands:

main.go:

package main

import (
	"fmt"
	"github.com/spf13/cobra"
	"os"
)

func main() {
	var rootCmd = &cobra.Command{
		Use:   "hello",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("Hello, World!")
		},
	}

	if err := rootCmd.Execute(); err != nil {
		os.Exit(1)
	}
}

Ran these commands

go mod init mytelemtery
go mod tidy

Created this Dockerfile:

FROM golang:1.23-alpine
WORKDIR /app
COPY . .
CMD ["/bin/sh"]
docker build -t mytelemetry:latest .
docker run -it mytelemetry:latest

Within the docker container:

go mod vendor -modcacherw

What did you see happen?

The problem is the [email protected] directory that comes with this x/telemtry package is not writeable by the owner, typically directories are 0755.

$ ls -l $GOPATH/pkg/mod/golang.org/x/telemetry/
total 4
dr-xr-xr-x    2 root     root          4096 Sep  4 00:44 [email protected]

I also ran stat $GOPATH/pkg/mod/golang.org/x/telemetry/[email protected]/

which shows Access: (0555/dr-xr-xr-x)

What did you expect to see?

I expect directories to be 0755 so that they can be removed by owners.

It seems like this telemtry package is new https://pkg.go.dev/golang.org/x/telemetry?tab=versions (in existence since only Aug 28 2024).

In the Docker example above, I can remove the directory, since you're root in docker. But in other setups where this directory exists (I can share further details on how such a setup gets ends up with this file) I would expect them to be 0755 so that they could be removed.

Is it intentional for this directory to be 0555?

Metadata

Metadata

Assignees

No one assigned

    Labels

    telemetryx/telemetry issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions