Re: [PATCH/RFC v1 1/1] test-lint: sed -E (or -a, -l) are not portable
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jan 15, 2019, 21:09 UTC
- Message-ID
- <CAPig+cSeDNYFGYC2WznjW3zYMJCWZbZFY1KM5H5ir2L=Jxwy7w@mail.gmail.com>
- In-Reply-To
- <20190115203038.10574-1-tboegi@web.de>
On Tue, Jan 15, 2019 at 3:31 PM <tboegi@web.de> wrote:
Show 15 quoted lines
> From `man sed` (on a Mac OS X box):
> The -E, -a and -i options are non-standard FreeBSD extensions and may not be available
> on other operating systems.
> [...]
> To be on the safe side, don't allow it.
>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
> diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
> @@ -35,7 +35,7 @@ sub err {
> - /\bsed\s+-i/ and err 'sed -i is not portable';
> + /\bsed\s+-[Eail]/ and err 'Not portable option with sed. Only -e -f -n are portable';
> /\becho\s+-[neE]/ and err 'echo with option is not portable (use printf)';
> /^\s*declare\s+/ and err 'arrays/declare not portable';
> /^\s*[^#]\s*which\s/ and err 'which is not portable (use type)';Please update the new message to be more consistent with existing surrounding error messages. For instance:
err 'sed -i/-a/-l/-E not portable (use only -e/-f/-n)'
or something. Thanks.