grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.58k stars 322 forks source link

faust2au: uses POSIX shell but includes bash-scripts #762

Closed umlaeute closed 2 years ago

umlaeute commented 2 years ago

faust2au declares to be a POSIX shell script https://github.com/grame-cncm/faust/blob/91aa53805b51d4f11feb8030b21bd6baca98e81b/tools/faust2appls/faust2au#L1

however, it includes usage.sh, which is a bash script https://github.com/grame-cncm/faust/blob/91aa53805b51d4f11feb8030b21bd6baca98e81b/tools/faust2appls/usage.sh#L1

not only does the shebang point to bash, it is also full of bashisms:

$ checkbashisms usage.sh 
possible bashism in usage.sh line 2 ('function' is useless):
function usage() {
possible bashism in usage.sh line 9 ('function' is useless):
function platform() {
possible bashism in usage.sh line 13 ('function' is useless):
function require() {
possible bashism in usage.sh line 17 ('function' is useless):
function options() {
possible bashism in usage.sh line 25 ('function' is useless):
function option() {

not only is "'function' is useless", but it is obviously harmful on some systems. E.g. here i get a syntax error:

$ faust2au freeverb.dsp
faust2au: 3: usage.sh: Syntax error: "(" unexpected

(i'm running this on linux, and faust2au obviously won't produce any meaningful results later on, but i don't think this is a valid reason to not fix the issue at hand).

the simple fix is to just change the shebang of faust2au to bash:

#!/usr/bin/env bash 

the (imho) better fix is to remove the bashisms from the common script snippets.

sletz commented 2 years ago

PR welcome.