From fb9cea50e8b370b6931e7b53b1a881d3b95b1c91 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 13 Dec 2019 11:32:46 +0100 Subject: main: enforce options before commands This patch turns on POSIXLY_CORRECT on the getopt parser to enforce options before commands. Users get a hint in such a case: # nft list ruleset -a Error: syntax error, options must be specified before commands nft list ruleset -a ^ ~~ This patch recovers 9fc71bc6b602 ("main: Fix for misleading error with negative chain priority"). Tests have been updated. Signed-off-by: Pablo Neira Ayuso --- tests/shell/testcases/optionals/comments_0 | 2 +- tests/shell/testcases/optionals/comments_handles_0 | 2 +- tests/shell/testcases/optionals/delete_object_handles_0 | 4 ++-- tests/shell/testcases/optionals/handles_0 | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/shell/testcases/optionals') diff --git a/tests/shell/testcases/optionals/comments_0 b/tests/shell/testcases/optionals/comments_0 index 29b85062..ab859365 100755 --- a/tests/shell/testcases/optionals/comments_0 +++ b/tests/shell/testcases/optionals/comments_0 @@ -5,4 +5,4 @@ $NFT add table test $NFT add chain test test $NFT add rule test test tcp dport 22 counter accept comment test_comment -$NFT list table test -a | grep 'accept comment \"test_comment\"' >/dev/null +$NFT -a list table test | grep 'accept comment \"test_comment\"' >/dev/null diff --git a/tests/shell/testcases/optionals/comments_handles_0 b/tests/shell/testcases/optionals/comments_handles_0 index 30539bf0..a01df1df 100755 --- a/tests/shell/testcases/optionals/comments_handles_0 +++ b/tests/shell/testcases/optionals/comments_handles_0 @@ -6,5 +6,5 @@ $NFT add table test $NFT add chain test test $NFT add rule test test tcp dport 22 counter accept comment test_comment set -e -$NFT list table test -a | grep 'accept comment \"test_comment\" # handle '[[:digit:]]$ >/dev/null +$NFT -a list table test | grep 'accept comment \"test_comment\" # handle '[[:digit:]]$ >/dev/null $NFT list table test | grep 'accept comment \"test_comment\"' | grep -v '# handle '[[:digit:]]$ >/dev/null diff --git a/tests/shell/testcases/optionals/delete_object_handles_0 b/tests/shell/testcases/optionals/delete_object_handles_0 index d5d96547..a2ae4228 100755 --- a/tests/shell/testcases/optionals/delete_object_handles_0 +++ b/tests/shell/testcases/optionals/delete_object_handles_0 @@ -10,8 +10,8 @@ $NFT add quota ip6 test-ip6 http-quota over 25 mbytes $NFT add counter ip6 test-ip6 http-traffic $NFT add quota ip6 test-ip6 ssh-quota 10 mbytes -counter_handle=$($NFT list ruleset -a | awk '/https-traffic/{print $NF}') -quota_handle=$($NFT list ruleset -a | awk '/ssh-quota/{print $NF}') +counter_handle=$($NFT -a list ruleset | awk '/https-traffic/{print $NF}') +quota_handle=$($NFT -a list ruleset | awk '/ssh-quota/{print $NF}') $NFT delete counter test-ip handle $counter_handle $NFT delete quota ip6 test-ip6 handle $quota_handle diff --git a/tests/shell/testcases/optionals/handles_0 b/tests/shell/testcases/optionals/handles_0 index 7c6a437c..80f3c5b2 100755 --- a/tests/shell/testcases/optionals/handles_0 +++ b/tests/shell/testcases/optionals/handles_0 @@ -5,4 +5,4 @@ $NFT add table test $NFT add chain test test $NFT add rule test test tcp dport 22 counter accept -$NFT list table test -a | grep 'accept # handle '[[:digit:]]$ >/dev/null +$NFT -a list table test | grep 'accept # handle '[[:digit:]]$ >/dev/null -- cgit v1.2.3