Commit 938400c8 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Xiaowu Zhang

XXX hack to avoid imagemagick conversion errors

convert: not authorized `/tmp/magick-21492bHsMuWjOhmCg' @ error/constitute.c/ReadImage/416.
convert: no images defined `png:-' @ error/convert.c/ConvertImageCommand/3253.
parent aa4a1d3e
......@@ -33,6 +33,7 @@
import os
import struct
import subprocess
import re
from cStringIO import StringIO
from AccessControl import ClassSecurityInfo
......@@ -359,6 +360,15 @@ class Image(TextConvertableMixin, File, OFSImage):
env = os.environ.copy()
env.update({'LC_NUMERIC':'C'})
##### BEGIN WORKAROUND XXX##
# To avoid such an error
# convert: not authorized `/tmp/magick-21492bHsMuWjOhmCg' @ error/constitute.c/ReadImage/416.
# convert: no images defined `png:-' @ error/convert.c/ConvertImageCommand/3253.
if "LD_PRELOAD" in env:
env["LD_PRELOAD"] = re.sub(r"(^|:)[^:]+/parts/userhosts/userhosts(:|$)", r"\2", env["LD_PRELOAD"])
if env["LD_PRELOAD"] == "":
del env["LD_PRELOAD"]
##### END WORKAROUND #####
process = subprocess.Popen(parameter_list,
env=env,
stdin=subprocess.PIPE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment