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

Not quoting fields in config.toml causes SIGSEGV #8773

Closed
CodingCellist opened this issue Jul 19, 2021 · 0 comments
Closed

Not quoting fields in config.toml causes SIGSEGV #8773

CodingCellist opened this issue Jul 19, 2021 · 0 comments
Labels
Milestone

Comments

@CodingCellist
Copy link

@CodingCellist CodingCellist commented Jul 19, 2021

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.85.0+extended linux/amd64 BuildDate=unknown

OS: Linux 5.12.17

Does this issue reproduce with the latest release?

AFAICT, v0.85.0 is the latest release, so yes.

Issue

Create a new hugo module with hugo mod init foo and set up the config.toml as follows:

[module]
  [[module.imports]]
    path = github.com/bar/baz

Then run hugo mod get.

Expected behaviour

Hugo reports a parse error because github.com/bar/baz needs to be quoted.

Observed behaviour

Hugo crashes with a runtime error caused by SIGSEGV

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4e010785b1e]

goroutine 1 [running]:
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0xc000529180, 0xc000520000, 0x4e0111e5238, 0xc000715de0)
	github.com/gohugoio/hugo/commands/commandeer.go:319 +0x45e
github.com/gohugoio/hugo/commands.newCommandeer(0x68c486eb0000, 0xc000528fc0, 0x4e0111e25d8, 0xc0007924b0, 0x0, 0x0, 0x0, 0x0, 0x98, 0x620004e01112aee0, ...)
	github.com/gohugoio/hugo/commands/commandeer.go:182 +0x267
github.com/gohugoio/hugo/commands.initializeConfig(0x4e010940000, 0xc000528fc0, 0x4e0111e25d8, 0xc0007924b0, 0x0, 0x4e00f44bd36, 0x4e010952b78, 0x5)
	github.com/gohugoio/hugo/commands/hugo.go:123 +0x78
github.com/gohugoio/hugo/commands.(*modCmd).initConfig(0xc0007924b0, 0x0, 0x4e01094e90a, 0x4, 0xc0005586e0)
	github.com/gohugoio/hugo/commands/mod.go:287 +0x65
github.com/gohugoio/hugo/commands.(*modCmd).withModsClient(0xc0007924b0, 0xc00087fc00, 0xc00087fc98, 0xc00056aa00, 0xc00087fce8)
	github.com/gohugoio/hugo/commands/mod.go:269 +0x3a
github.com/gohugoio/hugo/commands.(*commandsBuilder).newModCmd.func1(0xc0001e1680, 0x4e011de05a0, 0x0, 0x0, 0x0, 0x0)
	github.com/gohugoio/hugo/commands/mod.go:199 +0x245
github.com/spf13/cobra.(*Command).execute(0xc0001e1680, 0x4e011de05a0, 0x0, 0x0, 0xc0001e1680, 0x4e011de05a0)
	github.com/spf13/cobra@v1.1.3/command.go:852 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001edb80, 0xc000715c10, 0x5, 0x6)
	github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/gohugoio/hugo/commands.Execute(0xc00003c0a0, 0x2, 0x2, 0x4e00f2d40e5, 0xc0000a6058, 0x4e0107b29b0, 0x0)
	github.com/gohugoio/hugo/commands/hugo.go:90 +0xc5
main.main()
	github.com/gohugoio/hugo/main.go:23 +0x76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants