Commit 3b666385 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 f58c9938
......@@ -32,6 +32,7 @@
import os
import subprocess
import re
from cStringIO import StringIO
from AccessControl import ClassSecurityInfo
......@@ -387,6 +388,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