asciidoctor-diagram: [meme] 'identify failed : ' on Gitlab CI

Hello,

I’ve been trying the meme extension, working great on my Windows system.

But I’ve a problem when generating in my gitlab CI pipeline : asciidoctor-diagram: ERROR: Failed to generate image: identify failed: 1920

1920 happens to be the width of my image.

I’m installing ImageMagick using : $ apt-get update -qq && apt-get install -qq --assume-yes imagemagick

I found this piece of code in the source : dimensions = Cli.run(identify, '-format', '%w %h', bg_img)[:out].match(/(?<w>\d+) (?<h>\d+)/)

So I reproduced the command after installing ImageMagick and before using Asciidoctor, and it seems to work great :

$ identify -format "%w %h" src/docs/asciidoc/images/dont-reboot-it-just-patch.jpg
1920 1080

Tried on another image, this time a smaller PNG, same problem.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @robertpanzer! You’re a 🌟!

I think I’ve finally been able to trace the root cause of this. In a nutshell JRuby doesn’t implement spawn very reliably. Since https://github.com/jruby/jruby/commit/a467bc525f62c56696ec314aaf0d719947560798 there are cases where it joins all the arguments into a single string and uses the standard shell to execute that command. That has completely different semantics than calling spawn.

As a workaround, on Jruby, I’m going to use the Java infrastructure (ProcessBuilder) to call external processes instead.

The code runs that command and then checks the exit code. It experts it to return 0. If that’s not the case the command is considered to have failed and the output is printed. I think that’s what you’re seeing. No idea why identify is returning an error exit code. I’ll have to reread the man pages.