Ignore duplicate file matches#473
Ignore duplicate file matches#473kdudka merged 2 commits intologrotate:masterfrom falk-werner:feat/ignore-duplicates
Conversation
|
I love the commit. But why not have an option that is indicative of what is actually going on? |
|
Indeed, finding names is the tricky part here and you are totally right, |
|
You realize this is a 6+ year old problem, you're solving! :) I want to award you with a trophy or something. Anyway, In issue #38 and related, they discuss an option, such as "ignore-duplicates". I used to always hate long options. It irked me in the early 90s when GNU utils started with their Also, take a look at my comment at the end of issue #38 . Consider if this change might break the implementations they want there. Yeah, I know it's a lot of work, but dammit. This utility is used by everyone in the RPM world. |
|
big thumbs up (from me --let's hope the guy with the keys agrees) |
|
Thank you for working on this! I think this is an easy-to-implement alternative to pull request #173, which tried to solve a bigger problem but in the end failed because of some corner-cases that were nearly impossible to address in a backward-compatible way.
I would also like to cover this by a test-case. |
I like
I added basic test just yet. The test ensures that no error occurs when the option is specified - otherwise an error occurs. I'm not sure about adding a negative test - should I? |
|
@cgzones What is your take on this? |
... to allow duplicate file matches Closes: #473
|
@falk-werner I have squashed the fixup commits and slightly tweaked the commit messages. Could you please confirm that we can merge the current version as it is? |
|
@kdudka I confirm, please merge it. |
|
Merging, thanks! |
This fixes an unfortunate issue in the upstream's provided logrotate, and the one which `cephadm` creates during runs. Unfortunately, logrotate throws an error if more than one rule matches a given file, which is the case between our '.../ceph/*.log' and the cephadm generated one: '.../ceph/cephadm.log'. Because the file is generated we can't really complain to the maintainer for cephadm, and we also can't change our rule because ceph may generate any pattern matching '<cluster>-<svc>-<id>', all of which are user / cluster specific. Fortunately, the most recent (as of this commit) logrotate as introduced a workaround: 'ignoreduplicates' which does what you expect. We patch the upstream logrotate.conf to include this keyword, fixing this issue. See the issue for more. References: logrotate/logrotate#473 References: https://github.com/ceph/ceph/blob/v17.2.5/src/cephadm/cephadm#L9408 Closes: #8 Issue: bazaah/aur-ceph#8 Reported-by: snack@aur.archlinux.org
Edit: changed option name from to "ignoreduplicates".
This pull request introduced the new option "ignoreduplicates", which allows to ignore duplicate file matches.
Example:
Note that order is significant: the first occurrence of a unique file must be marked to achieve the desired behavior.
This feature is in response to following issues:
It is not an ideal solution for these issues, but I believe it solves the basic use cases:
When run in verbose mode, every duplicate issues a debug message. If
ignoreduplicatesis not used or it is not specified for the first occurrence, an error is issued for each duplicate (same behavior as before).