[LTP] [PATCH v7 2/4] Add script to generate arch(s) dependant syscalls

pvorel pvorel@suse.de
Thu Oct 31 16:31:17 CET 2024


On 2024-10-31 15:52, Andrea Cervesato wrote:
> The kernel doesn't need to be compiled. That's done by the script via
> `make headers` command. I don't know why that is happening honestly.
> 
> On 10/31/24 14:58, Petr Vorel wrote:
>> That fails in generate_table on:
>> if [ $bits == 32 ]; then
> 
> That's because the right syntax should be (for bash):
> 
> if [[ "$bits" == "32" ]]; then

Ah, I should have caught this, I overlooked an obvious bashism. thanks 
for finding the problem.

I actually run checkbashisms before, but only when run with -f finds a 
problems:

$ checkbashisms -f include/lapi/syscalls/generate_arch.sh
possible bashism in include/lapi/syscalls/generate_arch.sh line 73 
(should be 'b = a'):
	if [ $bits == 32 ]; then
possible bashism in include/lapi/syscalls/generate_arch.sh line 83 
(should be >word 2>&1):
	gcc ${TEMP}/list-syscalls.c -U__LP64__ -U__ILP32__ -U__i386__ \
		-D${uppercase_arch} \
		-D__${arch}__ ${extraflags} \
		-I ${LINUX_HEADERS}/usr/include/ \
		-o ${TEMP}/list-syscalls &>/dev/null
possible bashism in include/lapi/syscalls/generate_arch.sh line 116 
(should be >word 2>&1):
	make -s -C ${KERNELSRC} ARCH=${arch} O=${LINUX_HEADERS} \
		headers_install &>/dev/null

"&>" is yet another bashism.

Ideally, not only checking with "checkbashisms -f", but also running 
script with dash (e.g. change shebang to #!/bin/dash) should catch most 
of the problems.


> 
> But in other shells sh compatible, probably I should use:
> 
> if [ "$bits" -eq "32" ]; then

Yes please.

> 
> 
> I'm gonna fix this.

Thanks a lot!

Kind regards,
Petr
> 
> Andrea


More information about the ltp mailing list