[Bug 170] New: feature request: include only load *.conf files
https://bugzilla.balabit.com/show_bug.cgi?id=170 Summary: feature request: include only load *.conf files Product: syslog-ng Version: 3.3.x Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: unspecified Component: syslog-ng AssignedTo: bazsi@balabit.hu ReportedBy: erempel@uvic.ca Type of the Report: enhancement Estimated Hours: 0.0 When an rpm package is used to place a configuration file in an include directory and the package is later updated, a file of the name *.conf.rpmnew or *.conf.rpmsave but the contents of this file will be a conflict with the *.conf file and syslog-ng will not start. Syslog-ng should only load the *.conf files so that it can work seamlessly with the rpm method. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=170 Gergely Nagy <algernon@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |algernon@balabit.hu AssignedTo|bazsi@balabit.hu |algernon@balabit.hu --- Comment #1 from Gergely Nagy <algernon@balabit.hu> 2012-03-26 10:51:51 --- I'd like to see something like this implemented too, as a similar problem exists in Debian too (.dpkg-* suffixes there, instead of .rpmnew). I had a quick look at the code, and it doesn't seem to hard to turn the @include statement into something that accepts a shell glob. So distributions can add @include "/etc/syslog-ng/conf.d/*.conf" to their config, and that'd do the right thing. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=170 Gergely Nagy <algernon@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |FEATURE -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=170 --- Comment #2 from Gergely Nagy <algernon@balabit.hu> 2012-03-30 11:58:33 --- Had a go at this, the result is available on the feature/3.4/include-glob branch of my repo: https://github.com/algernon/syslog-ng/tree/feature/3.4/include-glob This allows one to write @include "/etc/syslog-ng/conf.d/*.conf", which will do just what you expect it to do. It also respects the global include-path setting, so @include "blah/*.conf" will work too. As of now, if no files were found, it will return an error, which is probably not what we want, I'll fix that up in a few moments. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=170 Balazs Scheidler <bazsi@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bazsi@balabit.hu --- Comment #3 from Balazs Scheidler <bazsi@balabit.hu> 2012-03-31 17:58:40 --- good idea with the glob. I was just thinking how I could specify the mask, but doing it this way is quite straighforward and intuitive. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=170 --- Comment #4 from Balazs Scheidler <bazsi@balabit.hu> 2012-03-31 21:58:31 --- I like the refactorization in the first patch, however I think it makes sense to keep the responsibility of the filename in the first function instead of moving the free into another function. I'm commiting the changes but I'm folding this into the first patch. Let me know if you have a problem with that. Thanks. diff --git a/lib/cfg-lexer.c b/lib/cfg-lexer.c index 5badde1..1dd1968 100644 --- a/lib/cfg-lexer.c +++ b/lib/cfg-lexer.c @@ -381,14 +381,13 @@ cfg_lexer_start_next_include(CfgLexer *self) } static gboolean -cfg_lexer_include_file_simple(CfgLexer *self, gchar *filename) +cfg_lexer_include_file_simple(CfgLexer *self, const gchar *filename) { CfgIncludeLevel *level; struct stat st; if (stat(filename, &st) < 0) { - g_free(filename); return FALSE; } @@ -459,7 +458,6 @@ cfg_lexer_include_file_simple(CfgLexer *self, gchar *filename) evt_tag_str("dir", filename), NULL); self->include_depth--; - g_free(filename); return TRUE; } } @@ -468,10 +466,8 @@ cfg_lexer_include_file_simple(CfgLexer *self, gchar *filename) g_assert(level->file.files == NULL); level->file.files = g_slist_prepend(level->file.files, g_strdup(filename)); } - g_free(filename); return cfg_lexer_start_next_include(self); drop_level: - g_free(filename); g_slist_foreach(level->file.files, (GFunc) g_free, NULL); g_slist_free(level->file.files); level->file.files = NULL; @@ -533,7 +529,6 @@ gboolean cfg_lexer_include_file(CfgLexer *self, const gchar *filename_) { struct stat st; - CfgIncludeLevel *level; gchar *filename; if (self->include_depth >= MAX_INCLUDE_DEPTH - 1) @@ -559,7 +554,13 @@ cfg_lexer_include_file(CfgLexer *self, const gchar *filename_) return FALSE; } else - return cfg_lexer_include_file_simple(self, filename); + { + gboolean result; + + result = cfg_lexer_include_file_simple(self, filename); + g_free(filename); + return result; + } } gboolean -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=170 Gergely Nagy <algernon@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|FEATURE |CLOSED --- Comment #5 from Gergely Nagy <algernon@balabit.hu> 2012-05-07 13:27:50 --- Since this has been merged into 3.4, and 3.4.0alpha2 contains this feature, I'm closing the feature request. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
bugzilla@bugzilla.balabit.com