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

Fix uninitialized constant Parser::AST::Processor::Mixin #7030

Merged
merged 1 commit into from May 2, 2024

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Apr 26, 2024

Description

parser 3.3.1.0 introduced whitequark/parser#1000, which causes this failure:

% bundle exec ruby -Itest test/unit/profiles/profile_test.rb
inspec/lib/inspec/utils/profile_ast_helpers.rb:7:in `<class:CollectorBase>': uninitialized constant Parser::AST::Processor::Mixin (NameError)

        include Parser::AST::Processor::Mixin
                                      ^^^^^^^

Fix this by inherting from Parser::AST::Processor and requiring the right version of the parser gem.

Related Issue

Closes #7029

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@stanhu stanhu requested a review from a team as a code owner April 26, 2024 23:08
Copy link

netlify bot commented Apr 26, 2024

Deploy Preview for chef-inspec canceled.

Name Link
🔨 Latest commit d2ff553
🔍 Latest deploy log https://app.netlify.com/sites/chef-inspec/deploys/66317a4df4129600084e7ccd

inspec.gemspec Outdated Show resolved Hide resolved
parser 3.3.1.0 introduced
whitequark/parser#1000, which causes this
failure:

```
% bundle exec ruby -Itest test/unit/profiles/profile_test.rb
inspec/lib/inspec/utils/profile_ast_helpers.rb:7:in `<class:CollectorBase>': uninitialized constant Parser::AST::Processor::Mixin (NameError)

        include Parser::AST::Processor::Mixin
                                      ^^^^^^^
```

Fix this by inherting from `Parser::AST::Processor` instead.

Closes inspec#7029

Signed-off-by: Stan Hu <stanhu@gmail.com>
@aaronlippold
Copy link
Collaborator

What's the current work around for existing releases, like 6.6.0?

@stanhu
Copy link
Contributor Author

stanhu commented May 1, 2024

What's the current work around for existing releases, like 6.6.0?

Use parser v3.3.0.5.

@aaronlippold
Copy link
Collaborator

Aka throw that in the Gemfile of my profile? Working to fix my current pipeline while we wait on the patch.

@stanhu
Copy link
Contributor Author

stanhu commented May 1, 2024

Aka throw that in the Gemfile of my profile? Working to fix my current pipeline while we wait on the patch.

Yes, lock it down. 😄

@aaronlippold
Copy link
Collaborator

Cool, I will give that a try, or more specifically @wdower will :)

@ruairiquinn-bv
Copy link

What's the current work around for existing releases, like 6.6.0?

Use parser v3.3.0.5.

We tried this but without much success, any idea when this fix will be merged?

[2024-05-01T16:45:21.517Z] Fetching gem metadata from https://rubygems.org/........
[2024-05-01T16:45:22.032Z] Resolving dependencies....
[2024-05-01T16:45:22.032Z] Bundler could not find compatible versions for gem "parser":
[2024-05-01T16:45:22.032Z]   In Gemfile:
[2024-05-01T16:45:22.032Z]     parser (= 3.3.0.5)
[2024-05-01T16:45:22.032Z] 
[2024-05-01T16:45:22.032Z]     kitchen-inspec was resolved to 2.6.2, which depends on
[2024-05-01T16:45:22.032Z]       inspec (>= 2.2.64, < 6.0) was resolved to 5.22.40, which depends on
[2024-05-01T16:45:22.032Z]         cookstyle was resolved to 7.32.8, which depends on
[2024-05-01T16:45:22.032Z]           rubocop (= 1.25.1) was resolved to 1.25.1, which depends on\
[2024-05-01T16:45:22.032Z] rubocop-ast (>= 1.15.1, < 2.0) was resolved to 1.31.3, which depends
[2024-05-01T16:45:22.032Z] on
[2024-05-01T16:45:22.032Z]               parser (>= 3.3.1.0)

@ahasunos
Copy link
Contributor

ahasunos commented May 2, 2024

What's the current work around for existing releases, like 6.6.0?

Use parser v3.3.0.5.

