-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
UnicodeDecodeError in highstate outputter #16139
Comments
Thanks for the report. I was under the impression we had most of these unicode errors solved, but apparently not. We'll investigate this. |
Another error dump in-case it helps:
Is there any workaround for this? |
@basepi there is plenty of unsolved unicode errors: just add a non-ascii char in a state name and you'll see |
@mpaolini Why would you want to mention that in the docs? This is most certainly a bug IMHO, as it's unreasonable to expect unicode incompatibility across config files. Unicode support should be trivial. A colleague is running the same Salt setup as I am in the same project, and his is working whilst mine is not. The only difference is our host machines, his being Ubuntu and mine being Debian. I've torn-down and up'd our Vagrant machines a ton of times to no avail. Desperately hoping for a fix or workaround... |
@perry-mitchell I would mention it in the docs under known bugs. I am triying to cook a patch for fixing these issues but it won't be soon |
@mpaolini Muchly appreciated. Do you know what particular area is causing the problem here? |
@perry-mitchell mostly is A quick fix is to use Nevertheless this small change requires very thorough analysis of were these strings flow in the program and where they touch the outside world (a pipe, a file...) |
Yes, you would expect unicode support to be a solved problem. But that's the primary reason that Python3 exists, is because Python2 unicode support is....painful. Thanks for the updates, @mpaolini, I look forward to seeing your fix. |
Adding onto this. salt-minion 2014.1.13 (Hydrogen)
|
@kylegato exactly like the issue I found previously. The whole string formatting usage is just plain broken, and has nothing to do with py3 or py2 |
I've got similar issue:
|
@juangarciavargas that's a different issue. You don't seem to have (by the way: |
@mpaolini Great! thanks all good now. The problem started after I upgrade the minions to Freebsd10.1 |
So in what version is this (or will this be) fixed? |
The fix in #18376 is in 2014.7.1. |
The current implementation of sdecode loops through encodings, which cannot be a solution, and it even fails for Windows. Please use sys.stdin.encoding, as suggested in #19166. I would like to discuss why the encoding is not part of the grain or pillar. |
Running into this by just using a unicode char in a comment of a YAML/SLS on # RHEL7/CentOS7 ships the quite outdated systemd version 208
# The RedHat developer Lukáš Nykrýn provides a COPR with newer versions
{% if grains['os'] in ('RedHat', 'CentOS') %}
systemd-copr:
pkgrepo.managed:
- humanname: Builds of newer systemd versions for CentOS7/RHEL7
- baseurl: http://copr-be.cloud.fedoraproject.org/results/lnykryn/systemd/{{ repotype }}-{{ salt['grains.get']('osmajorrelease', 'unknown') }}-$basearch/
- gpgkey: https://copr-be.cloud.fedoraproject.org/results/lnykryn/systemd/pubkey.gpg
- gpgcheck: 1
- skip_if_unavailable: True
- enabled: 1
- order: 1
{% endif %}
OS: Ubuntu 14.04.2 Minion:
OS: CentOS 7 |
Thanks for the update @eliasp. I've removed the "Fixed Pending Verification" label. |
This may be a locale issue.
|
At least some of these are due to mixing the unicode strings (type 'unicode') and byte strings (type 'str'). Consider the following example:
In the case of highstate failing on "return '\n'.join(hstrs), changed" (one of the examples above), all input save one were byte strings, but the "Changes" part is a unicode string. This small tweak standardizing on str (the smallest change) made my run succeed (on 2014.1.13): --- /usr/lib/python2.7/dist-packages/salt/output/highstate.py 2015-10-05 02:26:49.000000000 +0200
+++ /usr/lib/python2.7/dist-packages/salt/output/highstate.py 2015-10-05 02:27:03.000000000 +0200
@@ -138,7 +138,7 @@
hstrs.extend([sline.format(**svars) for sline in state_lines])
changes = ' Changes: ' + ctext
hstrs.append(
- u'{0}{1}{2[ENDC]}'.format(tcolor, changes, colors)
+ '{0}{1}{2[ENDC]}'.format(tcolor, changes, colors)
)
# Append result counts to end of output I haven't tried the latest version yet, I'll try to whip up a pull request if it's still an issue there. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
I get this crash when running state.highstate test=True:
The state:
It's easy to reproduce: Put an lorem ipsum on /srv/salt/some-file, highstate it, log in to the minion, add some non-ascii (like \xc2\xb5) to /some-file and run another highstate and it will crash like above.
I'm running 2014.7.0rc1 at 20f2334
The text was updated successfully, but these errors were encountered: