All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 5/5] checkbashisms: Disable 'type' check
@ 2021-09-02 11:58 Petr Vorel
  2021-09-02 13:33 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2021-09-02 11:58 UTC (permalink / raw)
  To: ltp

'type' is part of POSIX, but as part of the X/Open Systems Interfaces
option (XSI). The checkbashisms man page explicitly says:

	Note that the definition of a bashism in this context roughly
	equates to "a shell feature that is not required to be supported
	by POSIX"; this means that some issues flagged may be permitted
	under optional sections of POSIX, such as XSI or User Portability.

'type' is flagged because it is an optional feature. But because it's
supported by all common shells (i.e.  > bash, zsh, dash, busybox sh,
mksh) we use it even in the library => disable the check.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

follow up to patchset "checkbashisms.pl in make check + fixed docs" [1].

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/list/?series=260711

 scripts/checkbashisms.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index ba417c993..6dc762cb7 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -675,7 +675,8 @@ sub init_hashes {
         $LEADIN . qr'shopt(\s|\Z)'       => q<shopt>,
         $LEADIN . qr'suspend\s'          => q<suspend>,
         $LEADIN . qr'time\s'             => q<time>,
-        $LEADIN . qr'type\s'             => q<type>,
+        # LTP supports type
+        # $LEADIN . qr'type\s'             => q<type>,
         $LEADIN . qr'typeset\s'          => q<typeset>,
         $LEADIN . qr'ulimit(\s|\Z)'      => q<ulimit>,
         $LEADIN . qr'set\s+-[BHT]+'      => q<set -[BHT]>,
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 5/5] checkbashisms: Disable 'type' check
  2021-09-02 11:58 [LTP] [PATCH 5/5] checkbashisms: Disable 'type' check Petr Vorel
@ 2021-09-02 13:33 ` Cyril Hrubis
  2021-09-03 10:30   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2021-09-02 13:33 UTC (permalink / raw)
  To: ltp

Hi!
Looks good.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 5/5] checkbashisms: Disable 'type' check
  2021-09-02 13:33 ` Cyril Hrubis
@ 2021-09-03 10:30   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2021-09-03 10:30 UTC (permalink / raw)
  To: ltp

Hi Cyril,

> Hi!
> Looks good.

> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

Looks like 'command -v' which is POSIX works (tested in bash, dash, busybox sh
and android shell), thus I suggest to drop this patch and use 'command -v'
instead of 'type'.

$ foo(){ echo "in foo";}
$ command -v foo
foo

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-03 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02 11:58 [LTP] [PATCH 5/5] checkbashisms: Disable 'type' check Petr Vorel
2021-09-02 13:33 ` Cyril Hrubis
2021-09-03 10:30   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.