SUSE / machinery

A systems management toolkit for Linux
GNU General Public License v3.0
158 stars 32 forks source link

Fix file encoding when creating archive files #2279

Closed guangyee closed 3 years ago

guangyee commented 3 years ago

When creating the archive files, we need to open them with "wb" instead of "w" as the underneath cheetah library is doing partial read, which always result int ASCII-8BIT encoding [1]. Otherwise, we'll get an ugly error like this.

"\x8B" from ASCII-8BIT to UTF-8"

in cheetah [2] when attempt to do buffer write to the archive file.

[1] https://ruby-doc.org/core-2.7.0/IO.html [2] https://github.com/openSUSE/cheetah/blob/master/lib/cheetah.rb#L640