#!/bin/sh # # Here the output: # # | % ./im-policy-vu-332928.sh policy # | % cp policy.xml ~/.config/ImageMagick/ # | % ./im-policy-vu-332928.sh # | # | Writing potential images that needs Ghostscript... # | # | Writing wizard.epi ... # | Domain: Coder; rights=Write; pattern="PS" ... # | Writing wizard.eps ... # | Domain: Coder; rights=Write; pattern="PS" ... # | Writing wizard.eps2 ... # | Domain: Coder; rights=Write; pattern="PS2" ... # | Writing wizard.eps3 ... # | Domain: Coder; rights=Write; pattern="PS3" ... # | Writing wizard.epsf ... # | Domain: Coder; rights=Write; pattern="PS" ... # | Writing wizard.epsi ... # | Domain: Coder; rights=Write; pattern="PS" ... # | Writing wizard.ept ... # | Domain: Coder; rights=Write; pattern="EPT" ... # | Domain: Coder; rights=Write; pattern="PS" ... # | Domain: Coder; rights=Write; pattern="TIFF" ... # | Writing wizard.pdf ... # | Domain: Coder; rights=Write; pattern="PDF" ... # | Writing wizard.ps ... # | Domain: Coder; rights=Write; pattern="PS" ... # | Writing wizard.ps2 ... # | Domain: Coder; rights=Write; pattern="PS2" ... # | Writing wizard.ps3 ... # | Domain: Coder; rights=Write; pattern="PS3" ... # | # | ------------------------------------------------------- # | # | # | Reading potential images that needs Ghostscript... # | # | Reading wizard.epi ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.eps ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.eps2 ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.eps3 ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.epsf ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.epsi ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.ept ... # | Domain: Coder; rights=Read; pattern="EPT" ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.pdf ... # | Domain: Coder; rights=Read; pattern="PDF" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.ps ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.ps2 ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # | Reading wizard.ps3 ... # | Domain: Coder; rights=Read; pattern="PS" ... # | Domain: Coder; rights=Read; pattern="PNG" ... # # When writing PS2 and PS3 appears but ghostscript does not seem to be used # according a code inspection. # # Test image wizard_image="/usr/pkg/share/doc/ImageMagick-7/images/wizard.png" export MAGICK_DEBUG=Policy # # Generate a policy.xml file that permits all coders disabled by VU#332928 # () # generate_policy() { cat << EOF ]> EOF } main() { case "$1" in policy) generate_policy > policy.xml echo "Please copy policy.xml in ~/.config/ImageMagick/ to test" echo "this script. (And, remember to remove it!)" ;; *) # The formats are all the ones from `Formats @ ImageMagick' # that in the Notes field states that they need Ghostscript. echo echo "Writing potential images that needs Ghostscript..." echo for format in epi eps eps2 eps3 epsf epsi ept pdf ps ps2 ps3; do echo "Writing wizard.${format} ..." convert -log "%e" "${wizard_image}" \ "wizard.${format}" 2>&1 | grep -F 'Coder; rights=Write;' done echo echo "-------------------------------------------------------" echo echo echo "Reading potential images that needs Ghostscript..." echo for format in epi eps eps2 eps3 epsf epsi ept pdf ps ps2 ps3; do echo "Reading wizard.${format} ..." convert -log "%e" "wizard.${format}" \ /dev/null 2>&1 | grep -F 'Coder; rights=Read;' done ;; esac } main $@