Although xmlto uses #!/bin/sh as a shebang, it uses various features that are not part of the Posix shell standard.
#!/bin/sh
For example it uses local to declare lexical scope variables, or indirection${!2}. A quick look at the script code suggest that it assumes /bin/sh is bash, so it would make more sense for the shebang to explicitly use /bin/bash instead of masquerading as a Posix shell script.
local
${!2}
/bin/sh
/bin/bash
Thanks for report, I think xmlto.in uses @BASH@ variable for shebang which is specified during the configure time. Can you please be more specific what version of xmlto do you refer to and which of the scripts is affected? I think at least in Fedora/RHEL xmlto script has #!/bin/bash shebang.
Hello,
I digged a bit further, and xmlto ends up with /bin/sh in the shebang if /bin/sh links to bash while configuring, else it will use /bin/bash.
The reason is that configure checks the BASH env var, and configure runs in /bin/sh. if /bin/sh is bash, we have BASH=/bin/sh in the env var as it looks like bash sets BASH to whatever argv[0] was when it started. (try it, run /bin/bash -c 'echo $BASH', then run /usr/x86_64-pc-linux-gnu/bin/bash -c 'echo $BASH').
BASH
BASH=/bin/sh
argv[0]
/bin/bash -c 'echo $BASH'
/usr/x86_64-pc-linux-gnu/bin/bash -c 'echo $BASH'
I suspect the root of the problem is the use of BASH as a name in AC_ARG_VAR and AC_ARG_PATH in configure.in. It collides with that BASH env var that bash sets.
AC_ARG_VAR and AC_ARG_PATH
I experience that on exherbo linux by the way, xmlto 0.0.28.
Ok, understood, so way to solve it would be to extend the configuration variables so they are not that "collision vulnerable". Makes sense to me, will add this to todo list...
How about fixing this now? It's been over six years.
It should be fixed in the new PR. https://pagure.io/xmlto/pull-request/13 Merging soon.
This should be fixed now upstream.
Metadata Update from @osloup: - Issue status updated to: Closed (was: Open)