2014-06-17 17:20 GMT+02:00 Marco Gaiarin <[email protected]>:
> Mandi! Mathieu Parent
>   In chel di` si favelave...
>
>> > Seems to me a dupe of #743202 ...
>> No this is a regression of #743202. This comes from the bashism
>> IFS=$'\n'. I have not found a solution yet. Patch welcome (a workaound
>> is to use #!/bin/bash as shebang).
>
> Ok; anyway the culprit came from:
>
>                 for variable in `egrep -v '^[[:space:]]*(#|$)' "$CONFFILE" | 
> awk '{print $1}'`; do
>                         value=`grep ^$variable $CONFFILE | head -n1 | awk 
> '{print $2}'`
>
>                         if [ -n "$value" ]; then
>                                 export "config_$variable"="$value"
>                         fi
>                 done

Yes, the grep is not properly exploded, because $IFS is wrong.

> but, effectively the only config options used as a avariables are 
> config_PidFile,
> config_CommandsSocket, config_User and config_Group, that does not make 
> trouble,
> because the value is clearly have no space.
>
> Why not simply substitute with:
>
>                 for variable in "PidFile CommandsSocket User Group"; do
>                         value=`grep ^$variable $CONFFILE | head -n1 | awk 
> '{print $2}'`
>
>                         if [ -n "$value" ]; then
>                                 export "config_$variable"="$value"
>                         fi
>                 done

.. because last time i checked it was way slower (like 3 seconds). But
my dev machine is old.

> ?! I think can fix and simplify all the stuff.
>
>
> PS: also, i suppose that c-icap.conf is caseless on options name, so

I have not checked c-icap case-sensitivity.

> probably it is safe to put all the variable in lower or UPPER case, eg:
>
>                 for variable in "PIDFILE COMMANDSSOCKET USER GROUP"; do
>                         value=`grep -i ^$variable $CONFFILE | head -n1 | awk 
> '{print $2}'`
>
>                         if [ -n "$value" ]; then
>                                 export "config_$variable"="$value"
>                         fi
>                 done
>

Please go ahead with a patch.

Regards

-- 
Mathieu


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to