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

cmd/go: tip build failure when using Mercurial VCS #49841

Open
gjmct opened this issue Nov 29, 2021 · 1 comment
Open

cmd/go: tip build failure when using Mercurial VCS #49841

gjmct opened this issue Nov 29, 2021 · 1 comment

Comments

@gjmct
Copy link

@gjmct gjmct commented Nov 29, 2021

What version of Go are you using (go version)?

go version devel go1.18-1ea4d3b Mon Nov 29 00:58:50 2021 +0000 windows/amd64

Does this issue reproduce with the latest release?

No

What operating system and processor architecture are you using (go env)?

go env Output
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\gavinm\AppData\Local\go-build
set GOENV=C:\Users\gavinm\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\gavinm\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\gavinm\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\gavinm\AppData\Local\Temp\go-build401408008=/tmp/go-build -gno-record-gcc-switches

What vcs version and extensions are you running?

hg version -v Output
Mercurial Distributed SCM (version 5.9.2)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2021 Olivia Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Enabled extensions:

convert internal
gpg internal
hggit external 0.10.2 (dulwich 0.19.16)
histedit internal
purge internal
rebase internal
strip internal

What did you do?

gotip build

What did you expect to see?

A successful build

What did you see instead?

gotip build -v
error obtaining VCS status: exit status 255
        Use -buildvcs=false to disable VCS stamping
gotip build -v
# cd C:\Users\gavinm\Go\src\quoi.nz\jei\qrtime; hg log -l1 -T {node}:{date(date,"%s")}
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 5.9.2)
** Extensions loaded: convert, gpg, hggit 0.10.2 (dulwich 0.19.16), histedit, purge, rebase, strip
Traceback (most recent call last):
  File "hg", line 58, in 
  File "mercurial\dispatch.pyo", line 144, in run
  File "mercurial\dispatch.pyo", line 250, in dispatch
  File "mercurial\dispatch.pyo", line 294, in _rundispatch
  File "mercurial\dispatch.pyo", line 470, in _runcatch
  File "mercurial\dispatch.pyo", line 480, in _callcatch
  File "mercurial\scmutil.pyo", line 153, in callcatch
  File "mercurial\dispatch.pyo", line 460, in _runcatchfunc
  File "mercurial\dispatch.pyo", line 1274, in _dispatch
  File "mercurial\dispatch.pyo", line 918, in runcommand
  File "mercurial\dispatch.pyo", line 1285, in _runcommand
  File "mercurial\dispatch.pyo", line 1271, in 
  File "mercurial\util.pyo", line 1886, in check
  File "mercurial\commands.pyo", line 4735, in log
  File "mercurial\logcmdutil.pyo", line 1231, in displayrevs
  File "mercurial\logcmdutil.pyo", line 303, in show
  File "mercurial\logcmdutil.pyo", line 631, in _show
  File "mercurial\templater.pyo", line 1094, in render
  File "mercurial\util.pyo", line 1796, in increasingchunks
  File "mercurial\templateutil.pyo", line 868, in flatten
  File "mercurial\templateutil.pyo", line 1072, in runtemplate
  File "mercurial\templateutil.pyo", line 921, in evalrawexp
  File "mercurial\templatefuncs.pyo", line 73, in date
  File "mercurial\utils\dateutil.pyo", line 128, in datestr
ValueError: Invalid format string
error obtaining VCS status: exit status 255
        Use -buildvcs=false to disable VCS stamping.

Line 128 in dateutil.pyo is an attempt to parse a date format template. Working backwards into the Go code, the problem seems to be this line in vcs.go:

func hgStatus(vcsHg *Cmd, rootDir string) (Status, error) {
	// Output changeset ID and seconds since epoch.
	out, err := vcsHg.runOutputVerboseOnly(rootDir, `log -l1 -T {node}:{date(date,"%s")}`)

Which I think is caused because "%s" isn't a recognised time format directive.

Changing the line to

	out, err := vcsHg.runOutputVerboseOnly(rootDir, `log -l1 -T {node}:{word(0, date|hgdate)}`)

corrects the issue on my system, but I'm not 100% sure that this is what the expected output for this function should be. Especially as I'm not even passing fluent in Python.

@ALTree ALTree changed the title gotip build failure when using Mercurial VCS cmd/go: tip build failure when using Mercurial VCS Nov 29, 2021
@ALTree ALTree added this to the Go1.18 milestone Nov 29, 2021
@ALTree
Copy link
Member

@ALTree ALTree commented Nov 29, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants