Hi,

2011/1/24 Agustin Martin <agmar...@debian.org>:
> On Mon, Jan 24, 2011 at 02:17:48PM +0100, Harald Jenny wrote:
>> I will have a to check this - this is meant as a guard against accidently
>> setting $MILTERSOCKET to "".

Good catch on this. I didn't though of this being empty.

> Damm, seems I wrongly understood Theodor's mail, and my proposed change will
> not work because of echo newline. Anyway, in the case above, 'echo -n'
> (allowed by policy 10.4)
>
> http://www.de.debian.org/doc/debian-policy/ch-files.html#s-scripts
>
> should help with that,
>
> if echo -n "$MILTERSOCKET" | grep -q -v "^inet"; then
>
> That will still not protect against things like setting $MILTERSOCKET
> to " ", but dealing with "" is a must.

I don't recommend to use echo with any parameters since it is not
portable. The only reliable call to echo is just "echo". These calls
are not working reliable: "echo -n", "echo -e", "echo -en". For any of
these construction just use "printf" but very important to guard the
strings with "". So the recommended check to catch all combinations
would be:

| if printf "$MILTERSOCKET" | grep -q -v "^inet"; then
| ...
| fi

Also, the "echo -n" is one of the bashism constructions that don't
work with dash behind /bin/sh (aka >= squeeze).

Thanks



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to