yadm
yadm copied to clipboard
sh POSIX compliance
Currently you can't use yadm with a non bash shell. With Shellcheck you can check for POSIX compliance.
This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Hi, Im Debian maintainer of yadm package, and I have the same problem, lintian output:
N:
I: yadm: bash-term-in-posix-shell '! shopt' [usr/bin/yadm:1927]
N:
N: This script is marked as running under /bin/sh, but it seems to use a feature found in bash but not in the SUSv3 or POSIX shell specification.
N:
N: Some examples are:
N:
N: - == in a test, it should use = instead - read without a variable in the argument - function to define a function - source instead of . - . command args,
N: passing arguments to commands via source is not supported - {foo,bar} instead of foo bar - [[ test ]] instead of [ test ] (requires a Korn shell) - type
N: instead of which or command -v
N:
N: Visibility: info
N: Show-Always: no
N: Check: shell/non-posix/bash-centric
N:
N:
I: yadm: bash-term-in-posix-shell '$(<$PROC_VERSION)' [usr/bin/yadm:1760]
N:
I: yadm: bash-term-in-posix-shell '$BASH_VERSION' [usr/bin/yadm:1455]
N:
I: yadm: bash-term-in-posix-shell ... use --no-tag-display-limit to see all (or pipe to a file/program)
https://lintian.debian.org/sources/yadm
@angelabad - Despite the #!/bin/sh
shebang line, yadm is presently written in Bash. Any linting done, should be configured to interpret it as Bash.
The shebang line is done this way today for maximum portability between many systems which do not have a standard location for bash, but do have a standard location for sh. If /bin/sh
isn't actually Bash, Bash is still executed.
There may come a time that yadm is rewritten for POSIX sh, but until then it uses many Bash specific features.
I'm not familiar with Lintian Reports, but if this is a requirement for packaging, I recommend either.
- Finding a way to configure the linting system to understand yadm to be using Bash
- or replacing the shebang line just prior to packaging with the Debian path for Bash
So, we don't want to consider
#!/usr/bin/env bash
as https://en.wikipedia.org/wiki/Env says hardcoding the location as /usr/bin/env
"suffers from the same problem in that the path to the env binary may also be different on a per-machine basis" ?
Is env in a non-standard location common? I see #!/usr/bin/env bash
used almost everywhere.
I have found /bin/sh to be ubiquitous, where /usr/bin/env is not.
You can see some of the history here:
https://github.com/TheLocehiliosan/yadm/issues/14
@TheLocehiliosan Gotcha, thx. I never got yadm to work under Busybox, but have successfully used it under iSH.
Hi @TheLocehiliosan, on Debian I solved the problem patching shebang, but I think yamd could get errors on others systems, like alpine linux, *BSD, etc.. These systems don't have sh compatible with bash.