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

Add support for upcoming logger 1.4.3 #9392

Merged
merged 1 commit into from Aug 12, 2023
Merged

Conversation

kou
Copy link
Contributor

@kou kou commented Jun 25, 2023

This is a 🙋 feature or enhancement.

Summary

logger 1.4.3 will have ruby/logger#85. It initializes a new instance variable in Logger#initialize. Jekyll::Stevenson < ::Logger doesn't use super. So the new instance variable isn't initialized in Jekyll::Stevenson. And it causes an exception:

/tmp/local/lib/ruby/3.3.0+0/logger.rb:385:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @level
                   ^^^^^^^^^^^^^^^
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/configuration.rb:143:in `config_files'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll.rb:118:in `configuration'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/command.rb:44:in `configuration_from_options'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/commands/serve.rb:83:in `block (2 levels) in init_with_program'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/exe/jekyll:15:in `<top (required)>'
	from /tmp/local/bin/jekyll:25:in `load'
	from /tmp/local/bin/jekyll:25:in `<top (required)>'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli/exec.rb:58:in `load'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli/exec.rb:58:in `kernel_load'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli/exec.rb:23:in `run'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli.rb:492:in `exec'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli.rb:34:in `dispatch'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli.rb:28:in `start'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/libexec/bundle:37:in `block in <top (required)>'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/libexec/bundle:29:in `<top (required)>'
	from /tmp/local/bin/bundle:25:in `load'
	from /tmp/local/bin/bundle:25:in `<main>'

How about using super instead of implementing our Jekyll::Stevenson#initialize to reduce maintenance cost?

Context

Note that logger 1.4.3 isn't released yet. So normal users aren't got this error yet. But normal users will get this error if logger 1.4.3 is released and we don't have a fix for this problem.

logger 1.4.3 will have ruby/logger#85. It initializes a new instance
variable in `Logger#initialize`. `Jekyll::Stevenson < ::Logger`
doesn't use `super`. So the new instance variable isn't initialized in
`Jekyll::Stevenson`. And it causes an exception:

```text
/tmp/local/lib/ruby/3.3.0+0/logger.rb:385:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @Level
                   ^^^^^^^^^^^^^^^
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/configuration.rb:143:in `config_files'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll.rb:118:in `configuration'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/command.rb:44:in `configuration_from_options'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/lib/jekyll/commands/serve.rb:83:in `block (2 levels) in init_with_program'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/jekyll-4.3.2/exe/jekyll:15:in `<top (required)>'
	from /tmp/local/bin/jekyll:25:in `load'
	from /tmp/local/bin/jekyll:25:in `<top (required)>'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli/exec.rb:58:in `load'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli/exec.rb:58:in `kernel_load'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli/exec.rb:23:in `run'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli.rb:492:in `exec'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli.rb:34:in `dispatch'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/cli.rb:28:in `start'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/libexec/bundle:37:in `block in <top (required)>'
	from /tmp/local/lib/ruby/3.3.0+0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /tmp/local/lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/libexec/bundle:29:in `<top (required)>'
	from /tmp/local/bin/bundle:25:in `load'
	from /tmp/local/bin/bundle:25:in `<main>'
```

How about using `super` instead of implementing our
`Jekyll::Stevenson#initialize` to reduce maintenance cost?
@parkr
Copy link
Member

parkr commented Aug 12, 2023

@jekyllbot: merge +fix

@jekyllbot jekyllbot merged commit e57c755 into jekyll:master Aug 12, 2023
11 checks passed
jekyllbot added a commit that referenced this pull request Aug 12, 2023
github-actions bot pushed a commit that referenced this pull request Aug 12, 2023
Sutou Kouhei: Add support for upcoming logger 1.4.3 (#9392)

Merge pull request 9392
@kou kou deleted the logger-1.4.3 branch August 13, 2023 01:01
white-gecko added a commit to AKSW/jekyll-rdf that referenced this pull request Nov 13, 2023
parkr pushed a commit that referenced this pull request Dec 28, 2023
@parkr parkr added the backport-candidate Consider for merge into an older stable branch label Dec 28, 2023
parkr pushed a commit that referenced this pull request Dec 28, 2023
parkr added a commit that referenced this pull request Dec 28, 2023
Backport logger-1.4.3 from #9392 to 3.9-stable
benknoble added a commit to benknoble/benknoble.github.io that referenced this pull request Apr 22, 2024
This updates Jekyll to include
jekyll/jekyll#9392.

Without this update, `make` produces

To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
jekyll 4.2.0 | Error:  undefined method `[]' for nil
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)

    @level_override[Fiber.current] || @Level
                   ^^^^^^^^^^^^^^^
        from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.2.0/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'
        from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.2.0/lib/jekyll/configuration.rb:143:in `config_files'
        from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.2.0/lib/jekyll.rb:118:in `configuration'
        from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:44:in `configuration_from_options'
        from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:83:in `block (2 levels) in init_with_program'
        from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        from /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
        from /usr/local/lib/ruby/gems/3.3.0/bin/jekyll:25:in `load'
        from /usr/local/lib/ruby/gems/3.3.0/bin/jekyll:25:in `<top (required)>'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `load'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/cli.rb:451:in `exec'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/cli.rb:34:in `dispatch'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/cli.rb:28:in `start'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.4/exe/bundle:28:in `block in <top (required)>'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/bundler-2.5.4/exe/bundle:20:in `<top (required)>'
        from /usr/local/opt/ruby/bin/bundle:25:in `load'
        from /usr/local/opt/ruby/bin/bundle:25:in `<main>'

Googling suggested that downgrading ruby would work, but Jekyll release
notes (and a hint from apache/arrow-site#451)
suggested the real fix: upgrade Jekyll.

The new warning about the csv module is waiting on a backport release
from Jekyll.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-candidate Consider for merge into an older stable branch bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants