Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

ImageMagick-7 Policy change causes error (w/ solution) #729

Open
Dreded opened this issue Mar 26, 2024 · 0 comments
Open

ImageMagick-7 Policy change causes error (w/ solution) #729

Dreded opened this issue Mar 26, 2024 · 0 comments

Comments

@Dreded
Copy link

Dreded commented Mar 26, 2024

so ImageMagick-7 Changed the default policy to not allow writing to STDOUT....

command:

wal -i /home/user/Pictures/wallpapers/Fantasy-Landscape.png -s -t

error:

[I] image: Using image Fantasy-Landscape.png.
[I] colors: Generating a colorscheme.
[I] colors: Using wal backend.
convert: attempt to perform an operation not allowed by the security policy `-' @ error/blob.c/OpenBlob/3317.
Traceback (most recent call last):
  File "/usr/bin/wal", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/pywal/__main__.py", line 208, in main
    parse_args(parser)
  File "/usr/lib/python3.11/site-packages/pywal/__main__.py", line 163, in parse_args
    colors_plain = colors.get(image_file, args.l, args.backend,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pywal/colors.py", line 144, in get
    colors = getattr(backend, "get")(img, light)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pywal/backends/wal.py", line 86, in get
    colors = gen_colors(img)
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pywal/backends/wal.py", line 41, in gen_colors
    raw_colors = imagemagick(16 + i, img, magick_command)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pywal/backends/wal.py", line 19, in imagemagick
    return subprocess.check_output([*magick_command, img, *flags]).splitlines()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['magick', 'convert', '/home/user/Pictures/wallpapers/Fantasy-Landscape.png[0]', '-resize', '25%', '-colors', '16', '-unique-colors', 'txt:-']' returned non-zero exit status 1.

solution 1:

  • open in editor -> /etc/ImageMagick-7/policy.xml
  • change -> <policy domain="path" rights="none" pattern="-"/>
  • to -> <policy domain="path" rights="write" pattern="-"/>

solution 2 (use sed to edit in place):

  • sed -i 's/\(<policy domain="path" rights="\)none\(" pattern="-"\/>\)/\1write\2/' /etc/ImageMagick-7/policy.xml
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant