[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GROUPS
From: |
Greg Wooledge |
Subject: |
Re: GROUPS |
Date: |
Mon, 9 Aug 2021 22:52:12 -0400 |
On Mon, Aug 09, 2021 at 10:00:25PM -0400, Franklin, Jason wrote:
> I did not write the scripts in question. These were actually Debian
> package maintainer scripts that started failing.
>
> Perhaps I'll get a test added to "checkbashisms" that looks for this.
A bug report against that Debian package would be in order.
This isn't a bashism, really. It's simply a badly written shell script,
and it could fail if run under some other POSIX-compatible shell that
happens to define a special behavior for any of the other badly chosen
variables in the script.
If on the other hand "checkbashisms" is really a "check for anything
that was done wrong" linter, a la shellcheck, then sure, it would be
worth adding "don't use all-caps variables" to it.
> If I run a script against a POSIX-compliant (PC) shell using only PC
> syntax/features and then I run the same script with Bash in PC mode, I
> would expect an identical result. To me, anything else indicates a bug
> in one of the shells. Perhaps this assessment is naive.
Sadly, it is. POSIX defines a minimal set of behaviors that all compliant
shells (and certain utilities) must implement. Shells and other programs
are allowed to implement additional features (extensions), and *all*
shells do this. There is no such thing as a "strictly POSIX sh". Even
dash and busybox sh have extensions.
It's up to the script writer to ensure that they only use portable
features and good practices. No linter is ever going to catch every
problem.
- GROUPS, Franklin, Jason, 2021/08/09
- Re: GROUPS, Greg Wooledge, 2021/08/09
- Re: GROUPS, Franklin, Jason, 2021/08/09
- Re: GROUPS, Chet Ramey, 2021/08/11
- Re: GROUPS, Robert Elz, 2021/08/11
- Re: GROUPS, Chet Ramey, 2021/08/11
- Re: GROUPS, Robert Elz, 2021/08/12
Re: GROUPS, Chet Ramey, 2021/08/10