commit: 94dad3d64599f7e2c0c28e90ec4bee883746e385 Author: Kenneth Raplee <kenrap <AT> kennethraplee <DOT> com> AuthorDate: Wed Mar 30 22:47:33 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Mar 30 23:11:43 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=94dad3d6
dispatch_conf: fix arguments Closes: https://bugs.gentoo.org/836447 Signed-off-by: Kenneth Raplee <kenrap <AT> kennethraplee.com> Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/dispatch_conf.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/portage/dispatch_conf.py b/lib/portage/dispatch_conf.py index 6dbb1885e..fc130c9af 100644 --- a/lib/portage/dispatch_conf.py +++ b/lib/portage/dispatch_conf.py @@ -28,14 +28,15 @@ RCS_GET = "co" _ARCHIVE_ROTATE_MAX = 9 -def diffstatusoutput(cmd, file1, file2): +def diffstatusoutput(file1, file2): """ Execute the string cmd in a shell with getstatusoutput() and return a 2-tuple (status, output). """ # Use Popen to emulate getstatusoutput(), since getstatusoutput() may # raise a UnicodeDecodeError which makes the output inaccessible. - args = shlex_split(cmd % (file1, file2)) + cmd = f"diff -aq '{file1}' '{file2}'" + args = shlex_split(cmd) args = (portage._unicode_encode(x, errors="strict") for x in args) proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -340,7 +341,7 @@ def file_archive(archive, curconf, newconf, mrgconf): # Archive the current config file if it isn't already saved if ( os.path.lexists(archive) - and len(diffstatusoutput_mixed(f"diff -aq '{curconf}' '{archive}'")[1]) != 0 + and len(diffstatusoutput_mixed(curconf, archive)[1]) != 0 ): _file_archive_rotate(archive)