mirror of
https://github.com/tufanbarisyildirim/gonginx.git
synced 2026-04-27 00:35:51 +03:00
[GH-ISSUE #31] gonginx does not seem to catch syntax errors in nginx.conf #14
Labels
No labels
bug
enhancement
good first issue
pull-request
question
v2
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gonginx#14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kehoecj on GitHub (Dec 12, 2023).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/31
Originally assigned to: @tufanbarisyildirim on GitHub.
We were hoping to use gonginx in the config-file-validator tool to provide syntax validation for
nginx.conffiles. During some testing we noticed that gonginx will not throw an error if the syntax of thenginx.conffile is invalid. For example, in this test we intentionally did not close a server block and it parsed without error.Is this expected behavior, a bug, or are we parsing incorrectly?
@kehoecj commented on GitHub (Dec 14, 2023):
@tufanbarisyildirim any ideas?
@tufanbarisyildirim commented on GitHub (Dec 14, 2023):
Hello @kehoecj , sorry I have missed this, this looks like an interesting bug, thanks for raising it. I will be back here around weekend.
@tufanbarisyildirim commented on GitHub (Dec 14, 2023):
Honestly, I didn't expect it to be utilized so extensively, and I absolutely enjoy the BUGS that can offer opportunities to reshape the core logic.
DEAL
@tufanbarisyildirim commented on GitHub (Dec 15, 2023):
Hello @kehoecj can you please try to see if that version helps you? https://github.com/tufanbarisyildirim/gonginx/tree/v2
That was a simple workaround, I will release a version for you that you can stick with and then jump in refactoring it.
@onlineque commented on GitHub (Dec 21, 2023):
Hi @tufanbarisyildirim,
thanks a lot for the fix, now the missing eof in block seems to be catched properly.
But when I feed the config with some nonsense keyword like "listena" in this example:
The gonginx says it's valid. But it's not. Testing with nginx -t -c nginx-bad-2.conf gives me expected:
Is it something what can be fixed, too ?
Thanks !
@tufanbarisyildirim commented on GitHub (Dec 21, 2023):
oh hmm, that's an easy one I will add directive validation as well but it actually does not suppose to validate logically because nginx -t can also check the files, permissions etc, but still a good star to add directive validation, will add it.
@tufanbarisyildirim commented on GitHub (Dec 21, 2023):
give it a test!
@onlineque commented on GitHub (Dec 22, 2023):
That's perfect, it works ! May I ask you to release a version for us ? Thanks a lot !
@tufanbarisyildirim commented on GitHub (Dec 22, 2023):
sure: https://github.com/tufanbarisyildirim/gonginx/releases/tag/2.0.0
@onlineque commented on GitHub (Dec 23, 2023):
I think we can close this issue, it's good enough at least for now ;-) Once again thanks a lot for your help, @tufanbarisyildirim !
@tufanbarisyildirim commented on GitHub (Dec 23, 2023):
You are welcome, happy to help. will keep this version as base of v2.x.x, thanks for pointing out issues.