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

Bugfix: Wrong filenames after includes in certain scenarios #95

Closed
wants to merge 3 commits into from

Conversation

pbitty
Copy link

@pbitty pbitty commented Mar 16, 2021

Proposed changes

This fixes a bug that occurs when an include exists in the middle of a file and Combine=True is set. The directives that appear after the include in the outer file will have the wrong filename on them, subject to the number of directives in the included file.

The failing test in the first commit exposes the bug. This bug was caused by a loop variable mutating the value of a variable by the same name in an outer scope.

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto master
  • I will ensure my PR is targeting the master branch and pulling from my branch from my own fork

This bug manifests itself when an include exists in the middle of a
file and `Combine=True` is set.  The directives that appear after the
include in the outer file will have the wrong filename on them, subject
to the number of directives in the included file.
The include-handling block in `_parse` had the loop variable `fname`
which was mutating the value of the outer `fname` variable from line 74.
By moving this to its own method, we make more clear which variables are
in the method's scope vs an outer scope.
@pbitty pbitty changed the title Bug: Output shows wrong filenames after includes in certain scenarios Bugfix: Wrong filenames after includes in certain scenarios Mar 16, 2021
@pbitty
Copy link
Author

pbitty commented Oct 25, 2021

Hello. Is anyone available to give some feedback on this? If I am not following the right process, please let me know.

@pbitty
Copy link
Author

pbitty commented Dec 3, 2021

Ping! :)

Is anyone around to give some feedback on this PR?

@defanator
Copy link
Contributor

Hi @pbitty - thanks for your PR. Indeed, this is a correct place to post any fixes around crossplane, so you're doing it right - no worries at all! Unfortunately, the project is a bit stalled nowadays - but we still use it as a part of NGINX Amplify, so any contributions, including bug fixes, are greatly valued. I hope to see some improvements on regular process of checking this and other Amplify-related public repositories for reports and issues; in the meantime, let me try to seek for appropriate resources to review your particular one.

Sorry for not being as responsive as we could, and thank you again for your attention.

@pbitty
Copy link
Author

pbitty commented Dec 6, 2021

Hi @defanator, no problem at all, I appreciate your response.

@pbitty pbitty closed this Nov 12, 2022
@pbitty pbitty deleted the bug/include_wrong_filename branch November 12, 2022 02:48
@pbitty pbitty restored the bug/include_wrong_filename branch December 19, 2022 18:30
@pbitty pbitty reopened this Dec 19, 2022
@pbitty pbitty closed this Aug 31, 2023
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.

2 participants