[tlbuild] Broken shebangs in TeX Live scripts

Henri Menke henri at henrimenke.de
Sat Apr 9 15:56:16 CEST 2022


Dear builders,

I've checked the shebangs in the scripts shipped with TeX Live for
x86_64-linux and discovered some problems. There are some shebangs that
are outright broken like "#!perl -w" and others that hardcode the path
to the executable like /bin/bash or /usr/bin/python. This won't work on
systems which have /bin merged into /usr/bin where no /bin/bash exists
or for people who use Python or Perl installations in non-standard
paths, e.g. /usr/local/bin.

In general these shebangs should all use /usr/bin/env to lookup where
to find the approriate executable in the PATH. The program /usr/bin/env
is present on all Linux and BSD systems I am aware of, so it will be
quite portable.

There is however one downside to this approach. The shebang (which is a
kernel feature) will only ever pass on the first argument to the
executable, so converting

#!/usr/bin/perl -w => #!/usr/bin/env perl -w 

will silently drop the "-w". At the same time I believe that things
like warning should be enable on the language level rather than trying
to inject commands into the invocation, because if a user runs "perl
script.pl" instead of "./script.pl" the warning will also be stripped.

Below you can find a probably non-exhaustive list of problematic
scripts in TeX Live 2022.

Kind regards,
Henri



$ 2>/dev/null grep '^#!' /opt/texlive/2022/bin/x86_64-linux/* | grep -v -e '/usr/bin/env' -e '/bin/sh'
/opt/texlive/2022/bin/x86_64-linux/a2ping:#!perl -w
/opt/texlive/2022/bin/x86_64-linux/bibexport:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/ctan-o-mat:#!/usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/ctanupload:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/de-macro:#!/usr/bin/python -O
/opt/texlive/2022/bin/x86_64-linux/dtxgen:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/exceltex:#!/usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/findhyph:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/fragmaster:#!/usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/git-latexdiff:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/installfont-tl:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/latex2man:#!/usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/latexpand:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/listbib:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/ltxfileinfo:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/makedtx:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/mathspic:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/mkt1font:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/multibibliography:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/pamphletangler:#!/usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/pdflatexpicscale:#!/usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/pdftex-quiet:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/pdfxup:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/pn2pdf:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/splitindex:#! /usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/svn-multi:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/tlcockpit:#!/bin/bash
/opt/texlive/2022/bin/x86_64-linux/ulqda:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/urlbst:#! /usr/bin/perl -w
/opt/texlive/2022/bin/x86_64-linux/vpl2ovp:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/vpl2vpl:#!/usr/bin/perl
/opt/texlive/2022/bin/x86_64-linux/yplan:#!/usr/bin/perl


More information about the tlbuild mailing list.