We tried this but without much success, any idea when this fix will be merged?

[2024-05-01T16:45:21.517Z] Fetching gem metadata from https://rubygems.org/........
[2024-05-01T16:45:22.032Z] Resolving dependencies....
[2024-05-01T16:45:22.032Z] Bundler could not find compatible versions for gem "parser":
[2024-05-01T16:45:22.032Z]   In Gemfile:
[2024-05-01T16:45:22.032Z]     parser (= 3.3.0.5)
[2024-05-01T16:45:22.032Z] 
[2024-05-01T16:45:22.032Z]     kitchen-inspec was resolved to 2.6.2, which depends on
[2024-05-01T16:45:22.032Z]       inspec (>= 2.2.64, < 6.0) was resolved to 5.22.40, which depends on
[2024-05-01T16:45:22.032Z]         cookstyle was resolved to 7.32.8, which depends on
[2024-05-01T16:45:22.032Z]           rubocop (= 1.25.1) was resolved to 1.25.1, which depends on\
[2024-05-01T16:45:22.032Z] rubocop-ast (>= 1.15.1, < 2.0) was resolved to 1.31.3, which depends
[2024-05-01T16:45:22.032Z] on
[2024-05-01T16:45:22.032Z]               parser (>= 3.3.1.0)

It would be merged today!

@ahasunos ahasunos merged commit c9bb58e into inspec:main May 2, 2024
7 checks passed
ahasunos pushed a commit that referenced this pull request May 2, 2024
parser 3.3.1.0 introduced
whitequark/parser#1000, which causes this
failure:

```
% bundle exec ruby -Itest test/unit/profiles/profile_test.rb
inspec/lib/inspec/utils/profile_ast_helpers.rb:7:in `<class:CollectorBase>': uninitialized constant Parser::AST::Processor::Mixin (NameError)

        include Parser::AST::Processor::Mixin
                                      ^^^^^^^
```

Fix this by inherting from `Parser::AST::Processor` instead.

Closes #7029

Signed-off-by: Stan Hu <stanhu@gmail.com>
ahasunos added a commit that referenced this pull request May 2, 2024
parser 3.3.1.0 introduced
whitequark/parser#1000, which causes this
failure:

```
% bundle exec ruby -Itest test/unit/profiles/profile_test.rb
inspec/lib/inspec/utils/profile_ast_helpers.rb:7:in `<class:CollectorBase>': uninitialized constant Parser::AST::Processor::Mixin (NameError)

        include Parser::AST::Processor::Mixin
                                      ^^^^^^^
```

Fix this by inherting from `Parser::AST::Processor` instead.

Closes #7029

Signed-off-by: Stan Hu <stanhu@gmail.com>
Co-authored-by: Stan Hu <stanhu@gmail.com>
@stanhu
Copy link
Contributor Author

stanhu commented May 2, 2024

We tried this but without much success

It looks like rubocop-ast 1.31.3 was updated to require parser >= 3.3.1.0 (https://rubygems.org/gems/rubocop-ast) via rubocop/rubocop-ast#289.

Locking rubocop-ast to 1.31.2 and parser to 3.3.0.5 would be the current workaround.

@aaronlippold
Copy link
Collaborator

aaronlippold commented May 2, 2024 via email

@stanhu
Copy link
Contributor Author

stanhu commented May 2, 2024

@ahasunos I see there is a v6.6.19 tag with this change (9939b0d), but https://rubygems.org/gems/inspec still only shows 6.6.0 published. Do you know what it takes to publish this to RubyGems?

@ruairiquinn-bv
Copy link

We tried this but without much success

It looks like rubocop-ast 1.31.3 was updated to require parser >= 3.3.1.0 (https://rubygems.org/gems/rubocop-ast) via rubocop/rubocop-ast#289.

Locking rubocop-ast to 1.31.2 and parser to 3.3.0.5 would be the current workaround.

Thanks, that did the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uninitialized constant Parser::AST::Processor::Mixin with parser 3.3.1.0
4 participants