Re: [PATCH v5 02/13] syscalls: Create unified partial table for all archs

[email protected]
Newsgroups org.kernel.vger.linux-s390
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The use of bash process substitution `< <(...)` in a `#!/bin/sh` script will cause syntax errors on systems using strict POSIX shells like `dash`.
--

--- Patch [2]: [PATCH v5 02/13] syscalls: Create unified partial table for all archs ---
commit 47d67094b1a192ac92926cb745138546b214b614
Author: André Almeida <[email protected]>

syscalls: Create unified partial table for all archs

This commit introduces a shared syscall table for system calls common to all
architectures. It also modifies the generation scripts to support combining a
main table with the common table.

> diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
> index bad1ab606a0fb..54e09d3e686c4 100755
> --- a/scripts/syscallhdr.sh
> +++ b/scripts/syscallhdr.sh

[ ... ]

> @@ -84,15 +111,20 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
>  		fi
>  
>  		echo "#define __NR_$prefix$name $nr"
> -	done
>  
> -	if [ -n "$emit_nr" ]; then
> -		echo
> -		echo "#ifdef __KERNEL__"
> -		echo "#define __NR_${prefix}syscalls $(($max + 1))"
> -		echo "#endif"
> -	fi
> +	done < <(grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input")

[Severity: High]
Does this < <(...) process substitution in gen_hdr() break POSIX shell
compatibility?

Because this script is executed with #!/bin/sh, using bashisms like < <(...)
will cause a syntax error on systems where /bin/sh is a strict POSIX shell
like dash, breaking the build.

> +}
>  

[ ... ]

> diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
> index c4b1f85c2dd63..91c135143b22f 100755
> --- a/scripts/syscalltbl.sh
> +++ b/scripts/syscalltbl.sh

[ ... ]

> @@ -88,5 +97,13 @@ grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
>  			echo "__SYSCALL($nr, sys_ni_syscall)"
>  		fi
>  		nxt=$((nr + 1))
> -	done
> -} > "$outfile"
> +
> +	done < <(grep -E "^[0-9]+[[:space:]]+$abis" "$input")

[Severity: High]
Similarly, does this process substitution in gen_tbl() cause a syntax error on
dash or other strict POSIX shells?

> +
> +}
> +
> +gen_tbl $infile  > "$outfile"

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.