From c3d464c025f037affcd92769d19411ce47420403 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 17 Aug 2016 09:27:47 +0200 Subject: [PATCH] Resolves: #1367144 - avoid double encoding with Python 3 --- file-5.28-py3-double-enc.patch | 45 ++++++++++++++++++++++++++++++++++ file.spec | 9 ++++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 file-5.28-py3-double-enc.patch diff --git a/file-5.28-py3-double-enc.patch b/file-5.28-py3-double-enc.patch new file mode 100644 index 0000000..d97c037 --- /dev/null +++ b/file-5.28-py3-double-enc.patch @@ -0,0 +1,45 @@ +From ca13da68883e74d287cfb44b596cd134a82c4b7e Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Tue, 28 Jun 2016 17:10:22 +0000 +Subject: [PATCH] PR/562: Reiner Herrmann: Avoid double encoding with python3 + +Upstream-commit: 73e043d2a986234b187a00ed0c8d1f7bf83df372 +Signed-off-by: Kamil Dudka +--- + python/magic.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/python/magic.py b/python/magic.py +index c48f7d5..b0f7a17 100644 +--- a/python/magic.py ++++ b/python/magic.py +@@ -134,7 +134,7 @@ class Magic(object): + if isinstance(r, str): + return r + else: +- return str(r).encode('utf-8') ++ return str(r, 'utf-8') + + def descriptor(self, fd): + """ +@@ -152,7 +152,7 @@ class Magic(object): + if isinstance(r, str): + return r + else: +- return str(r).encode('utf-8') ++ return str(r, 'utf-8') + + def error(self): + """ +@@ -163,7 +163,7 @@ class Magic(object): + if isinstance(e, str): + return e + else: +- return str(e).encode('utf-8') ++ return str(e, 'utf-8') + + def setflags(self, flags): + """ +-- +2.5.5 + diff --git a/file.spec b/file.spec index f1275d8..077f0fa 100644 --- a/file.spec +++ b/file.spec @@ -5,7 +5,7 @@ Summary: A utility for determining file types Name: file Version: 5.28 -Release: 3%{?dist} +Release: 4%{?dist} License: BSD Group: Applications/File Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz @@ -28,6 +28,9 @@ Patch17: file-5.24-varied.patch # https://github.com/file/file/pull/8 Patch100: file-5.28-compress-sigsegv.patch +# avoid double encoding with Python 3 (#1367144) +Patch101: file-5.28-py3-double-enc.patch + URL: http://www.darwinsys.com/file/ Requires: file-libs = %{version}-%{release} BuildRequires: zlib-devel @@ -101,6 +104,7 @@ file(1) command. %patch17 -p1 %patch100 -p1 +%patch101 -p1 # Patches can generate *.orig files, which can't stay in the magic dir, # otherwise there will be problems with compiling magic file! @@ -208,6 +212,9 @@ cd %{py3dir} %endif %changelog +* Wed Aug 17 2016 Kamil Dudka - 5.28-4 +- avoid double encoding with Python 3 (#1367144) + * Tue Jul 19 2016 Fedora Release Engineering - 5.28-3 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages