Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order loading sourced conf files #1154

Closed
Guzoft opened this issue Feb 11, 2019 · 3 comments
Closed

Order loading sourced conf files #1154

Guzoft opened this issue Feb 11, 2019 · 3 comments

Comments

@Guzoft
Copy link

Guzoft commented Feb 11, 2019

We're loading .conf files with the 'include_dir /etc/mosquitto/conf.d' statement.

Tests with versions 1.5.3 and 1.5.6 tend to indicated that the sourced .conf files are loaded in alphabetic order. First is the contents of '00-something.conf' loaded, followed by '10-something.conf', '20-something.conf', etc. (It's our understanding. Is this understanding correct?)

This behavior is to my knowledge not documented in the man pages and logically depending upon it is therefore prone to future breakage.

If this 'load-order' of sourced configuration files is deliberate, could we get it mentioned in the documentation? If it's not, should/could it become deliberate and documented?

Could documentation also indicate what happens if using more than one 'include_dir' statement in the main configuration file? One would guess: First 'include_dir" would be loaded, files in alphabetic order, followed by second 'include_dir', with it's files in alphabetic order, etc. But that's just a guess.

If order is random, and deemed to remain random, could that be documented in the man pages?

Regards

ralight added a commit that referenced this issue Feb 13, 2019
@ralight
Copy link
Contributor

ralight commented Feb 13, 2019

Excellent points, this did need clarifying. Your guesses were correct though.

I've added to the documentation and hope it is now clear. Here is a screenshot, let me know what you think:

include_dir

@Guzoft
Copy link
Author

Guzoft commented Feb 13, 2019

A lot clearer and a commitment much appreciated by certain sysadmins. But...

If you claim the .conf files "are loaded in case insensitive alphabetic order", then the first example is incorrect, since the load order between 'A.conf' and 'a.conf' would be undefined by mosquitto on a case sensitive file-system whereas the example would not be possible at all on a case insensitive file system. If the order is case insensitive, then may I suggest a mentioning that the load order of 'A.conf' and 'a.conf' remains undefined on case sensitive file systems ?

Alternatively... If I may get nifty...
'The configuration files in include_dir are loaded in case sensitive alphabetical order.'

Clear and concise on a case sensitive system and does no harm on a case insensitive system, since 'A.conf' and 'a.conf' will never be found in the same directory on a case insensitive file-system.

Sorry to be such a pain somewhere. I just think this effort should be addressed once, with the intention to not bring it back up later unless changes are made to this logic.

@ralight
Copy link
Contributor

ralight commented Feb 13, 2019

Yep, agreed. It is now explicitly case sensitive, with the upper case of each letter ordered before the lower case of the same letter, i.e. AaBbCc. In this sort of context, "case sensitive sort" to me usually means the ABCabc type ordering that strcmp carries out, which isn't the most obvious if you aren't a programmer.

@ralight ralight closed this as completed Feb 13, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants