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