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

Fixes #5550: correct classes conditions when using quotes #123

Conversation

ncharles
Copy link
Member

No description provided.

@ncharles
Copy link
Member Author

@jooooooon could you review this please ?

@jooooooon
Copy link
Member

When fixing a bug in ncf, please always adjust the tests so that this bug can never come back.

Aside from that, the fix looks OK, but only applies to quotes. Is that deliberate? What about other cases that use the escape character? I think that CFEngine allows to escape any character, am I wrong?

@ncharles
Copy link
Member Author

it seems that only ' and " are escapable (according to my tests)

however, I have no idea on how to make these unit tests :/

@ncharles
Copy link
Member Author

ha, apparently, this doesn't report correctly, as CFEngine convert the ' to ' in the sent message...

@ncharles
Copy link
Member Author

ok, so canonify does canonify correctly \c to _c, and 'c to _c , but somehow our method to generate the .res seems to drop the \ in \c

@ncharles ncharles force-pushed the bug_5550/dev/wrong_canonification_of_quotes branch from 3803d26 to d295afd Compare September 20, 2014 06:33
@ncharles
Copy link
Member Author

I've updated the PR
I tried to make the tests, by modifiying test_expected_reports.csv, test_metadata.xml, test_technique.cf, but it failed with arcane error messages:
FAIL: test_parse_technique_generic_method_calls_strings (main.TestNcf)
Parsing a technique should return a list of it's generic method calls even if they are string literals

and

FAIL: test_parse_technique_generic_method_calls (main.TestNcf)
Parsing a technique should return a list of it's generic method calls

@ncharles ncharles force-pushed the bug_5550/dev/wrong_canonification_of_quotes branch from d295afd to 38429a5 Compare October 7, 2014 16:14
@ncharles
Copy link
Member Author

ncharles commented Oct 7, 2014

PR updated, with tests

@@ -271,7 +273,7 @@ def generate_rudder_reporting(technique):
method_name = method_call['method_name']
generic_method = generic_methods[method_name]

key_value = method_call["args"][generic_method["class_parameter_id"]-1]
key_value = method_call["args"][generic_method["class_parameter_id"]-1].replace("\\'", "\'").replace('\\"', '\"')
Copy link
Member

Choose a reason for hiding this comment

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

"'" is equivalent to "'" in python

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this one, you added 2 more backslash before and here you remove only one.

Copy link
Member Author

Choose a reason for hiding this comment

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

i guess this is not relevant anymore; we changed a lot of things around that (notably, we don't use bash anymore to generate the reporting file)

Copy link
Member

Choose a reason for hiding this comment

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

If this is not relevant, should we remove some or all of this PR ?

@ncharles
Copy link
Member Author

actually, this is still relevant :(

@ncharles ncharles closed this Aug 25, 2015
@ncharles
Copy link
Member Author

replaced by #223

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.

3 participants