Config files XML format is not true XML

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Tzen
Posts: 1
Joined: 2017-01-08T20:51:40-07:00
Authentication code: 1151

Config files XML format is not true XML

Post 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.

User avatar
magick
Site Admin
Posts: 11125
Joined: 2003-05-31T11:32:55-07:00

Re: Config files XML format is not true XML

Post 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.

Post Reply