parse issue go.dev/govulncheck
dcvz opened this issue · comments
Suddenly started getting this today:
error: Uncaught (in promise) Error: package.yml parse error: /Users/dcvz/Library/Application Support/pkgx/pantry/projects/go.dev/govulncheck/package.yml
throw new PantryParseError(project, filename, cause);
^
at https://deno.land/x/libpkgx@v0.14.1/src/hooks/usePantry.ts:62:19
at eventLoopTick (ext:core/01_core.js:183:11)
at async find (https://deno.land/x/libpkgx@v0.14.1/src/hooks/usePantry.ts:160:20)
at async failsafe (file:///Users/builder/actions-runner/_work/pkgx/pkgx/src/prefab/failsafe.ts:5:12)
at async default (file:///Users/builder/actions-runner/_work/pkgx/pkgx/src/prefab/parse-pkg-str.ts:12:20)
Caused by: YAMLError: end of the stream or a document separator is expected in "/Users/dcvz/Library/Application Support/pkgx/pantry/projects/go.dev/govulncheck/package.yml" at line 63, column 34:
- (govulncheck ./... 2>&1 ||
^
at generateError (https://deno.land/std@0.196.0/yaml/_loader/loader.ts:88:10)
at throwError (https://deno.land/std@0.196.0/yaml/_loader/loader.ts:91:9)
at readDocument (https://deno.land/std@0.196.0/yaml/_loader/loader.ts:1079:12)
at loadDocuments (https://deno.land/std@0.196.0/yaml/_loader/loader.ts:1103:5)
at load (https://deno.land/std@0.196.0/yaml/_loader/loader.ts:1122:21)
at parse (https://deno.land/std@0.196.0/yaml/parse.ts:13:10)
at Path.readYAML (https://deno.land/x/libpkgx@v0.14.1/src/utils/Path.ts:331:14)
at eventLoopTick (ext:core/01_core.js:183:11)
at async find (https://deno.land/x/libpkgx@v0.14.1/src/hooks/usePantry.ts:160:20)
at async failsafe (file:///Users/builder/actions-runner/_work/pkgx/pkgx/src/prefab/failsafe.ts:5:12)
Caused by: "/Users/dcvz/Library/Application Support/pkgx/pantry/projects/go.dev/govulncheck/package.yml"
Can you post the contents of /Users/dcvz/Library/Application Support/pkgx/pantry/projects/go.dev/govulncheck/package.yml
? It should match https://github.com/pkgxdev/pantry/blob/main/projects/go.dev/govulncheck/package.yml. Specifically, it looks like it's complaining about the last line
Assuming there's a difference, pkgx --sync
should fix it. However, if it's not different, then we need to figure out why it's complaining.
Here are the contents:
Contents
distributable:
url: https://github.com/golang/vuln/archive/refs/tags/v{{version}}.tar.gz
strip-components: 1
versions:
github: golang/vuln/tags
provides:
- bin/govulncheck
build:
dependencies:
go.dev: ^1.19
script: |
go mod download
mkdir -p "{{ prefix }}"/bin
go build -v -trimpath -ldflags="$LDFLAGS" -o $BUILDLOC ./cmd/govulncheck
env:
GOPROXY: https://proxy.golang.org,direct
GOSUMDB: sum.golang.org
GO111MODULE: on
CGO_ENABLED: 0
BUILDLOC: '{{prefix}}/bin/govulncheck'
LDFLAGS:
- -s
- -w
linux:
# or segmentation fault
# fix found here https://github.com/docker-library/golang/issues/402#issuecomment-982204575
LDFLAGS:
- -buildmode=pie
test:
fixture: |
package main
import (
"fmt"
"os"
"golang.org/x/text/language"
)
func main() {
for _, arg := range os.Args[1:] {
tag, err := language.Parse(arg)
if err != nil {
fmt.Printf("%s: error: %v\n", arg, err)
} else if tag == language.Und {
fmt.Printf("%s: undefined\n", arg)
} else {
fmt.Printf("%s: tag %s\n", arg, tag)
}
}
}
dependencies:
go.dev: ^1.19
script:
- go mod init vuln.tutorial
- cp $FIXTURE main.go
- go mod tidy
- go get golang.org/x/text@v0.3.5
- (govulncheck ./... 2>&1 || ��������������������������
It turns out that pkgx --sync
also errors..
@mxcl here's an example of a corrupted package.yml
in the wild. File is 1562B, so i'm not sure the point of corruption is significant.
gnup.org/pinentry is a directory in the current pantry. so there's definite corruption of your pantry, @dcvz . for a quick fix, you can probably mv /Users/dcvz/Library/Application Support/pkgx/pantry{,.bak} && pkgx --sync
(moving it to a .bak location in case we can do further troubleshooting.
Closing in favor of #865
This issue is much reduced in impact since 1.1.1, but still happens and needs to be understood and fixed.