diff --git a/config_common/file_utils.py b/config_common/file_utils.py index 29db4e2..4b18fe3 100644 --- a/config_common/file_utils.py +++ b/config_common/file_utils.py @@ -182,7 +182,7 @@ class FileProcessor: #rip off the leading '0' from the mode returned by stat() if cur_perm[0] == '0': - cur_perm = cur_perm[1:] + cur_perm = cur_perm[2:] if cur_perm[1] == 'o' else cur_perm[1:] #perm_status gets displayed with the verbose option. if cur_perm == str(file_struct['filemode']): @@ -223,7 +223,7 @@ class FileProcessor: raise e else: result = ''.join(diff(temp_file, path, - display_diff=get_config('display_diff'))) + display_diff=get_config('display_diff'), is_binary=file_struct['is_binary'])) if temp_file: os.unlink(temp_file) @@ -236,26 +236,26 @@ class FileProcessor: raise Exception("Missing key %s" % k) -def diff(src, dst, srcname=None, dstname=None, display_diff=False): - def f_content(path, name): +def diff(src, dst, srcname=None, dstname=None, display_diff=False, is_binary=False): + def f_content(path, name, is_binary): statinfo = None if os.access(path, os.R_OK): - f = open(path, 'U') + f = open(path, 'Ub' if is_binary else 'U') content = f.readlines() f.close() statinfo = os.stat(path) f_time = time.ctime(statinfo.st_mtime) - if content and content[-1] and content[-1][-1] != "\n": + if not is_binary and content and content[-1] and content[-1][-1] != "\n": content[-1] += "\n" else: content = [] f_time = time.ctime(0) if not name: name = path - return (content, name, f_time, statinfo) + return (str(content), name, f_time, statinfo) - (src_content, src_name, src_time, src_stat) = f_content(src, srcname) - (dst_content, dst_name, dst_time, dst_stat) = f_content(dst, dstname) + (src_content, src_name, src_time, src_stat) = f_content(src, srcname, is_binary) + (dst_content, dst_name, dst_time, dst_stat) = f_content(dst, dstname, is_binary) diff_u = difflib.unified_diff(src_content, dst_content, src_name, dst_name, diff --git a/rhncfg.spec b/rhncfg.spec index 5911dc8..1b9003b 100644 --- a/rhncfg.spec +++ b/rhncfg.spec @@ -15,7 +15,7 @@ Name: rhncfg Version: 5.10.120 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Spacewalk Configuration Client Libraries License: GPLv2 URL: https://github.com/spacewalkproject/spacewalk @@ -281,6 +281,12 @@ fi %endif %changelog +* Mon May 14 2018 Tomas Kasparek 5.10.120-6 +- Resolves: #1577138 - when loading a file take into account if it's binary or + not (tkasparek@redhat.com) +- Resolves: #1572652 - do not report that files differ due to python3 octal + number represenatation (tkasparek@redhat.com) + * Mon May 14 2018 Tomas Kasparek 5.10.120-5 - require python3-libselinux on python3 only OS (tkasparek@redhat.com)