From fbb24f41bbdf93a741196fa8a66ecc94ae6fb4d7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 24 Sep 2007 22:15:16 +0000 Subject: [PATCH] Bug #74615 - Quote all file paths inside dispatch-conf shell commands. svn path=/main/trunk/; revision=7803 --- bin/dispatch-conf | 6 +++--- cnf/dispatch-conf.conf | 4 ++-- pym/portage/dispatch_conf.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/dispatch-conf b/bin/dispatch-conf index e71512c7e..c1dd7a3d1 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -29,9 +29,9 @@ from portage import dispatch_conf from portage.process import find_binary FIND_EXTANT_CONFIGS = "find '%s' %s -iname '._cfg????_%s' ! -iname '.*~' ! -iname '.*.bak'" -DIFF_CONTENTS = 'diff -Nu %s %s' -DIFF_CVS_INTERP = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"' -DIFF_WSCOMMENTS = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"' +DIFF_CONTENTS = "diff -Nu '%s' '%s'" +DIFF_CVS_INTERP = "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep -v '# .Header:.*'" +DIFF_WSCOMMENTS = "diff -Nu '%s' '%s' | grep '^[+-][^+-]' | grep -v '^[-+]#' | grep -v '^[-+][:space:]*$'" # We need a secure scratch dir and python does silly verbose errors on the use of tempnam oldmask = os.umask(0077) diff --git a/cnf/dispatch-conf.conf b/cnf/dispatch-conf.conf index d4caa9557..d9ccc12a6 100644 --- a/cnf/dispatch-conf.conf +++ b/cnf/dispatch-conf.conf @@ -12,13 +12,13 @@ use-rcs=no # Diff for display # %s old file # %s new file -diff="diff -Nu %s %s | less --no-init --QUIT-AT-EOF" +diff="diff -Nu '%s' '%s' | less --no-init --QUIT-AT-EOF" # Diff for interactive merges. # %s output file # %s old file # %s new file -merge="sdiff --suppress-common-lines --output=%s %s %s" +merge="sdiff --suppress-common-lines --output='%s' '%s' '%s'" # Automerge files comprising only CVS interpolations (e.g. Header or Id) # (yes or no) diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py index 690772bf8..860ffea30 100644 --- a/pym/portage/dispatch_conf.py +++ b/pym/portage/dispatch_conf.py @@ -16,9 +16,9 @@ RCS_BRANCH = '1.1.1' RCS_LOCK = 'rcs -ko -M -l' RCS_PUT = 'ci -t-"Archived config file." -m"dispatch-conf update."' RCS_GET = 'co' -RCS_MERGE = 'rcsmerge -p -r' + RCS_BRANCH + ' %s >%s' +RCS_MERGE = "rcsmerge -p -r" + RCS_BRANCH + " '%s' > '%s'" -DIFF3_MERGE = 'diff3 -mE %s %s %s >%s' +DIFF3_MERGE = "diff3 -mE '%s' '%s' '%s' > '%s'" def read_config(mandatory_opts): try: @@ -33,7 +33,7 @@ def read_config(mandatory_opts): for key in mandatory_opts: if not opts.has_key(key): if key == "merge": - opts["merge"] = "sdiff --suppress-common-lines --output=%s %s %s" + opts["merge"] = "sdiff --suppress-common-lines --output='%s' '%s' '%s'" else: print >> sys.stderr, 'dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal' % (key,) @@ -106,7 +106,7 @@ def file_archive(archive, curconf, newconf, mrgconf): # Archive the current config file if it isn't already saved if os.path.exists(archive) \ - and len(commands.getoutput('diff -aq %s %s' % (curconf,archive))) != 0: + and len(commands.getoutput("diff -aq '%s' '%s'" % (curconf,archive))) != 0: suf = 1 while suf < 9 and os.path.exists(archive + '.' + str(suf)): suf += 1 -- 2.26.2