Re: PATCH: silence Shellcheck warning
Jacob Bachmeyer <[email protected]>
| Newsgroups | gmane.comp.sysutils.automake.patches |
|---|---|
| Message-ID | <[email protected]> |
Ben Elliston wrote: > On Tue, Jan 18, 2022 at 04:18:52AM -0500, Mike Frysinger wrote: > > >> that said, automake targets lower than POSIX, so i agree that we >> should leave it be for automake specifically. feel like posting a >> patch to suppress this particular check in lib/missing instead ? >> > > If it's welcome, sure. Some people are opposed to littering pragmas > through source files to disable linters that they think do more harm > than good. While I agree that Shellcheck's value is questionable, for the issues here there is no need to litter the file with pragmas. Shellcheck will consider a pragma before the first executable line in the file to apply to the entire file; I used this when reverting $() to backticks in config.guess and have included the relevant excerpt below; the"shellcheck disable" line would similarly apply to missing but the rationale would need to be revised to explain the different issues. 8<------ diff --git a/config.guess b/config.guess index d2bdee7..4bc8157 100755 --- a/config.guess +++ b/config.guess @@ -2,6 +2,8 @@ # Attempt to guess a canonical system name. # Copyright 1992-2021 Free Software Foundation, Inc. +# shellcheck disable=SC2006,SC2268 # see below for rationale + timestamp='2021-05-24' # This file is free software; you can redistribute it and/or modify it @@ -32,6 +34,14 @@ timestamp='2021-05-24' # Please send patches to <[email protected]>. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=$(echo "$0" | sed -e 's,.*/,,') usage="\ 8<------ -- Jacob