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

hugo --minify causes panic #5261

Closed
rdegges opened this issue Sep 28, 2018 · 3 comments · Fixed by #5370
Closed

hugo --minify causes panic #5261

rdegges opened this issue Sep 28, 2018 · 3 comments · Fixed by #5370

Comments

@rdegges
Copy link
Contributor

rdegges commented Sep 28, 2018

Hi there!

I'm building a simple Hugo blog. I've got it working great when I build it using the hugo command, but if I try to run hugo --minify I get a panic.

Here's some output

$ hugo         

                   |  EN   
+------------------+------+
  Pages            |  467  
  Paginator pages  |   16  
  Non-page files   |    0  
  Static files     | 1554  
  Processed images |    0  
  Aliases          |    1  
  Sitemaps         |    1  
  Cleaned          |    0

vs

$ hugo --minify
Building sites … panic: runtime error: slice bounds out of range

goroutine 132 [running]:
github.com/tdewolff/minify/html.(*Minifier).Minify(0xc000574f50, 0xc000870db0, 0x1132740, 0xc00018df80, 0x1132720, 0xc000c8bc00, 0x0, 0x0, 0x0)
        /go/pkg/mod/github.com/tdewolff/[email protected]+incompatible/html/html.go:92 +0x505f
github.com/tdewolff/minify.Minifier.Minify-fm(0xc000870db0, 0x1132740, 0xc00018df80, 0x1132720, 0xc000c8bc00, 0x0, 0x1135300, 0x1132720)
        /go/pkg/mod/github.com/tdewolff/[email protected]+incompatible/minify.go:114 +0x72
github.com/tdewolff/minify.MinifierFunc.Minify(0xc002cce780, 0xc000870db0, 0x1132740, 0xc00018df80, 0x1132720, 0xc000c8bc00, 0x0, 0xc00169ad00, 0xc000b7b580)
        /go/pkg/mod/github.com/tdewolff/[email protected]+incompatible/minify.go:29 +0x65
github.com/gohugoio/hugo/minifiers.Client.Transformer.func1(0x1136340, 0xc003455ae0, 0xc00018df80, 0x6bf1)
        /root/project/hugo/minifiers/minifiers.go:53 +0xde
github.com/gohugoio/hugo/transform.(*Chain).Apply(0xc000b7b780, 0x1132740, 0xc0009d01c0, 0x1132720, 0xc000c56b60, 0x0, 0x0)
        /root/project/hugo/transform/chain.go:105 +0x1c4
github.com/gohugoio/hugo/publisher.DestinationPublisher.Publish(0x1149340, 0xc0002c4bc0, 0x1, 0xc000870db0, 0x1132720, 0xc000c56b60, 0xefe96c, 0x4, 0xeffce0, 0x4, ...)
        /root/project/hugo/publisher/publisher.go:100 +0x36e
github.com/gohugoio/hugo/hugolib.(*Site).renderAndWritePage(0xc00026e000, 0xc0001e17d0, 0xc000af2230, 0x42, 0xc001c983c0, 0x51, 0xc002438500, 0xc00163c200, 0x10, 0x10, ...)
        /root/project/hugo/hugolib/site.go:1728 +0x300
github.com/gohugoio/hugo/hugolib.pageRenderer(0xc00026e000, 0xc0008d2300, 0xc0008d22a0, 0xc00165cc60)
        /root/project/hugo/hugolib/site_render.go:167 +0x71c
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
        /root/project/hugo/hugolib/site_render.go:41 +0x153

The source for my site can be found at: https://github.com/oktadeveloper/okta-blog

@bep
Copy link
Member

bep commented Sep 28, 2018

It would help us a lot if you could register this issue also at:

https://github.com/tdewolff/minify/issues

I quickly scanned the code where the stack trace points, and this looks to be related to conditional IE statements.

@bep bep added this to the v0.50 milestone Sep 28, 2018
@bep bep modified the milestones: v0.50, v0.51 Oct 6, 2018
@moorereason moorereason modified the milestones: v0.51, v0.50 Oct 13, 2018
@moorereason
Copy link
Contributor

This issue has been fixed upstream, but it isn't in a tagged release yet. Current release is v2.3.5.

@bep bep added the Upstream label Oct 26, 2018
@bep bep closed this as completed in 83c873f Oct 26, 2018
@bep bep reopened this Oct 26, 2018
bep added a commit to bep/hugo that referenced this issue Oct 28, 2018
bep added a commit to bep/hugo that referenced this issue Oct 29, 2018
@bep bep closed this as completed in #5370 Oct 29, 2018
bep added a commit that referenced this issue Oct 29, 2018
@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 Feb 24, 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.

3 participants