Page 1 of 1

Config files XML format is not true XML

Posted: 2017-01-08T21:03:35-07:00
by Tzen
Hi.
We use automated configuration management for all our config files. So we use augeas to add/remove some features to .xml files.
We recently tried to add a restriction into policy.xml like this:

/etc/ImageMagic/policy.xml:

Code: Select all

 <policy domain="resource" name="disk" value="512MiB"></policy>
This was done automatically by augeas. This is absolutely correct XML tag which SHOULD BE EQUIVALENT to self-closing tag like <policy domain="resource" name="disk" value="512MiB"/>

But this limit was surprisingly not used by 'convert':

Code: Select all

convert -list resource
File         Area       Memory          Map         Disk    Thread         Time
-------------------------------------------------------------------------------
 768     12.511GB     5.826GiB    11.652GiB    unlimited         6    unlimited
Next we edited the policy.xml file and replaced questionable 'disk' limit with self closing tag:

Code: Select all

 <policy domain="resource" name="disk" value="512MiB"/>
And we see that this limit is now applied:

Code: Select all

convert -list resource
File         Area       Memory          Map         Disk    Thread         Time
-------------------------------------------------------------------------------
 768     12.511GB     5.826GiB    11.652GiB       512MiB         6    unlimited
So the bug is in the .XML interpretation. You should support equivalent XML tags with empty bodies.

Re: Config files XML format is not true XML

Posted: 2017-01-09T05:01:58-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.