[PATCH] replace call to file(1) with libmagic

Mark Martinec Mark.Martinec+amavis at ijs.si
Tue Jul 22 19:52:58 CEST 2014


> i did some research on optimizing Amavis/Spamassassin in our test setup
> with NYTProf.

Nice! NYTProf is a great profiling tool indeed.

> I found that replacing the call to the external file(1) tool with
> calls to File::LibMagic increased the throughput from 4.1 to 4.8 msg/s.
> It also simplifies the code in determine_file_types().

Thank you for the patch, accepted. Tried it out and it does work well.
I'll probably keep both alternatives in the code, just in case,
perhaps with automatic selection of File::LibMagic when available.

Regarding past history of stability/vulnerability of the file(1)
utility, I'm a little concerned as libmagic will run in the context
of the same amavisd child process, instead of being a spawned process,
so it has a capability of bringing down the process.

I'll let it run for a while here and see how it behaves.


More information about the amavis-users mailing list