dcavalca / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone
Blob Blame History Raw
From 32f331724cc8b473073fa0f29ad93044b1dde824 Mon Sep 17 00:00:00 2001
From: Brandon Bennett <bennetb@gmail.com>
Date: Mon, 16 Dec 2019 09:37:24 -0700
Subject: [PATCH] Strip '\' from aliases when processing (RhBug:1680482)

de40e3f7e910d5533dfbcc377807caaae115ed3e reworked the alias resolution
to detect infinate recursion, however it broke how the '\' works during
resolution.  Before the '\\' was stripped but now it is no longer.

This just adds a check to see if '\\' is in the first part of the
arguments and strips it.
---
 dnf/cli/aliases.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dnf/cli/aliases.py b/dnf/cli/aliases.py
index b5283d0f33..364aab6d21 100644
--- a/dnf/cli/aliases.py
+++ b/dnf/cli/aliases.py
@@ -176,8 +176,13 @@ def subresolve(args):
                     suffix[0].startswith('\\')):  # End resolving
                 try:
                     stack.pop()
+
+                    # strip the '\' if it exists
+                    if suffix[0].startswith('\\'):
+                        suffix[0] = suffix[0][1:]
                 except IndexError:
                     pass
+
                 return suffix
 
             if suffix[0] in stack:  # Infinite recursion detected