richardphibel / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone

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

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