yaegi icon indicating copy to clipboard operation
yaegi copied to clipboard

stack overflow while using github.com/go-redis/redis

Open Cylkal opened this issue 3 years ago • 1 comments

The following program sample.go triggers an unexpected result

package main

import (
	"context"
	"time"

	"github.com/go-redis/redis"
)

func main() {
	client := redis.NewClient(&redis.Options{}).WithContext(context.Background())
	_ = client
	return
}

Expected result

go run main.go
// output nothing

Got

run file

package main

import (
	"fmt"
	"path/filepath"

	"github.com/traefik/yaegi/interp"
	"github.com/traefik/yaegi/stdlib"
	"github.com/traefik/yaegi/stdlib/unsafe"
)

func main() {
	goPath, err := filepath.Abs(filepath.FromSlash(""))
	if err != nil {
		panic(err)
	}
	fmt.Println(goPath)
	i := interp.New(interp.Options{
		GoPath: goPath,
	})

	i.Use(stdlib.Symbols)
	i.Use(unsafe.Symbols)
	
	_, err = i.EvalPath("./src/testdata/main.go")
	if err != nil {
		panic(err)
	}
}

// output

/root/code/tscan-open/src/luago
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020be0370 stack=[0xc020be0000, 0xc040be0000]
fatal error: stack overflow

runtime stack:
runtime.throw(0xee0215, 0xe)
	/usr/local/go/src/runtime/panic.go:1117 +0x72
runtime.newstack()
	/usr/local/go/src/runtime/stack.go:1069 +0x7ed
runtime.morestack()
	/usr/local/go/src/runtime/asm_amd64.s:458 +0x8f

