commit:     51df6a3a490c46bcb40939be0691f59e2edbbd7b
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 10 14:29:09 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Apr 11 12:11:05 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=51df6a3a

Revert "dispatch_conf: fix arguments"

This is a step in the wrong direction, and causes another failure.

Reverts: 94dad3d64599f7e2c0c28e90ec4bee883746e385.
Bug: https://bugs.gentoo.org/836447
Bug: https://bugs.gentoo.org/837656
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 lib/portage/dispatch_conf.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/portage/dispatch_conf.py b/lib/portage/dispatch_conf.py
index fc130c9af..6dbb1885e 100644
--- a/lib/portage/dispatch_conf.py
+++ b/lib/portage/dispatch_conf.py
@@ -28,15 +28,14 @@ RCS_GET = "co"
 _ARCHIVE_ROTATE_MAX = 9
 
 
-def diffstatusoutput(file1, file2):
+def diffstatusoutput(cmd, 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.
-    cmd = f"diff -aq '{file1}' '{file2}'"
-    args = shlex_split(cmd)
+    args = shlex_split(cmd % (file1, file2))
 
     args = (portage._unicode_encode(x, errors="strict") for x in args)
     proc = subprocess.Popen(args, stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
@@ -341,7 +340,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(curconf, archive)[1]) != 0
+        and len(diffstatusoutput_mixed(f"diff -aq '{curconf}' 
'{archive}'")[1]) != 0
     ):
         _file_archive_rotate(archive)
 

Reply via email to