-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove AclMatchedName from ACL::ParseAclLine() #239
Remove AclMatchedName from ACL::ParseAclLine() #239
Conversation
The “ugly” use of AclMatchedName global supplied ACL name to error reporting during ACL (re)configuration. To solve this problem, we could pass ACL::name to the reporting code. This, however, is difficult because reporting code is located in stateless functions, such as aclDomainCompare() or acl_ip_data::NetworkCompare() without access to ACL::name. Another approach (implemented in this PR) is to reuse CodeContext concept for ACLs: the name of the ACL being parsed is appended to those debugs() automatically by CodeContext infrastructure.
to avoid noise when reporting context.
so that each parser (e.g., ACL::ParseAclLine()) could configure its context accordingly. Also configure ACL code context as early as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (up to a0bda44).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent progress, thank you!
that helped to undo the problematic cache_cf.cc context adjustments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (up to 504788).
@@ -0,0 +1 @@ | |||
expect-message WARNING:.*is.a.subrange.of.*Because.of.this.*isignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a simple way to catch mismatching instruction files
If we are going to keep to the "bad-" for negative tests, we can require that each "bad-" had an instruction file - that should be easy to adjust, I think. If positive tests (i.e., all other ones) do not need instruction files, then we can also prohibit such files for them.
test-suite/test-squid-conf.sh
Outdated
@@ -99,6 +94,12 @@ then | |||
exit 0; | |||
fi | |||
|
|||
if ! grep -q "# *define *\b$defineName\b $defineValue" $autoconfHeader | |||
then | |||
echo "$here: WARNING: Skipping $configFile test because $defineName is not $defineValue in $autoconfHeader"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that we want to keep the second parameter (i.e. $p2
and $defineValue
) optional (rather than require it in all use cases).
There are similar official tests added at 0898d0.
After merge new tests became broken because some of them contained duplicated lines in '*.instructions' files. This happened because the uniqueness of these lines was previously ensured by adding a unique ACL name to each of them. This is not possible now because we removed AclMatchedName from parsing code). I had to adjust ACLs to make debugging unique without ACL name addition.
It was especially wrong to make that responsibility a secret. TODO: Do not hide c-string-to-SBuf conversion.
The function does not parse contexts. It calls some parser inside the given (parsing) context.
... addressing an earlier branch commit TODO.
... except where a single acl directive emits more than one warning.
This PR became official PR 1642. |
The “ugly” use of AclMatchedName global supplied ACL name to error
reporting during ACL (re)configuration. To solve this problem, we could
pass ACL::name to the reporting code. This, however, is difficult
because the reporting code is located in stateless functions, such as
aclDomainCompare() or acl_ip_data::NetworkCompare() without access to
ACL::name.
Another approach (implemented in this PR) is to reuse CodeContext
concept for ACLs: the name of the ACL being parsed is appended to those
debugs() automatically by CodeContext infrastructure.