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/tools/cmd/goyacc: failing with %! errors #22319

Closed
dhoblem opened this issue Oct 18, 2017 · 14 comments
Closed

x/tools/cmd/goyacc: failing with %! errors #22319

dhoblem opened this issue Oct 18, 2017 · 14 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@dhoblem
Copy link

dhoblem commented Oct 18, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.1 linux/ppc64le

Does this issue reproduce with the latest release?

yes it does

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

Ubuntu 16.04 /ppc64le

What did you do?

I am trying to build couchbase code which is using thee gocode. This internally runs "go tool goyacc" command; which is failing with errors.

What did you expect to see?

No errors.

What did you see instead?

n1ql.y:269:26: &{%!n(int=3) %!n(int=-1) %!n(bool=false) %!n(bool=false) %!n(bool=true) %!n(string=) %!n(string=GE) %!n(token.Pos=4987) %!n(int=8) [] %!n(string=) %!n(int=57544) %!n(bool=false) %!n(bool=false) [%!n(int=0) %!n(int=128) %!n(int=0) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(bool=true) [%!n(int=5836665134256227840) %!n(int=-5665492734476001279) %!n(int=36328963693412357) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(int=71) [] %!n(bool=false)}onassoc symbol %!s(int=175) conflict in state %!d(MISSING)
n1ql.y:269:26: &{%!n(int=3) %!n(int=-1) %!n(bool=false) %!n(bool=false) %!n(bool=true) %!n(string=) %!n(string=GE) %!n(token.Pos=4987) %!n(int=8) [] %!n(string=) %!n(int=57544) %!n(bool=false) %!n(bool=false) [%!n(int=0) %!n(int=128) %!n(int=0) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(bool=true) [%!n(int=5836665134256227840) %!n(int=-5665492734476001279) %!n(int=36328963693412357) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(int=71) [] %!n(bool=false)}onassoc symbol %!s(int=176) conflict in state %!d(MISSING)
n1ql.y:269:26: &{%!n(int=3) %!n(int=-1) %!n(bool=false) %!n(bool=false) %!n(bool=true) %!n(string=) %!n(string=GE) %!n(token.Pos=4987) %!n(int=8) [] %!n(string=) %!n(int=57544) %!n(bool=false) %!n(bool=false) [%!n(int=0) %!n(int=128) %!n(int=0) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(bool=true) [%!n(int=5836665134256227840) %!n(int=-5665492734476001279) %!n(int=36328963693412357) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(int=71) [] %!n(bool=false)}onassoc symbol %!s(int=177) conflict in state %!d(MISSING)
n1ql.y:269:26: &{%!n(int=3) %!n(int=-1) %!n(bool=false) %!n(bool=false) %!n(bool=true) %!n(string=) %!n(string=GE) %!n(token.Pos=4987) %!n(int=8) [] %!n(string=) %!n(int=57544) %!n(bool=false) %!n(bool=false) [%!n(int=0) %!n(int=128) %!n(int=0) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(bool=true) [%!n(int=5836665134256227840) %!n(int=-5665492734476001279) %!n(int=36328963693412357) %!n(int=0) %!n(int=0) %!n(int=0)] %!n(int=71) [] %!n(bool=false)}onassoc symbol %!s(int=178) conflict in state %!d(MISSING)
CMake Error at /root/meghali/couchbase/tlm/cmake/Modules/go-yacc.cmake:11 (MESSAGE):
Failed running go yacc :1

I found a similar issue already on this list however its in closed state. I have tried all the steps mentioned in the issue however that didn't help me. The issue link is "#5730".
Can someone who had faced and could resolve the issue; help me here with some hints?

Thanks,
Meghali

@ianlancetaylor ianlancetaylor changed the title goyacc failing with %! errors x/tools/cmd/goyacc: failing with %! errors Oct 18, 2017
@gopherbot gopherbot added this to the Unreleased milestone Oct 18, 2017
@ianlancetaylor
Copy link
Member

It is clearly a bug in goyacc that it is displaying the error message in this way. But I want to clarify that if we fix this bug in goyacc, you will still have a problem in your parser. You have some sort of state conflict.

@ianlancetaylor
Copy link
Member

So, I said it was a bug in goyacc, but I actually can not find this message anywhere in goyacc. Precisely how are you invoking goyacc? Can you give us a copy of the input file? Are you sure that you are using the current version of goyacc (run go get -u golang.org/x/tools/cmd/goyacc to update).

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 18, 2017
@dhoblem
Copy link
Author

dhoblem commented Oct 25, 2017

Yes I have the updated version of goyacc as I have run the command "go get -u".
In my source I have been using "go tool goyacc " where file-test is one of the file from my source code of couchbase.

@cznic
Copy link
Contributor

cznic commented Oct 25, 2017

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

go version go1.9.1 linux/ppc64le

...

In my source I have been using "go tool goyacc " where file-test is one of the file from my source code of couchbase.

There's no go tool yacc in Go 1.9. Please check what's your Go version and/or which goyacc tool you're actually using.

@dhoblem
Copy link
Author

dhoblem commented Oct 27, 2017

<<There's no go tool yacc in Go 1.9. Please check what's your Go version and/or which goyacc tool you're actually using.>>

I am using "go tool goyacc" not yacc. I understand the yacc tool is not being used in go version 1.7 version later. If you still think that using goyacc is wrong please suggest some alternate way of handling this.

@ianlancetaylor
Copy link
Member

What does go tool -n goyacc print?

@dhoblem
Copy link
Author

dhoblem commented Oct 27, 2017

/root/meghali/go/pkg/tool/linux_ppc64le/goyacc

@cznic
Copy link
Contributor

cznic commented Oct 27, 2017

I am using "go tool goyacc" not yacc. I understand the yacc tool is not being used in go version 1.7 version later. If you still think that using goyacc is wrong please suggest some alternate way of handling this.

Yes, something seems strange. The go tool subcommand normally does not recognize yacc nor goyacc.

$ which goyacc
$ go get -u golang.org/x/tools/cmd/goyacc
$ go tool yacc
go tool: no such tool "yacc"
$ go tool goyacc
go tool: no such tool "goyacc"
$ go tool -n goyacc
go tool: no such tool "goyacc"
$ which goyacc
/home/jnml/bin/goyacc
$ goyacc -h
Usage of goyacc:
  -l	disable line directives
  -o string
    	parser output (default "y.go")
  -p string
    	name prefix to use in generated code (default "yy")
  -v string
    	create parsing tables (default "y.output")
$ 

IOW, the usual way to invoke goyacc is just $ goyacc ... provided it's in the $PATH.

@dhoblem
Copy link
Author

dhoblem commented Oct 27, 2017

Thanks for the comment @cznic , that helps to understand the logical usage.
However when I tried using the command directly, it gives me same error. Looks like some issue with the goyacc binary itself.

@cznic
Copy link
Contributor

cznic commented Oct 27, 2017

Is the n1ql.y file available somewhere online?

@dhoblem
Copy link
Author

dhoblem commented Oct 27, 2017

Yes it is.
This link will take you there : https://github.com/couchbase/query/blob/master/parser/n1ql/n1ql.y

@cznic
Copy link
Contributor

cznic commented Oct 27, 2017

Thanks fo the link. I'm getting no errors here

jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ git status 
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ git log -1
commit 0712210d6443dc6bccc8a17bda73bc58cc18c22d (HEAD -> master, origin/master, origin/HEAD, tmp)
Author: miaobingjie <bingjie.miao@couchbase.com>
Date:   Wed Oct 25 16:24:25 2017 -0700

    MB-26399 Additional changes for reopen() infrastructure for ANSI JOIN
    
    There are a few additional changes needed for reopen() functionality for runtime operators.
    These includes:
      - allocation of child channels
      - allocation of memory for new slices, sets, maps, etc
      - cleanup of batch memory
    
    In most cases the new addition mimics what's already in the New() or Copy() call for the
    affected operator. For memory release it mimics the appropriate release functions.
    
    Change-Id: Icd1c5d9a3c438f0f6fe58a4962d2aea7f8c6e1d5
    Reviewed-on: http://review.couchbase.org/84810
    Reviewed-by: Marco Greco <marco.greco@couchbase.com>
    Tested-by: Bingjie Miao <bingjie.miao@couchbase.com>
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ ll
total 960
-rw-rw-r-- 1 jnml jnml    270 Oct 27 12:50 README.md
-rwxrwxr-x 1 jnml jnml    462 Oct 27 12:50 build.sh*
-rw-rw-r-- 1 jnml jnml 100421 Oct 27 12:52 log.go
-rw-rw-r-- 1 jnml jnml   3375 Oct 27 12:50 n1ql.go
-rw-rw-r-- 1 jnml jnml  20438 Oct 27 12:50 n1ql.nex
-rw-rw-r-- 1 jnml jnml 465138 Oct 27 12:50 n1ql.nn.go
-rw-rw-r-- 1 jnml jnml  41369 Oct 27 12:50 n1ql.y
-rw-rw-r-- 1 jnml jnml   1803 Oct 27 12:50 util.go
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ goyacc -h 
Usage of goyacc:
  -l	disable line directives
  -o string
    	parser output (default "y.go")
  -p string
    	name prefix to use in generated code (default "yy")
  -v string
    	create parsing tables (default "y.output")
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ goyacc n1ql.y
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ ll
total 1060
-rw-rw-r-- 1 jnml jnml    270 Oct 27 12:50 README.md
-rwxrwxr-x 1 jnml jnml    462 Oct 27 12:50 build.sh*
-rw-rw-r-- 1 jnml jnml 100421 Oct 27 12:52 log.go
-rw-rw-r-- 1 jnml jnml   3375 Oct 27 12:50 n1ql.go
-rw-rw-r-- 1 jnml jnml  20438 Oct 27 12:50 n1ql.nex
-rw-rw-r-- 1 jnml jnml 465138 Oct 27 12:50 n1ql.nn.go
-rw-rw-r-- 1 jnml jnml  41369 Oct 27 12:50 n1ql.y
-rw-rw-r-- 1 jnml jnml   1803 Oct 27 12:50 util.go
-rw-rw-r-- 1 jnml jnml 100421 Oct 27 12:55 y.go
-rw-rw-r-- 1 jnml jnml 330681 Oct 27 12:55 y.output
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ head y.go    
//line n1ql.y:2
package n1ql

import __yyfmt__ "fmt"

//line n1ql.y:2
import "fmt"
import "strings"
import "github.com/couchbase/clog"
import "github.com/couchbase/query/algebra"
jnml@r550:~/src/github.com/couchbase/query/parser/n1ql$ 

@ianlancetaylor
Copy link
Member

Thanks for the info. I don't think your program /root/meghali/go/pkg/tool/linux_ppc64le/goyacc was built from golang.org/x/tools/cmd/goyacc. I don't know what that program is or how it was built. It was not built using the standard Go build process, because the standard Go build process would not create that program.

I think you should delete that program, or save it somewhere if you like, run go get -u golang.org/x/tools/cmd/goyacc, and instead of running go tool goyacc run $GOPATH/bin/goyacc.

I'm going to close this because I don't think there is anything for us to change.

@dhoblem
Copy link
Author

dhoblem commented Oct 30, 2017

Thanks for the responses @cznic and @ianlancetaylor ; that helped me resolve the issue!!
I cleaned-up the whole environment and re-installed goyacc using "go get" and "go install" then it created the binary at GOPATH/bin location and then it ran correctly for me.

@golang golang locked and limited conversation to collaborators Oct 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants