Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/exp/trace: gen.bash depends on GNU's sed, fails with BSD's #68403

Closed
rhysh opened this issue Jul 12, 2024 · 1 comment
Closed

x/exp/trace: gen.bash depends on GNU's sed, fails with BSD's #68403

rhysh opened this issue Jul 12, 2024 · 1 comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rhysh
Copy link
Contributor

rhysh commented Jul 12, 2024

Go version

go version devel go1.23-06feff6279 Tue Jul 2 15:36:40 2024 -0700 darwin/arm64 [CL 596355 PS 1, parent is f12ac5b]

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/rhysh/Library/Caches/go-build'
GOENV='/Users/rhysh/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/rhysh/work/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/rhysh/work'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='devel go1.23-06feff6279 Tue Jul 2 15:36:40 2024 -0700'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/rhysh/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/rhysh/src/exp/go.mod'
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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/pw/d_qmtcrd3vs0890gvmrq8qx80000gn/T/go-build1453705823=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

In the x/exp repo, on macOS,

$ (cd ./trace/ && ./gen.bash $(go env GOROOT))
$ git remote -v
origin  https://go.googlesource.com/exp (fetch)
origin  https://go.googlesource.com/exp (push)

I'm working with x/exp at CL 597177 PS 1, with a parent of golang/exp@7f521ea

What did you see happen?

$ (cd ./trace/ && ./gen.bash $(go env GOROOT))
assuming Go checkout at /usr/local/go...
building file list ... done
deleting cmd/gotracevalidate/main.go
deleting cmd/gotracevalidate/
deleting cmd/gotraceraw/main.go
[ ... snip ... ]
traceviewer/static/webcomponents.min.js
version/
version/version.go

sent 4364398 bytes  received 2274 bytes  2911114.67 bytes/sec
total size is 4559026  speedup is 1.04
sed: 1: "./cmd/gotraceraw/main.go": invalid command code .

With git reporting 52 files modified and 3 deleted.

What did you expect to see?

I expected ./trace/gen.bash to copy the execution trace parser from GOROOT (which it did), to apply the code rewrites necessary to use it in its new location (did not) and without deleting the hand-maintained files in the ./trace directory (did not).

This relates to the meaning of sed's "-i" flag being different on GNU vs BSD.

I'll prepare a patch to make it work on both. That probably means using a non-empty backup suffix and subsequently deleting those copies. Does that sound like a good plan, @mknyszek @cagedmantis ?

@gopherbot gopherbot added this to the Unreleased milestone Jul 12, 2024
@cagedmantis cagedmantis added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 12, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/598016 mentions this issue: trace: support BSD version of sed in gen.bash

@rhysh rhysh added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants