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

Some issues introduced by the recent CLI/config rewrite #10953

Closed
13 tasks done
bep opened this issue May 18, 2023 · 24 comments
Closed
13 tasks done

Some issues introduced by the recent CLI/config rewrite #10953

bep opened this issue May 18, 2023 · 24 comments

Comments

@bep
Copy link
Member

bep commented May 18, 2023

List them and fix them here as I (we) find them:

  • In server, on error, the error page displays in the browser. But after resolving the error, I need to do a manual refresh of the browser; in "old Hugo" this happened automatically.
  • server sometimes panics when initial build fails
  • check publishDir vs -d
  • check --minify
  • check mainSections empty vs false/nil
  • handle old values in disableKinds (e.g. taxonomyTerm)
  • --printUnusedTemplates is gone.
  • --printPathWarnings is gone.
  • Odd data race sometimes in test (see below) on GitHub, linux.
  • check if description has been a site config option.
  • languages.en.markup.goldmark.extensions.typographer
  • hugo mod foo => Error: command error: unknown command "mod" for "hugo mod"
  • gen docshelper commands seem to be missing
WARNING: DATA RACE
            Write at 0x00c00028f120 by goroutine 61:
              github.com/gohugoio/hugo/deps.(*Deps).Init()
                  /home/runner/work/hugo/hugo/deps/deps.go:165 +0x1097
              github.com/gohugoio/hugo/hugolib.NewHugoSites()
                  /home/runner/work/hugo/hugo/hugolib/site_new.go:115 +0x469
              github.com/gohugoio/hugo/commands.(*rootCommand).HugFromConfig.func1()
                  /home/runner/work/hugo/hugo/commands/commandeer.go:314 +0x178
              github.com/bep/lazycache.(*Cache[...]).GetOrCreate()
                  /home/runner/go/pkg/mod/github.com/bep/lazycache@v0.2.0/lazycache.go:112 +0x2c5
              github.com/gohugoio/hugo/commands.(*rootCommand).HugFromConfig()
                  /home/runner/work/hugo/hugo/commands/commandeer.go:309 +0x9b
              github.com/gohugoio/hugo/commands.(*hugoBuilder).hugo()
                  /home/runner/work/hugo/hugo/commands/hugobuilder.go:923 +0x56
              github.com/gohugoio/hugo/commands.(*hugoBuilder).doWithPublishDirs()
                  /home/runner/work/hugo/hugo/commands/hugobuilder.go:481 +0x5c
              github.com/gohugoio/hugo/commands.(*hugoBuilder).copyStatic()
                  /home/runner/work/hugo/hugo/commands/hugobuilder.go:430 +0x4c
              github.com/gohugoio/hugo/commands.(*hugoBuilder).fullRebuild.func1()
                  /home/runner/work/hugo/hugo/commands/hugobuilder.go:616 +0x239
            
            Previous read at 0x00c00028f120 by goroutine 28:
              github.com/gohugoio/hugo/commands.(*fileServer).createEndpoint.func1.1()
                  /home/runner/work/hugo/hugo/commands/server.go:280 +0xeb2
              net/http.HandlerFunc.ServeHTTP()
                  /opt/hostedtoolcache/go/1.20.4/x64/src/net/http/server.go:2122 +0x4d
              net/http.(*ServeMux).ServeHTTP()
                  /opt/hostedtoolcache/go/1.20.4/x64/src/net/http/server.go:[250](https://github.com/gohugoio/hugo/actions/runs/5022658408/jobs/9006382452?pr=10964#step:17:251)0 +0xc5
              net/http.serverHandler.ServeHTTP()
                  /opt/hostedtoolcache/go/1.20.4/x64/src/net/http/server.go:2936 +0x682
              net/http.(*conn).serve()
                  /opt/hostedtoolcache/go/1.20.4/x64/src/net/http/server.go:1995 +0xbd4
              net/http.(*Server).Serve.func3()
                  /opt/hostedtoolcache/go/1.20.4/x64/src/net/http/server.go:3089 +0x58
@bep bep added the Bug label May 18, 2023
@bep bep added this to the v0.112.0 milestone May 18, 2023
@bep bep pinned this issue May 18, 2023
@khusika
Copy link

khusika commented May 18, 2023

This is what i got from your last changes @bep

  • hugo --minify broken
  • I can't use publishDir, but doing hugo -d targetdir is fine

@ghk-arolla
Copy link

ghk-arolla commented May 18, 2023

In server, on error, the error page displays in the browser. But after resolving the error, I need to do a manual refresh of the browser; in "old Hugo" this happened automatically.

Works fine here. Mac OSX Ventura 13.3.1. Brave (latest)

bep added a commit that referenced this issue May 18, 2023
@frjo
Copy link

frjo commented May 18, 2023

I use the mainSections param to decide what to list on the front page.

In hugo v0.111.3+extended this will set mainSections to empty and not list anything.

params:
  mainSections:

But in hugo v0.112.0-DEV-1155bbca9d4cdf42e9b4a2d0351fd5be0aa8ec08+extended darwin/amd64 BuildDate=2023-05-17T21:35:43Z you need to explicitly set it to false/empty.

params:
  mainSections: false

This might be more correct but it is a change from how it used to work.

I use it like this:

{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections -}}
{{ $paginator := .Paginate $pages -}}
{{ range $paginator.Pages -}}
{{ .Render "summary" }}
{{ end -}}

