dcavalca / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone

Blame SOURCES/0002-Fix-and-document-order-of-config-files-in-aliasesd-RhBug1680489.patch

210fc6
From ba3615c600532a0ce8693a626a9cbe71a458399a Mon Sep 17 00:00:00 2001
210fc6
From: Pavla Kratochvilova <pkratoch@redhat.com>
210fc6
Date: Thu, 23 May 2019 14:48:29 +0200
210fc6
Subject: [PATCH 1/2] Respect order of config files in aliases.d
210fc6
 (RhBug:1680489)
210fc6
210fc6
https://bugzilla.redhat.com/show_bug.cgi?id=1680489
210fc6
The aliases config files were read in arbitrary order (os.listdir does not
210fc6
give sorted output). It is better to define clear order (i.e. all config files
210fc6
except USER.conf are ordered alphabetically, USER.conf is the last).
210fc6
210fc6
Closes: #1542
210fc6
Approved by: kontura
210fc6
---
210fc6
 dnf/cli/aliases.py | 2 +-
210fc6
 1 file changed, 1 insertion(+), 1 deletion(-)
210fc6
210fc6
diff --git a/dnf/cli/aliases.py b/dnf/cli/aliases.py
210fc6
index 0b3ba8f6b..b5283d0f3 100644
210fc6
--- a/dnf/cli/aliases.py
210fc6
+++ b/dnf/cli/aliases.py
210fc6
@@ -143,7 +143,7 @@ class Aliases(object):
210fc6
         try:
210fc6
             if not os.path.exists(ALIASES_DROPIN_DIR):
210fc6
                 os.mkdir(ALIASES_DROPIN_DIR)
210fc6
-            for fn in os.listdir(ALIASES_DROPIN_DIR):
210fc6
+            for fn in sorted(os.listdir(ALIASES_DROPIN_DIR)):
210fc6
                 if _ignore_filename(fn):
210fc6
                     continue
210fc6
                 filenames.append(os.path.join(ALIASES_DROPIN_DIR, fn))
210fc6
-- 
210fc6
2.21.0
210fc6
210fc6
210fc6
From e292de84fcdec844530099a6c37ef29e1a330003 Mon Sep 17 00:00:00 2001
210fc6
From: Pavla Kratochvilova <pkratoch@redhat.com>
210fc6
Date: Thu, 23 May 2019 15:04:34 +0200
210fc6
Subject: [PATCH 2/2] [doc] Describe priorities of config files in aliases.d
210fc6
 (RhBug:1680489)
210fc6
210fc6
https://bugzilla.redhat.com/show_bug.cgi?id=1680489
210fc6
210fc6
Closes: #1542
210fc6
Approved by: kontura
210fc6
---
210fc6
 doc/command_ref.rst | 5 ++++-
210fc6
 1 file changed, 4 insertions(+), 1 deletion(-)
210fc6
210fc6
diff --git a/doc/command_ref.rst b/doc/command_ref.rst
210fc6
index 7141fc2aa..637ccf96b 100644
210fc6
--- a/doc/command_ref.rst
210fc6
+++ b/doc/command_ref.rst
210fc6
@@ -424,7 +424,10 @@ for aliases. The alias processing stops when the first found command is not a na
210fc6
 Also, like in shell aliases, if the result starts with a ``\``, the alias processing will stop.
210fc6
 
210fc6
 All aliases are defined in configuration files in the ``/etc/dnf/aliases.d/`` directory in the [aliases] section,
210fc6
-and aliases created by the alias command are written to the ``USER.conf`` file.
210fc6
+and aliases created by the alias command are written to the ``USER.conf`` file. In case of conflicts,
210fc6
+the ``USER.conf`` has the highest priority, and alphabetical ordering is used for the rest of the
210fc6
+configuration files.
210fc6
+
210fc6
 Optionally, there is the ``enabled`` option in the ``[main]`` section defaulting to True. This can be set for each
210fc6
 file separately in the respective file, or globally for all aliases in the ``ALIASES.conf`` file.
210fc6
 
210fc6
-- 
210fc6
2.21.0
210fc6