goroutine 1 [running]:
runtime.makeslice(0xe8f7e0, 0x2, 0x2, 0x0)
	/usr/local/go/src/runtime/slice.go:83 +0xeb fp=0xc020be0380 sp=0xc020be0378 pc=0x4566eb
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3483 +0x5a fp=0xc020be0458 sp=0xc020be0380 pc=0x6a4b5a
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be04a8 sp=0xc020be0458 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be04f8 sp=0xc020be04a8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0548 sp=0xc020be04f8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be0608 sp=0xc020be0548 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be06e0 sp=0xc020be0608 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be0730 sp=0xc020be06e0 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0780 sp=0xc020be0730 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be07d0 sp=0xc020be0780 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be0890 sp=0xc020be07d0 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be0968 sp=0xc020be0890 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be09b8 sp=0xc020be0968 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0a08 sp=0xc020be09b8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0a58 sp=0xc020be0a08 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be0b18 sp=0xc020be0a58 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be0bf0 sp=0xc020be0b18 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be0c40 sp=0xc020be0bf0 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0c90 sp=0xc020be0c40 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0ce0 sp=0xc020be0c90 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be0da0 sp=0xc020be0ce0 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be0e78 sp=0xc020be0da0 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be0ec8 sp=0xc020be0e78 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0f18 sp=0xc020be0ec8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be0f68 sp=0xc020be0f18 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be1028 sp=0xc020be0f68 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be1100 sp=0xc020be1028 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be1150 sp=0xc020be1100 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be11a0 sp=0xc020be1150 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be11f0 sp=0xc020be11a0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be12b0 sp=0xc020be11f0 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be1388 sp=0xc020be12b0 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be13d8 sp=0xc020be1388 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1428 sp=0xc020be13d8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1478 sp=0xc020be1428 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be1538 sp=0xc020be1478 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be1610 sp=0xc020be1538 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be1660 sp=0xc020be1610 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be16b0 sp=0xc020be1660 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1700 sp=0xc020be16b0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be17c0 sp=0xc020be1700 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be1898 sp=0xc020be17c0 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be18e8 sp=0xc020be1898 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1938 sp=0xc020be18e8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1988 sp=0xc020be1938 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be1a48 sp=0xc020be1988 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be1b20 sp=0xc020be1a48 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be1b70 sp=0xc020be1b20 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1bc0 sp=0xc020be1b70 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1c10 sp=0xc020be1bc0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be1cd0 sp=0xc020be1c10 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be1da8 sp=0xc020be1cd0 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be1df8 sp=0xc020be1da8 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1e48 sp=0xc020be1df8 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be1e98 sp=0xc020be1e48 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be1f58 sp=0xc020be1e98 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be2030 sp=0xc020be1f58 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2080 sp=0xc020be2030 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be20d0 sp=0xc020be2080 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2120 sp=0xc020be20d0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be21e0 sp=0xc020be2120 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be22b8 sp=0xc020be21e0 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2308 sp=0xc020be22b8 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2358 sp=0xc020be2308 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be23a8 sp=0xc020be2358 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be2468 sp=0xc020be23a8 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be2540 sp=0xc020be2468 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2590 sp=0xc020be2540 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be25e0 sp=0xc020be2590 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2630 sp=0xc020be25e0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be26f0 sp=0xc020be2630 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be27c8 sp=0xc020be26f0 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2818 sp=0xc020be27c8 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2868 sp=0xc020be2818 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be28b8 sp=0xc020be2868 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be2978 sp=0xc020be28b8 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be2a50 sp=0xc020be2978 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2aa0 sp=0xc020be2a50 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2af0 sp=0xc020be2aa0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2b40 sp=0xc020be2af0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be2c00 sp=0xc020be2b40 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be2cd8 sp=0xc020be2c00 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2d28 sp=0xc020be2cd8 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2d78 sp=0xc020be2d28 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be2dc8 sp=0xc020be2d78 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be2e88 sp=0xc020be2dc8 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be2f60 sp=0xc020be2e88 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be2fb0 sp=0xc020be2f60 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be3000 sp=0xc020be2fb0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be3050 sp=0xc020be3000 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be3110 sp=0xc020be3050 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be31e8 sp=0xc020be3110 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be3238 sp=0xc020be31e8 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be3288 sp=0xc020be3238 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be32d8 sp=0xc020be3288 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2541 +0x103 fp=0xc020be3398 sp=0xc020be32d8 pc=0x653803
github.com/traefik/yaegi/interp.getExec(...)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2503
github.com/traefik/yaegi/interp._select(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:3500 +0x29b fp=0xc020be3470 sp=0xc020be3398 pc=0x6a4d9b
github.com/traefik/yaegi/interp.setExec.func1(0xc0004b9560)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2538 +0xb6 fp=0xc020be34c0 sp=0xc020be3470 pc=0x6e6d96
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c26c0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be3510 sp=0xc020be34c0 pc=0x6e6f42
github.com/traefik/yaegi/interp.setExec.func1(0xc0004c27e0)
	/root/go/pkg/mod/github.com/traefik/[email protected]/interp/cfg.go:2527 +0x262 fp=0xc020be3560 sp=0xc020be3510 pc=0x6e6f42
exit status 2

Yaegi Version

0.10.0

Additional Notes

No response

Cylkal avatar Oct 19 '21 09:10 Cylkal

Another use case to consider. Running any source.zip file with a vendored directory will throw this same error. This code works if I remove all vendored packages and only use the stdlb as well a set the GoPath to the build package default.

package main

import (
	"archive/zip"
	"fmt"

	"github.com/traefik/yaegi/interp"
	"github.com/traefik/yaegi/stdlib"
	"github.com/traefik/yaegi/stdlib/unsafe"
)

func main() {
	fmt.Println("loading source file")

	zipfile := "./source.zip"

	zf, err := zip.OpenReader(zipfile)
	if err != nil {
		fmt.Println(err)
	}

	fmt.Println("generating options")
	options := interp.Options{
		GoPath:               "./source/",
		SourcecodeFilesystem: &zf.Reader,
	}

	fmt.Println("loading interp")
	i := interp.New(options)

	fmt.Println("loading stdlb")
	if err := i.Use(stdlib.Symbols); err != nil {
		fmt.Println(err)
	}
[source.zip](https://github.com/traefik/yaegi/files/7490992/source.zip)

	if err := i.Use(interp.Symbols); err != nil {
		fmt.Println(err)
	}

	if err := i.Use(unsafe.Symbols); err != nil {
		fmt.Println(err)
	}

	fmt.Println("evaluating source")
	_, err = i.EvalPath(`./source/`)
	if err != nil {
		fmt.Println(err)
	}
}

charles-d-burton avatar Nov 06 '21 17:11 charles-d-burton