ops icon indicating copy to clipboard operation
ops copied to clipboard

Panic on conflicted mapped dir name with program file

Open arknable opened this issue 3 years ago • 2 comments

panic: interface conversion: interface {} is string, not map[string]interface {}

goroutine 1 [running]:
github.com/nanovms/ops/fs.(*Manifest).AddFileTo(0xc00011c120, 0xc00011c0f0, 0xc000250390, 0x17, 0xc00024c000, 0x49, 0x0, 0x0)
	/home/arknable/Development/Project/nanovms/ops/fs/manifest.go:335 +0x867
github.com/nanovms/ops/fs.(*Manifest).AddFile(...)
	/home/arknable/Development/Project/nanovms/ops/fs/manifest.go:322
github.com/nanovms/ops/lepton.addMappedFiles.func1(0xc00024c000, 0x49, 0x2840300, 0xc0000d7520, 0x0, 0x0, 0x4ed1ce, 0xc0000d7520)
	/home/arknable/Development/Project/nanovms/ops/lepton/image.go:381 +0x450
path/filepath.walk(0xc00024c000, 0x49, 0x2840300, 0xc0000d7520, 0xc00069f058, 0x0, 0x0)
	/opt/go/src/path/filepath/path.go:414 +0x457
path/filepath.walk(0xc000666780, 0x3e, 0x2840300, 0xc0000d6d00, 0xc00069f058, 0x0, 0x0)
	/opt/go/src/path/filepath/path.go:438 +0x31b
path/filepath.walk(0xc0003b9180, 0x39, 0x2840300, 0xc0000d68f0, 0xc00069f058, 0x0, 0x6)
	/opt/go/src/path/filepath/path.go:438 +0x31b
path/filepath.Walk(0xc0003b9180, 0x39, 0xc00069f058, 0x5, 0x0)
	/opt/go/src/path/filepath/path.go:501 +0x113
github.com/nanovms/ops/lepton.addMappedFiles(0xc0003b9180, 0x3a, 0xc00048b940, 0x6, 0x2491cfe, 0x1, 0xc00011c120, 0x0, 0x6)
	/home/arknable/Development/Project/nanovms/ops/lepton/image.go:359 +0x16f
github.com/nanovms/ops/lepton.setManifestFromConfig(0xc00011c120, 0xc00069f478, 0x5, 0x0)
	/home/arknable/Development/Project/nanovms/ops/lepton/image.go:251 +0x234
github.com/nanovms/ops/lepton.BuildManifest(0xc00069f478, 0xc0004fe060, 0x487245, 0x0)
	/home/arknable/Development/Project/nanovms/ops/lepton/image.go:327 +0x2aa
github.com/nanovms/ops/lepton.BuildImage(0xc000074af0, 0x1, 0x1, 0x0, 0x0, 0xc000046450, 0x23, 0x0, 0x0, 0x0, ...)
	/home/arknable/Development/Project/nanovms/ops/lepton/image.go:30 +0x2f
github.com/nanovms/ops/onprem.(*OnPrem).BuildImage(0x37b9470, 0xc000074c00, 0x6, 0x284d340, 0x37b9470, 0xc000074c00)
	/home/arknable/Development/Project/nanovms/ops/onprem/onprem_image.go:17 +0x98
github.com/nanovms/ops/cmd.buildCommandHandler(0xc0002fd180, 0xc0002f3d40, 0x1, 0x3)
	/home/arknable/Development/Project/nanovms/ops/cmd/cmd_build.go:60 +0x2bb
github.com/spf13/cobra.(*Command).execute(0xc0002fd180, 0xc0002f3c80, 0x3, 0x3, 0xc0002fd180, 0xc0002f3c80)
	/home/arknable/Development/libs/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002fcf00, 0x0, 0xffffffff, 0xc0000421d8)
	/home/arknable/Development/libs/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x30b
github.com/spf13/cobra.(*Command).Execute(...)
	/home/arknable/Development/libs/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main()
	/home/arknable/Development/Project/nanovms/ops/ops.go:8 +0x2a

This occurred when I tried to map a folder using destination name that same as the program name:

{
  "MapDirs": {
    "/home/arknable/Development/Project/nanovms/example/hello/*": "/hello"
  }
}

and the program name is hello:

arknable@arknable-x1c:~/.../hello$ ls -l
total 40608
-rw-rw-r-- 1 arknable arknable      159 Jun 18 18:19 config.json
-rwxrwxr-x 1 arknable arknable 41573332 Mei 10 03:08 hello
-rw-rw-r-- 1 arknable arknable      239 Mei 29 17:55 hello.js

Probably better to output a human-readable message instead of panic ?

arknable avatar Jun 18 '21 11:06 arknable

@eyberg Please verify.

arknable avatar Jun 18 '21 11:06 arknable

yes

eyberg avatar Jun 18 '21 15:06 eyberg