chantra / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone

Blame SOURCES/0009-Fix-alias-processing-with-backslash-escaping-RhBug1680482.patch

8c93e6
From 32f331724cc8b473073fa0f29ad93044b1dde824 Mon Sep 17 00:00:00 2001
8c93e6
From: Brandon Bennett <bennetb@gmail.com>
8c93e6
Date: Mon, 16 Dec 2019 09:37:24 -0700
8c93e6
Subject: [PATCH] Strip '\' from aliases when processing (RhBug:1680482)
8c93e6
8c93e6
de40e3f7e910d5533dfbcc377807caaae115ed3e reworked the alias resolution
8c93e6
to detect infinate recursion, however it broke how the '\' works during
8c93e6
resolution.  Before the '\\' was stripped but now it is no longer.
8c93e6
8c93e6
This just adds a check to see if '\\' is in the first part of the
8c93e6
arguments and strips it.
8c93e6
---
8c93e6
 dnf/cli/aliases.py | 5 +++++
8c93e6
 1 file changed, 5 insertions(+)
8c93e6
8c93e6
diff --git a/dnf/cli/aliases.py b/dnf/cli/aliases.py
8c93e6
index b5283d0f33..364aab6d21 100644
8c93e6
--- a/dnf/cli/aliases.py
8c93e6
+++ b/dnf/cli/aliases.py
8c93e6
@@ -176,8 +176,13 @@ def subresolve(args):
8c93e6
                     suffix[0].startswith('\\')):  # End resolving
8c93e6
                 try:
8c93e6
                     stack.pop()
8c93e6
+
8c93e6
+                    # strip the '\' if it exists
8c93e6
+                    if suffix[0].startswith('\\'):
8c93e6
+                        suffix[0] = suffix[0][1:]
8c93e6
                 except IndexError:
8c93e6
                     pass
8c93e6
+
8c93e6
                 return suffix
8c93e6
 
8c93e6
             if suffix[0] in stack:  # Infinite recursion detected