@ghk-arolla
Copy link

ghk-arolla commented May 18, 2023

Got an new error on an other site.

... the usual WARN about my params. No pb.
then this

Re-run Hugo with the flag --panicOnWarning to get a better error message.
Start building sites … 
hugo v0.112.0-DEV-1155bbca9d4cdf42e9b4a2d0351fd5be0aa8ec08+extended darwin/arm64 BuildDate=2023-05-17T21:35:43Z
ERROR 2023/05/18 14:08:02 render of "term" failed: "/Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html:15:37": execute of template failed: template: _default/list.html:15:37: executing "_default/list.html" at <first 1 .Params.images>: error calling first: both limit and seq must be provided
ERROR 2023/05/18 14:08:02 render of "term" failed: "/Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html:15:37": execute of template failed: template: _default/list.html:15:37: executing "_default/list.html" at <first 1 .Params.images>: error calling first: both limit and seq must be provided
ERROR 2023/05/18 14:08:02 render of "term" failed: "/Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html:15:37": execute of template failed: template: _default/list.html:15:37: executing "_default/list.html" at <first 1 .Params.images>: error calling first: both limit and seq must be provided
Error: error building site: render: failed to render pages: render of "term" failed: "/Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html:15:37": execute of template failed: template: _default/list.html:15:37: executing "_default/list.html" at <first 1 .Params.images>: error calling first: both limit and seq must be provided
Total in 5243 ms
2023/05/18 14:08:06 error building site: render: failed to render pages: render of "term" failed: "/Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html:15:37": execute of template failed: template: _default/list.html:15:37: executing "_default/list.html" at <first 1 .Params.images>: error calling first: both limit and seq must be provided

line 15 is : {{ range first 1 .Params.images }}

list.html

Details
{{ range .Data.Pages }}

                <article class="wow fadeInDown" data-wow-delay=".2s" data-wow-duration="500ms">

                    <div class="blog-post-image">
                        <a href="{{ .RelPermalink }}" title="default">
                            {{ range first 1 .Params.images }}
                                {{ with . }}
                                    {{ partial "image_asset.html" (dict "context" . "path" . "size" "x250" "action" "Resize") }}
                                {{ end }}
                            {{ end }}
                        </a>
                    </div>
                    <div class="blog-content">
                        <h2 class="blogpost-title">
                            <a href="{{ .RelPermalink }}" title="default">{{ .Title }}</a>
                        </h2>
                        <div class="blog-meta">
                            <span>{{ .Date | time.Format ":date_long" }}</span>
                            {{ with .Params.author }}<span>{{ i18n "par" }}
                                {{ . }}
                            </span>
                            {{ end }}
                            {{ with .Params.tags }}
                            <span>
                                {{ delimit . ", " }}
                            </span>
                            {{ end }}
                        </div>
                        <p>
                            {{ .Summary }}
                        </p>
                        {{ with .Permalink }}<a href="{{ . | relURL }}" class="btn btn-default btn-details hvr-bounce-to-right">{{ i18n "lire" }}</a>{{ end }}
                    </div>

                </article>

                {{ end }}

@divinerites
Copy link

Oh, forgot but this site works fine in latest official version. No "execute of template failed"

$ hugo
Start building sites … 
hugo v0.111.3+extended darwin/amd64 BuildDate=unknown

                   | FR   
-------------------+------
  Pages            |  16  
  Paginator pages  |   0  
  Non-page files   |   0  
  Static files     | 130  
  Processed images |  70  
  Aliases          |   2  
  Sitemaps         |   1  
  Cleaned          |   0  

Total in 5821 ms

bep added a commit to bep/hugo that referenced this issue May 18, 2023
bep added a commit to bep/hugo that referenced this issue May 18, 2023
@bep
Copy link
Member Author

bep commented May 18, 2023

@divinerites the {{ range first 1 .Params.images }} issue isn't obvious to me without additional context; you get that error if .Params.images is not set (which isn't new in this release), but why that is isn't something I can guess from a log.

bep added a commit to bep/hugo that referenced this issue May 18, 2023
bep added a commit that referenced this issue May 18, 2023
@divinerites
Copy link

divinerites commented May 18, 2023

@divinerites the {{ range first 1 .Params.images }} issue isn't obvious to me without additional context;

You have the template code in the previous comment. I can give you access to the repo if you need more context.

you get that error if .Params.images is not set (which isn't new in this release),

Well, there is no error in v0.111.3, so to me this is new in this release.

But the weird thing is :

  • Error on compilation : ERROR 2023/05/18 14:46:42 render of "term" failed: "/Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html:15:37": execute of template failed: template: _default/list.html:15:37: executing "_default/list.html" at <first 1 .Params.images>: error calling first: both limit and seq must be provided
    but

  • The referenced faulty template is unused (not in list of hugo --templateMetrics)

  • Output for hugo --printUnusedTemplates : WARN 2023/05/19 00:01:22 Template _default/list.html is unused, source file /Users/xxx/Documents/Git/osteo-timer/layouts/_default/list.html

So the error in hugo dev reference an unused template ???

@bep
Copy link
Member Author

bep commented May 19, 2023

Well, there is no error in v0.111.3, so to me this is new in this release.

@divinerites I don't doubt that, but it's just that I need to understand the what to be able to understand how fix it. My recent change set was pretty big (a rewrite of core parts of Hugo), so even if the test coverage in Hugo is pretty good, I was pretty sure that I would accidentally break some glass (which is why we're having this discussion, and I appreciate all the test help I'm getting here).

I'm not releasing anything until earliest mid next week I guess. If you could share the broken Site source with me somehow, could look at it (there's an email address on my GitHub profile, or you can PM me on the forum).

@divinerites
Copy link

If you could share the broken Site source

Invite sent. Let me know if i can test further ?

@bep
Copy link
Member Author

bep commented May 19, 2023

@divinerites OK, I see it now.

  • In your config, if you change disableKinds = ["taxonomy", "taxonomyTerm"] to => disableKinds = ["taxonomy", "term"], it works,.
  • We obviously had some legacy support for these values in earlier Hugo (we changed these values some moon ago). I will see if I can re-apply that logic.

@divinerites
Copy link

Confirmed working with disableKinds = ["taxonomy", "term"].

Stiil wondering why an unused template is parsed and make an error ... I guess it is hugo internal workflow.

Thanks A LOT for your hard work.

bep added a commit that referenced this issue May 19, 2023
@divinerites
Copy link

  • In your config, if you change disableKinds = ["taxonomy", "taxonomyTerm"] to => disableKinds = ["taxonomy", "term"], it works,.

Just FYI, I have an other site with this "old" syntax. But it pass fine. No error.

@bep
Copy link
Member Author

bep commented May 19, 2023

Stiil wondering why an unused template is parsed and make an error ... I guess it is hugo internal workflow.

No, that looks fishy ... I added it to my list above (something with the --printUnusedTemplates, but I don't think that's related...).

Just FYI, I have an other site with this "old" syntax. But it pass fine. No error.

Sure, the error was just a side-effect. The template code in question is buggy and needs an update (but that's not ... my problem).

bep added a commit to bep/hugo that referenced this issue May 19, 2023
bep added a commit to bep/hugo that referenced this issue May 19, 2023
bep added a commit to bep/hugo that referenced this issue May 19, 2023
bep added a commit that referenced this issue May 19, 2023
@divinerites
Copy link

divinerites commented May 19, 2023

Now, all my sites pass fine without any warn:error, and your last work on different --options works fine 🎆

bep added a commit to bep/hugo that referenced this issue May 19, 2023
By wrapping all use of the shared config in a lock.

Updates gohugoio#10953
bep added a commit to bep/hugo that referenced this issue May 19, 2023
By wrapping all use of the shared config in a lock.

Updates gohugoio#10953
bep added a commit to bep/hugo that referenced this issue May 19, 2023
By wrapping all use of the shared config in a lock.

Updates gohugoio#10953
bep added a commit that referenced this issue May 19, 2023
By wrapping all use of the shared config in a lock.

Updates #10953
@jmooring
Copy link
Member

jmooring commented May 19, 2023

Per comment on #10892, I expected (perhaps incorrectly) this to work:

[languages.en]
languageCode = 'en-US'
languageName = 'English'
weight = 1
[languages.en.markup.goldmark.extensions.typographer]
leftDoubleQuote = '&ldquo;'   # default &ldquo;
rightDoubleQuote = '&rdquo;'  # default &rdquo;

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 2
[languages.de.markup.goldmark.extensions.typographer]
leftDoubleQuote = '&laquo;'   # default &ldquo;
rightDoubleQuote = '&raquo;'  # default &rdquo;

@bep
Copy link
Member Author

bep commented May 19, 2023

Per comment on #10892 (comment), I expected (perhaps incorrectly) this to work:

And it ... didn't?

The goal was that the above should work, so I will check what happens.

@jmooring
Copy link
Member

It works if I also define an empty table:

[markup.goldmark.extensions.typographer]   # Adding this makes it work as expected

[languages.en]
languageCode = 'en-US'
languageName = 'English'
weight = 1
[languages.en.markup.goldmark.extensions.typographer]
leftDoubleQuote = '&ldquo;'   # default &ldquo;
rightDoubleQuote = '&rdquo;'  # default &rdquo;

[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 2
[languages.de.markup.goldmark.extensions.typographer]
leftDoubleQuote = '&laquo;'   # default &ldquo;
rightDoubleQuote = '&raquo;'  # default &rdquo;

@bep
Copy link
Member Author

bep commented May 20, 2023

@jmooring good catch, that would have been annoying ... I have pushed a fix.

@bep bep changed the title Some issues introduces by the recent CLI/config rewrite Some issues introduced by the recent CLI/config rewrite May 21, 2023
@divinerites
Copy link

divinerites commented May 21, 2023

Re : hugo list all : Found a difference in posts listing in my multi-language setup.
See #10972 (comment)

@bep
Copy link
Member Author

bep commented May 21, 2023

@divinerites yes, that was a little bit deliberate. I (or someone) need to revisit that hugo list and make all of them output more (and the same) amount of info, but that's not happening for this release.

bep added a commit that referenced this issue May 22, 2023
Also, always include the CSV header.

Updates #10953
@bep
Copy link
Member Author

bep commented May 22, 2023

@divinerites see #10977

@divinerites
Copy link

Great. I'll test it & report when merge is done. Thanks.

bep added a commit that referenced this issue May 22, 2023
Also, always include the CSV header.

Updates #10953
bep added a commit that referenced this issue May 22, 2023
Also, always include the CSV header.

Updates #10953
@divinerites
Copy link

divinerites commented May 22, 2023

@divinerites see #10977

Works as previous here. 👍

bep added a commit to bep/hugo that referenced this issue May 22, 2023
bep added a commit to bep/hugo that referenced this issue May 22, 2023
bep added a commit that referenced this issue May 22, 2023
bep added a commit that referenced this issue May 22, 2023
@bep bep closed this as completed May 23, 2023
@bep bep unpinned this issue May 23, 2023
@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 Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants