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 #7195: Canonify in ncf doesn't work like cfengine does #237

Conversation

peckpeck
Copy link
Member

# to match cfengine behaviour we need to treat utf8 as if it was ascii (see #7195)
# python2 uses iso strings here, but python3 uses utf8
if sys.version_info[0] != 2:
string = string.encode("utf-8").decode("iso-8859-1")
Copy link
Member

Choose a reason for hiding this comment

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

isn't the iso-8859-1 dependant on the machine locale, or user input ?

Copy link
Member

Choose a reason for hiding this comment

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

this looks really dodgy to me to convert to ise-8859-1

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not dependent on the locale.
The "utf-8" is dependent on how ncf builder processes strings. And i'm pretty sure it is always utf8.
The "iso-8859-1" could be any 1 byte encoding, it is here to make sure python3 treats it as a string and not byte array so that we can apply a regex on it.

@ncharles
Copy link
Member

where are the unit tests ?

@peckpeck peckpeck force-pushed the bug_7195/canonify_in_ncf_doesn_t_work_like_cfengine_does branch from 3cac5a8 to c36a3c1 Compare September 24, 2015 13:40
@peckpeck
Copy link
Member Author

PR updated

@peckpeck peckpeck force-pushed the bug_7195/canonify_in_ncf_doesn_t_work_like_cfengine_does branch from c36a3c1 to cccdf22 Compare September 28, 2015 09:19
@peckpeck
Copy link
Member Author

PR updated

@VinceMacBuche
Copy link
Member

@peckpeck can you rebase your PR please ? :)

@peckpeck peckpeck force-pushed the bug_7195/canonify_in_ncf_doesn_t_work_like_cfengine_does branch from cccdf22 to 38bc4da Compare September 29, 2015 08:09
@peckpeck
Copy link
Member Author

PR updated

VinceMacBuche added a commit that referenced this pull request Sep 29, 2015
…t_work_like_cfengine_does

Fixes #7195: Canonify in ncf doesn't work like cfengine does
@VinceMacBuche VinceMacBuche merged commit ec2b811 into Normation:v0.x Sep 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants