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

vhd inspect footer --path /path/to/disk.vhd panics! #11

Closed
colemickens opened this issue Mar 10, 2016 · 9 comments
Closed

vhd inspect footer --path /path/to/disk.vhd panics! #11

colemickens opened this issue Mar 10, 2016 · 9 comments
Assignees

Comments

@colemickens
Copy link
Contributor

$ go get github.com/Microsoft/azure-vhd-utils-for-go

$ azure-vhd-utils-for-go inspect footer /nix/store/igjb0w7jpjk43sxwk53l21mz118ivghn-azure-image/disk.vhd

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x18 pc=0x47ebbb]

goroutine 1 [running]:
text/template.(*Template).ExecuteTemplate(0x0, 0x7f4c059961e8, 0xc82003c010, 0x8859d0, 0xa, 0x7fae20, 0xc8200205a0, 0x0, 0x0)
    /nix/store/zfjn6abbd49iyiai3fnvdnxjkqjqwxxi-go-1.5.3/share/go/src/text/template/exec.go:117 +0x3b
main.showVhdFooter(0xc8200c8640)
    /home/cole/code/gopkgs/src/github.com/Microsoft/azure-vhd-utils-for-go/vhdInspectCmdHandler.go:164 +0x6d0
github.com/codegangsta/cli.Command.Run(0x879370, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8815b0, 0xf, 0x0, ...)
    /home/cole/code/gopkgs/src/github.com/codegangsta/cli/command.go:174 +0x1397
github.com/codegangsta/cli.(*App).RunAsSubcommand(0xc8200c83c0, 0xc8200c8280, 0x0, 0x0)
    /home/cole/code/gopkgs/src/github.com/codegangsta/cli/app.go:298 +0x11d4
github.com/codegangsta/cli.Command.startApp(0x879898, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8ccf60, 0x1d, 0x0, ...)
    /home/cole/code/gopkgs/src/github.com/codegangsta/cli/command.go:249 +0x74f
github.com/codegangsta/cli.Command.Run(0x879898, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8ccf60, 0x1d, 0x0, ...)
    /home/cole/code/gopkgs/src/github.com/codegangsta/cli/command.go:65 +0x79
github.com/codegangsta/cli.(*App).Run(0xc8200c8140, 0xc82000a0a0, 0x5, 0x5, 0x0, 0x0)
    /home/cole/code/gopkgs/src/github.com/codegangsta/cli/app.go:187 +0x1135
main.main()
    /home/cole/code/gopkgs/src/github.com/Microsoft/azure-vhd-utils-for-go/vhd.go:27 +0x2e0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /nix/store/zfjn6abbd49iyiai3fnvdnxjkqjqwxxi-go-1.5.3/share/go/src/runtime/asm_amd64.s:1721 +0x1
@anuchandy
Copy link
Member

@colemickens just confirming are you using the latest bits, there was bug in locating template path which i fixed. I just pulled the latest code and tried. It worked

If you have an older version then you might want to remove 'azure-vhd-utils-for-go' from GOPATH/src/Microsoft before "go getting" the latest.

@colemickens
Copy link
Contributor Author

I just destroyed my entire GOPATH and reran it. Still repros.

$ cd $GOPATH/src/github.com/Mirosoft/azure-vhd-utils-for-go

$ git log
[...]
commit f291a0767221c47a9413038b58a4bbfb3b62ab95
[...]
Date:   Sun Mar 6 21:22:04 2016 -0800
[...]

@anuchandy
Copy link
Member

@colemickens could you try this:

1] cd $GOPATH/src/github.com/Mirosoft/azure-vhd-utils-for-go
2] go build
3] ./azure-vhd-utils-for-go inspect footer /nix/store/igjb0w7jpjk43sxwk53l21mz118ivghn-azure-image/disk.vhd

@colemickens
Copy link
Contributor Author

Yup, that works.

@anuchandy
Copy link
Member

cool!
The issue is, when we do "go get azure-vhd-utils-for-go", it build the binary "azure-vhd-utils-for-go" and put it in "$GOPATH/bin". This binary is unable to locate the template path because it's relative in the source code.

@colemickens
Copy link
Contributor Author

Yup, I have a similar problem with one of my projects. I'm currently solving it by distributing the binary + template folder in a docker container and encouraging people to run it that way, but that feels heavy for a tool like this. The other thing I'd considered was just embedding the template files as string constants in my Go source code, but I'm not crazy about that idea either.

@colemickens
Copy link
Contributor Author

Thanks for the fast support!

@anuchandy
Copy link
Member

Thanks for sharing your experience, I guess in case of this tool - reasonable solution is to include template file content as string constants, I will do that.

Let me know if you come across better way of handling this.

@anuchandy anuchandy self-assigned this Mar 10, 2016
@anuchandy
Copy link
Member

closing, this issue is addressed by moving the templates to source file.

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

No branches or pull requests

2 participants