[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msmtp-users] Bug in msmtpq might cause mail loss
Hi Philipp!
On 19/10/11 15:46, Philipp Hartwig wrote:
> msmtpq contains a test
> if [ -f "${FQP}.*" ] ; then # ensure fqp name is unique
> that is supposed to ensure that an existing queue file is not overwritten.
> However this combination of -f and globbing does not seem to work.
>
> $ cd /tmp
> $ touch foo
> $ if [ -f "foo" ]; then echo hi; fi
> hi
> $ if [ -f "foo*" ]; then echo hi; fi
> $
>
> This means that whenever a user sends more than one message per second only
> the last mail will survive.
>
> I've attached a possible fix but one might want to look into how to combine
> tests and globbing correctly.
Thanks for reporting this. You're right, one cannot use globbing in test
-f. One alternative would be to use find:
if test -n "`find . -maxdepth 1 -name "${FQP}*" -print -quit`"; then
echo "found"; fi
However, your patch looks correct for the msmtpq case and is cleaner and
less expensive.
Chris, ok to apply?
Martin