richardphibel / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone
Blob Blame History Raw
From 5b83b191574d43299bb6d3212df06c6f20c818e7 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Wed, 28 Aug 2019 09:52:40 +0200
Subject: [PATCH] Fix: --setopt and repo with dots

The "--setopt" have had a problem with repositories with dots in id.
Repository id may contain dots but option name can't. ->
So, the last dot is delimiter and not the first one.

Example:
"--setopt=re.po.option=value " was parsed as repo id "re" and option
"po.option". Correct result would be repo id "re.po" and option
"option".
---
 dnf/cli/option_parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dnf/cli/option_parser.py b/dnf/cli/option_parser.py
index 4b6599c..76fcb95 100644
--- a/dnf/cli/option_parser.py
+++ b/dnf/cli/option_parser.py
@@ -99,7 +99,7 @@ class OptionParser(argparse.ArgumentParser):
                 logger.warning(_("Setopt argument has no value: %s"), values)
                 return
             k, v = vals
-            period = k.find('.')
+            period = k.rfind('.')
             if period != -1:
                 repo = k[:period]
                 k = k[period+1:]
--
libgit2 0.28.2