From patchwork Tue Jan 15 20:30:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Torsten_B=C3=B6gershausen?= X-Patchwork-Id: 10765141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 343DB14E5 for ; Tue, 15 Jan 2019 20:30:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 253082DC3E for ; Tue, 15 Jan 2019 20:30:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 197D32DC52; Tue, 15 Jan 2019 20:30:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83C3F2DC4D for ; Tue, 15 Jan 2019 20:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389817AbfAOUau (ORCPT ); Tue, 15 Jan 2019 15:30:50 -0500 Received: from mout.web.de ([212.227.15.3]:46399 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732336AbfAOUat (ORCPT ); Tue, 15 Jan 2019 15:30:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1547584241; bh=0ZeB7zF21atpQw5xZcOMfST0sU1/x0H1RZQiPynSvr8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=NSMWcr86TLebiaiocvVTNXwxdMrCy//Pw3+4Dwhs5Mz9HmMjGnIxsMnMh3yEAwmUP bhCsibE9S6kL5R89oOyB1qPmeP6dsD5jurYcGgVUIIGLLyKMwaVHWoN5UuYw/vB/Ne iKcMNmRhIvE757IBkdgYdl5u5MNMODOZrv0Y/n2A= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from localhost.localdomain ([195.198.252.176]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MUnqm-1gkbG92oRw-00Y84a; Tue, 15 Jan 2019 21:30:41 +0100 From: tboegi@web.de To: git@vger.kernel.org, szeder.dev@gmail.com, zhiyou.jx@alibaba-inc.com Cc: =?utf-8?q?Torsten_B=C3=B6gershausen?= Subject: [PATCH/RFC v1 1/1] test-lint: sed -E (or -a, -l) are not portable Date: Tue, 15 Jan 2019 21:30:38 +0100 Message-Id: <20190115203038.10574-1-tboegi@web.de> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190110115704.GL4673@szeder.dev> References: <20190110115704.GL4673@szeder.dev> MIME-Version: 1.0 X-Provags-ID: V03:K1:B+EyBHW2sRLAwprBLk9u5nOHJ3cm+4h9vi4sVXpQIWAJFMSOcYV YZbDJZwMK6fkg0fL70cYRly1SlEt8ymjxE5eK347haBzumwncVpwWDyawGyFsNblCNE8Ne3 tOSkbG7LM1DCNQXU7vQ1dreNUEVkAgLjlr7QGcfcQQFnIMBCP98VulqN2P0OnXWwPB9waLl PKY3YvJy5n2/DBAibULKw== X-UI-Out-Filterresults: notjunk:1;V03:K0:qpQU8fohTUw=:y2+kpc9AOsHtcLcDbfDbx+ Xi9pRjRRg05idlvc5r2yAovMWZ/YwA/6ppWEYbL2zK8Biei+2sUvXishQCCePksqCjfLrvntP 1vz/2n00bFEdXO54WyeUhrPE8cf/EkyRyd8VtRVw01NhswaiSzZsf76nttNLEG4VmBFkpSSCs vUulmICJ7mbiR6O00f9dhQlyeSy7/CMj8Pl8RpJUieYYlXZzu13Gk6pDSsJt81Hn5dsy6vk+a Zixvrf1pyn1Nu0+6C5Qx9SKjXj06mJUUFcFvxzksuUjq2pk8cmj9SkrVv9ppW7cN20/mkw/UT cEWzv5ZHM7JiKyFnZDAEd1LmwpWqln9e4NlE//H8rUfEsbGFSMu8MMO6JiNBToE4nxMwb0Mx7 QHSzybzCFN29OWaY6zmrVSwiF7uGtPvMeL1ty90jQOO1oz6UUJocnAJEZYnQV7OmZUJAdj7cm 7/Bh3Viv6ad0iNY4BjgEF7REyxFnaM7mnLc9mto1f1eCj30t1C7MGSL96UhS36cmcmzvLN91n LdDmYeOwlBY/DM8nl1BxuQc0PxAgoxNTZSqN29i8r5esWYF+24qdFD5Dg7EWEfGU8ueg4v2Io W64GXU3lTs2kdLKCZxaGK8UNJxqrfwPgBQwZNX/9ZQfnoNHERbszuUWGABVa3a9f22S3134BM 6kaL1WFdJqoBs44Pvjog9LhirYSQjmKaf4TWR7rl1UKP/MKXsnVpLzSqx2X+mWDI20BhN22sU bd4JGAtnQ5HvHL2sbualwaBTzOfgpneoydVRD5Uh1TxYf0HGkF480daUx496G3UMqTwUiR932 GSNxHcxyzFw9w6IXHeBmdrUQUzJo6AipEtlYSvkf0jbWhEbIy3X9IMjG/rJz+Vzr39ysXJYSr 94dgYMK1O6qaRPgUE7xD004qdAArr5aCTbVlPCqbaeVl2Y+Nup6jheBIziyTS7 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Torsten Bögershausen 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. From `man sed` on a Linux box: REGULAR EXPRESSIONS POSIX.2 BREs should be supported, but they aren't completely because of performance problems. The \n sequence in a regular expression matches the newline character, and similarly for \a, \t, and other sequences. The -E option switches to using extended regular expressions instead; the -E option has been supported for years by GNU sed, and is now included in POSIX. Well, there are still a lot of systems out there, which don't support it. Beside that, see IEEE Std 1003.1TM-2017 http://pubs.opengroup.org/onlinepubs/9699919799/ does not mention -E either. To be on the safe side, don't allow it. Reported-by: SZEDER Gábor Signed-off-by: Torsten Bögershausen --- I am somewhat unsure if we should disable all options except -e -f -n instead ? /\bsed\s+-[^efn]/ and err 'Not portable option with sed. Only -n -e -f are portable'; That would cause a false positive in t9001 here: "--cc-cmd=./cccmd-sed --suppress-cc=self" which could either be fixed by an anchor: /^\s*sed\s+-[^efn]/ Or by allowing '--' like this: /\bsed\s+-[^-efn]/ Any thoughts, please ? t/check-non-portable-shell.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1.2.gb21ebb671 diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index b45bdac688..96b6afdeb8 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -35,7 +35,7 @@ sub err { chomp; } - /\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)';