Skip to content

Making the ABC Plugin work on a Hosted Account

First Pass

After installing the ABC Plugin for Dokuwiki, I saw this message in my wiki:

(abc2ps) is not executable.
(im_convert) is not executable.
(abc2midi) is not executable.
If you do not want to install it, you can change the displayType to '0' ('image only').

These errors were caused by binaries not being executable by my user ID. So I put in a support request to my hosting service. They installed the abc package and told me I already had execute permissions on the convert binary.

I was still getting errors saying '(im_convert) is not executable' at the top of my wiki page. So I went to the source and found a [suspected] problem. In the <dokuwiki>/lib/plugins/abc/syntax.php file, line 153-4 reads like this:

if (!is_executable($conf['im_convert'])) {
    $error .= $conf['im_convert']." (im_convert) is not executable.<br />";
}

This is inside the checkExecs() function, where all the binaries are being checked to see if they are executable. Only problem is, all the other binaries are being checked using a slightly different syntax, like this:

if (!is_executable($this->getConf('ps2pdf'))) ...

The difference seems to be $conf[..] versus this->getConf('..'). So I commented out the original two lines and replaced it with this:

if (!is_executable($this->getConf('im_convert'))) {
    $error .= $this->getConf('im_convert')." (im_convert) is not executable.<br />";
}

Now I don't get error messages in the wiki page. But...I also don't see the sheet music. More research needed.

Second Pass

After logging in with SSH, I discovered that not all of the binaries were available to me. So I contacted support and they corrected the issue. But again, no sheet music. I decided to create an abc file in my home directory and run the abc2ps and ps2pdf processes manually.

cfreyer@hurley [~/abc]# abc2ps thisisatest.abc
thisisatest.abc: [1]
+++ Underfull (393pt of 493pt) in staff 1
Test -
Output written on Out.ps (1 page, 1 title, 23716 bytes)
cfreyer@hurley [~/abc]# ls
./  ../  Out.pdf  Out.ps  maryhadalittlelamb.abc  thisisatest.abc
cfreyer@hurley [~/abc]# ps2pdf Out.ps
Error: /invalidfont in findfont
Operand stack:
   Times-Bold   Font   Times-Bold   919718   Times-Bold   --nostringval--   Times-Bold   NimbusRomNo9L-Medi   Courier   NimbusMonL-Regu
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1   3   %oparray_pop   2   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   5   4   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   1   -1   1   --nostringval--   %for_neg_int_continue
Dictionary stack:
   --dict:1121/1686(ro)(G)--   --dict:0/20(G)--   --dict:70/200(L)--   --dict:17/17(ro)(G)--   --dict:1121/1686(ro)(G)--
Current allocation mode is local
Last OS error: 2
Current file position is 166
GPL Ghostscript 8.54: Unrecoverable error, exit code 1

Basically, this means the Times* fonts are missing and ps2pdf can't do its job. So I sent off another ticket to the support team.

Third Pass

The support team gave me access to the GhostScript fonts, and voila-- the plugin started working properly. Looking back, I'm not sure that my modifications above were necessary. I think the whole problem was that the command line operations weren't successful but the failures weren't being reported to the GUI. Some of this has to do with the plugin's design, and some has to do with PHP4 and its lack of exception handling.

Note to others trying to resolve issues: pages are delivered to your browser from the Dokuwiki cache. When debugging, be sure to put a random key/value on the end of your URL (i.e. '&x=4') to defeat the cache mechanism.