Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
salt.8688
fix-diffing-binary-files-in-file.get_diff-bsc-1...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-diffing-binary-files-in-file.get_diff-bsc-109839.patch of Package salt.8688
From d25ab4e8aede37c8e27fb3bbfd3e980cdd4a04c2 Mon Sep 17 00:00:00 2001 From: Erik Johnson <palehose@gmail.com> Date: Fri, 13 Apr 2018 11:25:24 -0500 Subject: [PATCH] Fix diffing binary files in file.get_diff (bsc#1098394) --- salt/modules/file.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/salt/modules/file.py b/salt/modules/file.py index 994410743c..e8ef08546a 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -4916,9 +4916,8 @@ def get_diff(file1, args = [] for idx, filename in enumerate(files): try: - with salt.utils.files.fopen(filename, 'r') as fp_: - args.append([salt.utils.stringutils.to_unicode(x) - for x in fp_.readlines()]) + with salt.utils.files.fopen(filename, 'rb') as fp_: + args.append(fp_.readlines()) except (IOError, OSError) as exc: raise CommandExecutionError( 'Failed to read {0}: {1}'.format( @@ -4938,15 +4937,13 @@ def get_diff(file1, ret = bdiff else: if show_filenames: - args.extend( - [salt.utils.stringutils.to_unicode(x) for x in files] + args.extend(files) + ret = ''.join( + difflib.unified_diff( + *salt.utils.data.decode(args) ) - ret = salt.utils.locales.sdecode( - ''.join(difflib.unified_diff(*args)) # pylint: disable=no-value-for-parameter ) - return ret - - return '' + return ret def manage_file(name, -- 2.17.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor