Skip to content

checkbashisms.pl in make check + fixed docs

Joerg Vehlow ltp 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 4 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 4 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [LTP] [PATCH 0/4] checkbashisms.pl in make check + fixed docs

H Petr,

Quoted 9 lines · Petr Vorel
Quoted 7 lines
$ checkbashisms testcases/kernel/connectors/pec/cn_pec.sh
possible bashism in testcases/kernel/connectors/pec/cn_pec.sh line 127
(should be >word 2>&1):
 ??????????????? done <&${fd_act}
This one is just a false positive and I have no clue how to prevent this.
I think the script does not like the <&, but this is posix...

The same here, I'm not sure if it's POSIX. &> definitely is not POSIX. I remember we were talking about it. Can we avoid it somehow?

<&n is the only way to use the file handle n for input. <n would use the file n.
See:
https://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html#tag_02_07_05

checkbashisms has no problems if n is a number, not a variable. There is nothing in the standard about n being a variable, but I guess this should be posix as well.
Furthermore the suggested fix "(should be >word 2>&1)" clearly shows, that checkbashisms thinks, this is &>.

I don't see another way to implement this (but using an implementation in c). And I am not really happy to bend my code around bugs in a tool, that is supposed to ensure better code.
I'd rather try to fix checkbashims in this case. Even the ((-case should be fixed, after checking if it is posix. The suggestion (replace with "$((") indicates at least a bug in the tool.
To be honest, I am a bit disappointed from this tool. It doesn't seem to be tested very well... Probably barely good enough for scripting in the kernel.

Joerg