Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1459578 Details for
Bug 1602156
imfile symlink uses source filename in metadata filename instead of given name
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch for https://github.com/rsyslog/rsyslog/pull/2749
0001-Bug-1602156-imfile-symlink-uses-source-filename-in-m.patch (text/plain), 4.69 KB, created by
Rich Megginson
on 2018-07-18 00:43:36 UTC
(
hide
)
Description:
patch for https://github.com/rsyslog/rsyslog/pull/2749
Filename:
MIME Type:
Creator:
Rich Megginson
Created:
2018-07-18 00:43:36 UTC
Size:
4.69 KB
patch
obsolete
>From 57978711ee122dcfc0a46f30a5d879751799b9d5 Mon Sep 17 00:00:00 2001 >From: Rich Megginson <rmeggins@redhat.com> >Date: Tue, 17 Jul 2018 17:53:54 -0600 >Subject: [PATCH] Bug 1602156 - imfile symlink uses source filename in metadata > filename instead of given name > >https://bugzilla.redhat.com/show_bug.cgi?id=1602156 >Add two new fields to act_obj_s: >link_target - if the active object is a symlink, link_target > is the name of the target file as returned by > realpath(3), else NULL >link_source - if the active object is a file and not a symlink, > link_source is the name of the symlink that links > to this file, if any, or NULL if no symlinks point > to this file > >When adding a real file, the code scans through the list of active >objects, and if it finds an active object with a link_target which >is the name of the real file, it adds the name of the link object >as the link_source, and uses the link_source when adding the >`$!metadata!filename` to the record. >--- > plugins/imfile/imfile.c | 27 ++++++++++++++++++++++++--- > 1 file changed, 24 insertions(+), 3 deletions(-) > >diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c >index b43bad79a..997f9e9d4 100644 >--- a/plugins/imfile/imfile.c >+++ b/plugins/imfile/imfile.c >@@ -154,6 +154,10 @@ struct act_obj_s { > fs_edge_t *edge; /* edge which this object belongs to */ > char *name; /* full path name of active object */ > char *basename; /* only basename */ //TODO: remove when refactoring rename support >+ char *link_target; /* if this object is a symlink, link_target is the name of the target file >+ as returned by realpath(3), else NULL */ >+ char *link_source; /* if this object is a file and not a symlink, link_source is the name of the symlink >+ that links to this file, if any, or NULL if no symlink point to this file */ > //char *statefile; /* base name of state file (for move operations) */ > int wd; > #if defined(OS_SOLARIS) && defined (HAVE_PORT_SOURCE_FILE) >@@ -678,10 +682,11 @@ fs_node_print(const fs_node_t *const node, const int level) > */ > static rsRetVal ATTR_NONNULL() > act_obj_add(fs_edge_t *const edge, const char *const name, const int is_file, >- const ino_t ino, const int is_symlink) >+ const ino_t ino, const int is_symlink, const char *const target) > { > act_obj_t *act; > char basename[MAXFNAME]; >+ const char *link_source = NULL; > DEFiRet; > > DBGPRINTF("act_obj_add: edge %p, name '%s'\n", edge, name); >@@ -691,6 +696,10 @@ act_obj_add(fs_edge_t *const edge, const char *const name, const int is_file, > name, edge->path); > FINALIZE; > } >+ if(act->link_target && !strcmp(act->link_target, name)) { >+ /* set link_source to act->name */ >+ link_source = act->name; >+ } > } > DBGPRINTF("add new active object '%s' in '%s'\n", name, edge->path); > CHKmalloc(act = calloc(sizeof(act_obj_t), 1)); >@@ -703,6 +712,11 @@ act_obj_add(fs_edge_t *const edge, const char *const name, const int is_file, > #ifdef HAVE_INOTIFY_INIT > act->wd = in_setupWatch(act, is_file); > #endif >+ if (target) >+ CHKmalloc(act->link_target = strdup(target)); >+ if (link_source) >+ CHKmalloc(act->link_source = strdup(link_source)); >+ > fen_setupWatch(act); > if(is_file && !is_symlink) { > const instanceConf_t *const inst = edge->instarr[0];// TODO: same file, multiple instances? >@@ -879,6 +893,7 @@ poll_tree(fs_edge_t *const chld) > continue; > } else { /* not a symlink */ > free(target); >+ target = NULL; > } > if(!is_file && S_ISREG(fileInfo.st_mode)) { > LogMsg(0, RS_RET_ERR, LOG_WARNING, >@@ -893,7 +908,7 @@ poll_tree(fs_edge_t *const chld) > (chld->is_file) ? "FILE" : "DIRECTORY"); > continue; > } >- act_obj_add(chld, file, is_file, fileInfo.st_ino, issymlink); >+ act_obj_add(chld, file, is_file, fileInfo.st_ino, issymlink, target); > } > globfree(&files); > } >@@ -981,6 +996,8 @@ act_obj_destroy(act_obj_t *const act, const int is_deleted) > free(act->basename); > //free(act->statefile); > free(act->multiSub.ppMsgs); >+ free(act->link_target); >+ free(act->link_source); > #if defined(OS_SOLARIS) && defined (HAVE_PORT_SOURCE_FILE) > act->is_deleted = 1; > #else >@@ -1279,7 +1296,11 @@ enqLine(act_obj_t *const act, > msgSetPRI(pMsg, inst->iFacility | inst->iSeverity); > MsgSetRuleset(pMsg, inst->pBindRuleset); > if(inst->addMetadata) { >- metadata_values[0] = (const uchar*)act->name; >+ if (act->link_source) { >+ metadata_values[0] = (const uchar*)act->link_source; >+ } else { >+ metadata_values[0] = (const uchar*)act->name; >+ } > snprintf((char *)file_offset, MAX_OFFSET_REPRESENTATION_NUM_BYTES+1, "%lld", strtOffs); > metadata_values[1] = file_offset; > msgAddMultiMetadata(pMsg, metadata_names, metadata_values, 2); >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1602156
: 1459578 |
1459579