-
Notifications
You must be signed in to change notification settings - Fork 8
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
test-lists with one element produce "Unrecognized command" error #47
Comments
This may seem like a bit of an edge case, as Incidentally, when playing with how parens are handled, it turns out that |
Thanks for the test case! This is obviously wrong. In v0.6, we have the following AST:
If I comment out the offending validation code, we see that the AST looks quite different in 0.7:
The second one is quite a big departure. It looks like this is fallout from issue #40, which aimed to support RFC 6558. This RFC added the notion of a "testable action", which is an action which doubles as an action and uses the result as a test. From the RFC:
However, it seems I neglected to adhere to the next paragraph, which states:
|
The above behavior is due to true / false being special-cased in the grammar (which is not great). Adhering to a strict interpretation of the RFCs as far as I can tell would mean not allowing parenthesis around individual tests (for grouping purposes, as opposed to define a test-list). My guess is that grouping parenthesis around a single test case is allowed as a sort of UI affordance, since some people may prefer to group their conditions similar to C-style syntax. Given that there are quite a few test-cases in RFCs that have grouping parenthesis, I'm leaning towards making this more lax. |
This fixes issue #47, which was a regression from attempting to allow the convert command to be used as a test. We now simply add the convert command to our test map to ensure it can be used that way. Additionally, we make a change to allow laxer usage of parenthesis. This is allowed by many (if not all) mail programs, since it is sometimes more readable to encapsulate an entire test in parenthesis.
This should be fixed now! And this also led me to discover a false positive test case (issue #48), so thank you! |
This fixes issue #47, which was a regression from attempting to allow the convert command to be used as a test. We now simply add the convert command to our test map to ensure it can be used that way. Additionally, we make a change to allow laxer usage of parenthesis. This is allowed by many (if not all) mail programs, since it is sometimes more readable to encapsulate an entire test in parenthesis.
If I have a test-list with a single element, check-sieve produces an "Unrecognized command" error for the test identifier. The only exceptions are for
true
andfalse
. Adding a second element fixes this, but shouldn't be necessary. The Sieve grammar defines a test-list as containing 1 or more tests, not 2 or more.It's also a bit surprising that the error says "Unrecognized command" instead of something like "unrecognized test".
This bug is new in version 0.7, version 0.6 accepts this syntax without comment. Version 0.6 also uses the correct "Unrecognized test" warning if I put an actual bogus test in there, as opposed to 0.7's "Unrecognized command".
Example:
This produces
Unrecognized command "not".
The text was updated successfully, but these errors were encountered: