mptopdf script in metapost broken

In Tubleweed, the mptopdf perl script is broken. Whenever one runs mptopdf, it throws a tantrum and complains about -S not being an option known to the shell. So why is the shell executed rather than perl?

The original script from CTAN starts with the usual perl invocation magic:


eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
        if 0;

which works perfectly. But then someone added a #! line:


#! /bin/sh
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
        if 0;

which does not work. This person did not read the manual page for perl, which states specifically that perl executes the shell it finds on the #!-line if it does not find the word “perl”. So the magic code runs perl, perl parses the first line and sees “/bin/sh” and no mention of perl, and immediately runs /bin/sh with the same options it itself received.

The perlrun(1) manual page also explains how to fix this: add a second #! line that contains the word perl. So the correct invocation would be:


#! /bin/sh
#! -*-perl-*-
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
        if 0;

This last version actually works. Note that the second line, although a comment, is essential! It cannot be left out…

Someone please fix this, it’s such a pain to have to fix the script each time the package is updated…

if you want that fixed report the above here
https://bugzilla.opensuse.org/