All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Tomasz Paweł Gajc" <phenomenal-5tc4TXWwyLM@public.gmane.org>
Cc: Andrey Borzenkov <arvidjaar-JGs/UdohzUI@public.gmane.org>,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	rsyslog-4gKAAF5ltrKNkp5+ER1W/AC/G2K4zDHf@public.gmane.org,
	tpg-4qZELD6Fgxhg9hUCZPvPmw@public.gmane.org
Subject: Re: [PATCH] 98syslog: try to dynamically check for rsyslog moddir
Date: Fri, 10 Sep 2010 15:48:22 +0200	[thread overview]
Message-ID: <4C8A3726.5030505@redhat.com> (raw)
In-Reply-To: <20100908184826.7968b1e9-5tc4TXWwyLM@public.gmane.org>

On 09/08/2010 06:48 PM, Tomasz Pawe³ Gajc wrote:
> Dnia 2010-09-08, o godz. 18:52:13
> Andrey Borzenkov<arvidjaar-JGs/UdohzUI@public.gmane.org>  napisa³(a):
>
>> Thomas pointed out that default module path may not be correct
>> (Mandriva installs modules under architecture dependent path).
>> Unfortunately rsyslog does not seem to offer any way to query for
>> default configuration values. Here is rather hack - try to load
>> non-existing module and fetch path from error message.
>>
>> Example of error message from version 4.6.4:
>>
>> rsyslogd: could not load module '/lib64/rsyslog/_No_sUcH_MOduLe.so',
>> dlopen: /lib64/rsyslog/_No_sUcH_MOduLe.so: cannot open shared object
>> file: No such file or directory
>>
>> Signed-off-by: Andrey Borzenkov<arvidjaar-JGs/UdohzUI@public.gmane.org>
>>
>> ---
>>
>>   modules.d/98syslog/install |   17 ++++++++++++++++-
>>   1 files changed, 16 insertions(+), 1 deletions(-)
>>
>> diff --git a/modules.d/98syslog/install b/modules.d/98syslog/install
>> index 1fd1b6f..e3d02bf 100755
>> --- a/modules.d/98syslog/install
>> +++ b/modules.d/98syslog/install
>> @@ -1,6 +1,21 @@
>>   #!/bin/sh
>>   if type -P rsyslogd>/dev/null; then
>> -
>> installs="rsyslogd /lib/rsyslog/lmnet.so /lib/rsyslog/imklog.so /lib/rsyslog/imuxsock.so"
>> +	# module path can be changed during build and currently
>> rsyslog
>> +	# does not provide any means to query for it. Use hack - try
>> to
>> +	# load non-existent module and look at error message
>> +	R_CONF=/tmp/dracut.rsyslog.conf.$$
>> +	R_ERR=/tmp/dracut.rsyslog.err.$$
>> +	R_MODDIR=
>> +	echo '$ModLoad _No_sUcH_MOduLe'>  $R_CONF
>> +	if [ -s $R_CONF ]; then
>> +		rsyslogd -N 1 -f $R_CONF 2>  $R_ERR>  /dev/null
>> +		R_MODDIR=$(grep ' could not load
>> module .*_No_sUcH_MOduLe' $R_ERR)
>> +		R_MODDIR=${R_MODDIR#*could not load module \'}
>> +		R_MODDIR=${R_MODDIR%\', *}
>> +		R_MODDIR=${R_MODDIR%/*}
>> +	fi
>> +	[ -n "$R_MODDIR" ] || R_MODDIR=/lib/rsyslog
>> +	installs="rsyslogd $R_MODDIR/lmnet.so $R_MODDIR/imklog.so
>> $R_MODDIR/imuxsock.so" elif type -P syslogd>/dev/null; then
>>       installs="syslogd"
>>   elif type -P syslog-ng>/dev/null; then
>>
>>
>
> Indeed this patch is more precise than my simplified one ;)
>

ugly hack :-/ plus you want mktemp to prevent attacks..

  parent reply	other threads:[~2010-09-10 13:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08 14:52 [PATCH] 98syslog: try to dynamically check for rsyslog moddir Andrey Borzenkov
2010-09-08 16:48 ` Tomasz Paweł Gajc
     [not found]   ` <20100908184826.7968b1e9-5tc4TXWwyLM@public.gmane.org>
2010-09-10 13:48     ` Harald Hoyer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-09-10 14:33 Andrey Borzenkov
     [not found] ` <E1Ou4kw-0005pA-00.arvidjaar-mail-ru-eJLJSXF0gEtsdVUOrk1QfQ@public.gmane.org>
2010-09-10 14:39   ` Harald Hoyer
2010-09-10 15:15   ` Peter Jones
     [not found]     ` <4C8A4B91.20905-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-09-10 18:25       ` Tomasz Paweł Gajc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C8A3726.5030505@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=arvidjaar-JGs/UdohzUI@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=phenomenal-5tc4TXWwyLM@public.gmane.org \
    --cc=rsyslog-4gKAAF5ltrKNkp5+ER1W/AC/G2K4zDHf@public.gmane.org \
    --cc=tpg-4qZELD6Fgxhg9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.