Skip to content

dockerfile/linter: check for nil linter in linter functions#4996

Merged
tonistiigi merged 1 commit intomoby:masterfrom
jsternberg:linter-nilcheck
Jun 5, 2024
Merged

dockerfile/linter: check for nil linter in linter functions#4996
tonistiigi merged 1 commit intomoby:masterfrom
jsternberg:linter-nilcheck

Conversation

@jsternberg
Copy link
Collaborator

@jsternberg jsternberg commented Jun 5, 2024

During parsing, the linter can be nil and linter rules won't succeed at running due to a nil dereference. Instead of checking for nil everywhere, this modifies the linter to automatically disable itself if the linter is nil.

Fixes a nil dereference panic happening when parsing ENV and LABEL commands without a linter introduced by
6cfa459.

An alternative to #4984.

@jsternberg jsternberg requested review from tonistiigi and vvoland June 5, 2024 15:53
}
name, value, sep := args[j], args[j+1], args[j+2]
if sep == "" {
if lint != nil && sep == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks inconsistent with other lines

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. It wasn't near the other ones so I didn't see it.

During parsing, the linter can be nil and linter rules won't succeed at
running due to a nil dereference. Instead of checking for nil
everywhere, this modifies the linter to automatically disable itself if
the linter is nil.

Fixes a nil dereference panic happening when parsing `ENV` and `LABEL`
commands without a linter introduced by
6cfa459.

Co-authored-by: Paweł Gronowski <[email protected]>
Signed-off-by: Jonathan A. Sternberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants