golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.86k stars 17.52k forks source link

cmd/go: support `git/subcommand` invocations for git9 on plan9 #68926

Closed xplshn closed 5 days ago

xplshn commented 4 weeks ago

Go version

go1.23.0 plan9/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN='/usr/glenda/bin'
GOCACHE='/usr/glenda/.config/go/cache'
GOENV='/usr/glenda/lib/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='plan9'
GOINSECURE=''
GOMODCACHE='/usr/glenda/.config/go/cache/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='plan9'
GOPATH='/usr/glenda/.config/go/cache'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/sys/lib/go/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/sys/lib/go/go/pkg/tool/plan9_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/usr/glenda/lib/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
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 -m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1052339782=/tmp/go-build -gno-record-gcc-switches'

What did you do?

go install github.com/peajack/truefetch@main, but any install command will do. Actually, any command that relies on calling git.

What did you see happen?

go: github.com/peajack/truefetch@main: git init --bare in /usr/glenda/.config/go/cache/pkg/mod/cache/vcs/85d6972f1025dadd3cbae4796f5cd2cffa4c5c529c72c4081ee43145033f601d: exec: "git": executable file not found in $path screenshot NOTE: In ACME, you just 'type a button' in the bar and then do MOUSE3 to execute it, the output is then redirected to a new column in the editor. Executing the commands in 'window' (our "terminal") gives the same result.

What did you expect to see?

... Nothing, just go downloading the libraries/packages on which truefetch depends on and then compiling, like normal. On Plan9, the most recent, usable and reliable git port that we have is git9, which comes with 9front and can be found at /sys/src/cmd/git. The git binaries are at /bin/git/*. go should have called git/subCommand <args>, not git subCommand <args>.

gabyhelp commented 4 weeks ago

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

krstlmnn commented 3 weeks ago

Note that "git9" does not try to be totally compatible with the standard git binary and you can't just convert git <command> [<args>] to git/<command> [<args>] without consulting the manual pages. For example in this case git init --bare would be git/init -b.

Shouldn't this work with the rc wrapper from 9legacy, which predates "git9"?

xplshn commented 3 weeks ago

Note that "git9" does not try to be totally compatible with the standard git binary and you can't just convert git <command> [<args>] to git/<command> [<args>] without consulting the manual pages. For example in this case git init --bare would be git/init -b.

Shouldn't this work with the rc wrapper from 9legacy, which predates "git9"?

Its not in 9front, which is the most popular plan9 distribution. And its been deprecated in favor of git9.

krstlmnn commented 3 weeks ago

I forgot about the compat script included in git9. As the manpage reads:

Git/compat spawns an rc subshell with a compatibility stub in $path. This compatibility stub provides enough of the unix git commands to run tools like go get but not much more.

dmitshur commented 3 weeks ago

CC @golang/plan9.

millerresearch commented 3 weeks ago

Shouldn't this work with the rc wrapper from 9legacy, which predates "git9"?

Its not in 9front, which is the most popular plan9 distribution. And its been deprecated in favor of git9.

@krstlmnn is correct, as documented in the go wiki the wraoper is available to emulate just enough of git to be used by the go tools. It's not "in" 9front or any other version of Plan 9 -- it's just a simple shell script which you can download from 9legacy, and ensure it's bound in place of /bin/git before using go install. This works whatever flavour of Plan 9 you are using.

The 9front git9 command is something completely different -- it's a full reimplementation of git as a native Plan 9 style file server. But it's specific to 9front only -- the last time I checked, it wouldn't even compile under mainstream Plan 9.

If you want to use git9 instead of the usual wrapper, maybe consult the author @oridb about how to use the compat script for the purpose.

But I don't think there's any need to alter the go tools to accommodate 9front specially, when there's already a portable solution.

oridb commented 3 weeks ago

There's two different wrappers here: 'git/compat' and the http based wrapper scripts. Git/compat ships with 9front, but breaks pretty regularly, as go changes the features of git that it uses.

Right now, the module cache is the least painful option.

If the go team is open to it, invoking git9 would be a much better option. I'd be happy to take a shot at that, as well as figuring out how to test it.

millerresearch commented 3 weeks ago

@oridb, can you give a current example where the portable rc wrapper doesn't work?

oridb commented 5 days ago

Sorry for the slow response -- I was on vacation. Looking at the reports I've gotten, bootstrapping has been the most painful part. I don't think the rc wrapper tries to deal with that (or with self-hosted repos).

I'll re-close, but I still think that if the go project is open to it, direct support for git/* would be nice on plan 9.

xplshn commented 5 days ago

Why is this closed as Completed..? Will this not be fixed?