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

regression: Panic when referencing an undefined output format #9530

Closed
deining opened this issue Feb 18, 2022 · 2 comments · Fixed by #9540
Closed

regression: Panic when referencing an undefined output format #9530

deining opened this issue Feb 18, 2022 · 2 comments · Fixed by #9540

Comments

@deining
Copy link
Contributor

deining commented Feb 18, 2022

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

$ hugo version
hugo v0.92.2-CDF6A0D6+extended windows/amd64 BuildDate=2022-02-11T14:17:39Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes.

How to reproduce:

  • Create a new hugo site and enter newly created directory:
hugo new site issue_9530
cd issue_9530
  • Append a reference to a non existing output format at the end of config.toml, :
cat >> config.toml <<EOL
[outputs]
section = 'not_defined_yet'
EOL
  • Invoke hugo and it will panic:
hugo
Total in 1 ms
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x40 pc=0x1711148]

goroutine 1 [running]:
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig.func3()
        /root/project/hugo/commands/commandeer.go:426 +0x588
sync.(*Once).doSlow(0x23e8190, 0x1eb181b)
        /usr/local/go/src/sync/once.go:68 +0xd2
sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:59
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0xc0004201e0)
        /root/project/hugo/commands/commandeer.go:377 +0x8a5
github.com/gohugoio/hugo/commands.newCommandeer(0x1, 0x1, 0x0, 0xc0000da0e0, {0x2396080, 0xc0003d6940}, 0xc0003d6af0, {0x0, 0x0, 0x0})
        /root/project/hugo/commands/commandeer.go:195 +0x310
github.com/gohugoio/hugo/commands.initializeConfig(0x2, 0x0, 0x0, 0xc0006ffd18, {0x2396080, 0xc0003d6940}, 0xc0004d74a0)
        /root/project/hugo/commands/hugo.go:125 +0x31
github.com/gohugoio/hugo/commands.(*commandsBuilder).newHugoCmd.func1(0xc0004d2f00, {0x1e5ea46, 0x0, 0x0})
        /root/project/hugo/commands/commands.go:166 +0x155
github.com/spf13/cobra.(*Command).execute(0xc0004d2f00, {0xc00006e1e0, 0x0, 0x0})
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004d2f00)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/gohugoio/hugo/commands.Execute({0xc00006e1e0, 0x0, 0x0})
        /root/project/hugo/commands/hugo.go:92 +0xb4
main.main()
        /root/project/hugo/main.go:23 +0x58

Note this is somehow related to a discussion on hugo's dicscourse forum started a month ago.

@jmooring
Copy link
Member

With f7bc4cc and earlier:

Error: from config: failed to resolve output format "not_defined_yet" from site config

With a2a660e and later:

panic: runtime error: invalid memory address or nil pointer dereference

Similar to #9518

@jmooring jmooring changed the title Panic when referencing an undefined output format regression: Panic when referencing an undefined output format Feb 19, 2022
bep added a commit to bep/hugo that referenced this issue Feb 21, 2022
And now with a proper server test.

Fixes gohugoio#9518
Fixes gohugoio#9530
Fixes gohugoio#9539
bep added a commit to bep/hugo that referenced this issue Feb 21, 2022
And now with a proper server test.

Fixes gohugoio#9518
Fixes gohugoio#9530
Fixes gohugoio#9539
@bep bep closed this as completed in #9540 Feb 21, 2022
bep added a commit that referenced this issue Feb 21, 2022
And now with a proper server test.

Fixes #9518
Fixes #9530
Fixes #9539
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants