ms, sanesecurity, clamd and freebsd

René Berber r.berber at computer.org
Mon Oct 8 23:51:12 IST 2007


Mikael Syska wrote:

> Thanks for the reply.
> 
> René Berber wrote:
>> Mikael Syska wrote:
>>
>> [snip]
>>  
>>> I get the following:
>>> sed: 1: "s/\/$//; s/^.*loading d ...": bad flag in substitute
>>> command: 'i'
>>>
>>> And then I'm lost ... just wandered if some one here maybe could tell me
>>> if the "sed" command is different on FreeBSD or maybe someone using it
>>> on freebsd with no problems .... ?
>>>     
>>
>> Yes sed is different, GNU's sed does accept the -i option, other older
>> versions
>> of sed (which I have in Solaris) don't.
>>
>> There are at least 2 options:
>>
>> - Install GNU sed;
>> - Change the script from sed to perl.  perl also has a -i option so the
>> equivalent of what I see above would be:
>>
>> perl -pi -e "s/\/$//; s/^.*loading d ..."
>>   
> The whole line would be this then:
> clam_db_dir=`"$clamscan" --debug "$test_file" 2>&1 | \
>                sed -ne 's/\/$//; s/^.*loading databases from
> \(.*\)$/\1/ip' | head -1`

Oh oh, it's not the -i parameter (edit file in place) its an i (for case
insensitive) at the end... forget what I said about old sed and the equivalent
in perl.

Looking at info sed it says it is a GNU extension.

> If you could translate that, I would be very happy. Maybe other freebsd
> users have the same problem.
> 
> I will then mail the author of the script, maybe he can check if its the
> GNU version that is being used ... and then use perl to fetch it.

This works with regular sed:

clam_db_dir=`"$clamscan" --debug "$test_file" 2>&1 | \
               sed -ne 's/\/$//; s/^.*oading databases from\(.*\)$/\1/p' | head -1`

Since only the L in loading is capitalized in the output, getting rid of the i
flag and that letter does the job.
-- 
René Berber



More information about the MailScanner mailing list