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 panics when running with -s exampleSite in v0.123.x #12141

Closed
markdumay opened this issue Feb 24, 2024 · 3 comments · Fixed by #12170
Closed

Hugo panics when running with -s exampleSite in v0.123.x #12141

markdumay opened this issue Feb 24, 2024 · 3 comments · Fixed by #12170

Comments

@markdumay
Copy link

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

hugo v0.123.3-a75a659f6fc0cb3a52b2b2ba666a81f79a459376+extended darwin/arm64 BuildDate=2024-02-23T17:09:20Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes

Context

When upgrading Hugo from v0.122.0 to v0.123.3 I get a Hugo panic. Below the full error logs (specific to the mod-leaflet module):

Full logs
Start building sites … 
hugo v0.123.3-a75a659f6fc0cb3a52b2b2ba666a81f79a459376+extended darwin/arm64 BuildDate=2024-02-23T17:09:20Z VendorInfo=brew

panic: not supported [recovered]
	panic: interface conversion: string is not error: missing method Error

goroutine 25 [running]:
github.com/spf13/fsync.(*Syncer).syncRecover.func1()
	github.com/spf13/fsync@v0.10.0/fsync.go:132 +0xac
panic({0x104063b40?, 0x1044a48f0?})
	runtime/panic.go:770 +0x124
github.com/bep/overlayfs.(*Dir).Read(0x8000?, {0x104063bc0?, 0x14000749501?, 0x100966154?})
	github.com/bep/overlayfs@v0.9.1/overlayfs.go:391 +0x2c
io.copyBuffer({0x12ca25a00, 0x1400015ed00}, {0x12ca25a20, 0x1400015eee0}, {0x0, 0x0, 0x0})
	io/io.go:429 +0x18c
io.Copy(...)
	io/io.go:388
github.com/spf13/fsync.(*Syncer).sync(0x14000749d28, {0x14000a54140, 0xd}, {0x14000a54170, 0xd})
	github.com/spf13/fsync@v0.10.0/fsync.go:173 +0x588
github.com/spf13/fsync.(*Syncer).sync.func1({0x12c9c8760, 0x1400037a540})
	github.com/spf13/fsync@v0.10.0/fsync.go:199 +0xf0
github.com/spf13/fsync.withDirEntry({0x1044d39d8?, 0x1400000e030?}, {0x103eb7d28?, 0x200000003?}, 0x14000749b80)
	github.com/spf13/fsync@v0.10.0/fsync.go:343 +0x2a8
github.com/spf13/fsync.(*Syncer).sync(0x14000749d28, {0x103eb7d28, 0x1}, {0x103eb7d28, 0x1})
	github.com/spf13/fsync@v0.10.0/fsync.go:196 +0x2ac
github.com/spf13/fsync.(*Syncer).syncRecover(0x14000749d28?, {0x103eb7d28?, 0x1?}, {0x103eb7d28?, 0x1?})
	github.com/spf13/fsync@v0.10.0/fsync.go:136 +0x58
github.com/spf13/fsync.(*Syncer).Sync(0x14000749d28, {0x103eb7d28, 0x1}, {0x103eb7d28, 0x1})
	github.com/spf13/fsync@v0.10.0/fsync.go:111 +0xa0
github.com/gohugoio/hugo/commands.(*hugoBuilder).copyStaticTo(0x14000b93100, 0x14000754120)
	github.com/gohugoio/hugo/commands/hugobuilder.go:445 +0x1e4
github.com/gohugoio/hugo/commands.(*hugoBuilder).doWithPublishDirs(0x14000b93100, 0x14000749ef8)
	github.com/gohugoio/hugo/commands/hugobuilder.go:472 +0x13c
github.com/gohugoio/hugo/commands.(*hugoBuilder).copyStatic(0x140003fa960?)
	github.com/gohugoio/hugo/commands/hugobuilder.go:403 +0x34
github.com/gohugoio/hugo/commands.(*hugoBuilder).fullBuild.func2()
	github.com/gohugoio/hugo/commands/hugobuilder.go:507 +0x28
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x98

To reproduce

git clone https://github.com/gethinode/mod-leaflet.git
cd mod-leaflet
hugo mod vendor
hugo --gc --minify -s exampleSite

Notes

I'm transitioning the various modules maintained by gethinode to take advantage of work files (see gethinode/hinode#786), which might prevent this issue. Nevertheless, it seemed to make sense to submit this issue anyways.

@bep bep self-assigned this Feb 24, 2024
@bep bep added this to the v0.123.4 milestone Feb 24, 2024
@bep bep removed the NeedsTriage label Feb 24, 2024
@bep
Copy link
Member

bep commented Feb 24, 2024

OK, I have a failing test case for this now and I will fix this.

  [[module.imports.mounts]]
    source = "dist"
    target = "static"
  [[module.imports.mounts]]
    source = "dist/leaflet.scss"
    target = "static/leaflet.css"

My logic didn't handle the "double mounts" above and paniced when it tried to read the directory as a file. You can workaround this by ... removing the single file mount (and rename or copy the source file).

I have reimplemented and simplified the file mounts in Hugo, and I obviously missed some cases where the old code worked, but at least I can now understand my own code :-)

But I will fix, thanks for the report.

@bep bep added the v0.123.x label Feb 24, 2024
@markdumay
Copy link
Author

Thanks @bep!

I agree the “double” mounting is a bit odd. The module is basically wrapping an existing npm package to modularize it for Hugo. I was trying to avoid an additional npm script to rename/copy an existing dist file…

bep added a commit to bep/hugo that referenced this issue Feb 25, 2024
@bep bep modified the milestones: v0.123.4, v0.123.5 Feb 26, 2024
bep added a commit to bep/hugo that referenced this issue Feb 28, 2024
bep added a commit to bep/hugo that referenced this issue Feb 28, 2024
bep added a commit that referenced this issue Feb 28, 2024
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 21, 2024
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