I was trying out the utmac package today on an Ubuntu system with latest
neatroff. While -mul works fine and produces nice output, -muh
causes the following errors:

  sh: 1: Bad substitution
  neatroff: failed to open </tmp/tmpl-ul.tr-head.tr>
  rm: cannot remove '/tmp/tmpl-ul.tr-head.tr': No such file or directory

This is caused by this line in uh.tmac:

  .     sy str="\\$2" && echo ".ds head-str ${str: -1}" >  
/tmp/\\*[data-file]-head.tr

neatroff invokes system() which passes the command string to /bin/sh,
which on Debian-based distributions is dash, which apparently doesn't
support ${str: -1} style substitutions.

I'm not sure what's the best fix here. Since it's not easily possible to
change what system() does, perhaps the substitution should be replaced
by some kind of pipeline?

I'm no troff expert, but maybe it would be safer to also use .co> to
stash $2 into a temporary file to avoid shell quoting issues?

 -Valtteri
 

Reply via email to