public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v7 2/4] Add script to generate arch(s) dependant syscalls
Date: Thu, 31 Oct 2024 14:58:14 +0100	[thread overview]
Message-ID: <20241031135814.GB1049242@pevik> (raw)
In-Reply-To: <20241031-generate_syscalls-v7-2-f3e26c06814e@suse.com>

Hi Andrea,

> --- /dev/null
> +++ b/include/lapi/syscalls/generate_arch.sh
> @@ -0,0 +1,211 @@
> +#!/bin/sh
Also here would be nice to use -eu (I know it's a script originated from
elsewhere)...

> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# This is an adaptation of the update-tables.sh script, included in the
> +# syscalls-table project (https://github.com/hrw/syscalls-table) and released
> +# under the MIT license.
> +#
> +# Author: Andrea Cervesato <andrea.cervesato@suse.com>
> +
> +KERNELSRC="$1"

... but that would require instead of this to check like this before using $1:

if [ $# -eq 0 ]
	echo "Please provide kernel sources:"
	echo ""
	echo "$0 path/to/Linux/kernel/sources"
	echo ""
	exit 1
fi

Also running with dash I get failures:

$ ./include/lapi/syscalls/generate_arch.sh ../linux
...
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm/unistd*.h: No such file or directory
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm-generic/unistd.h: No such file or directory
./include/lapi/syscalls/generate_arch.sh: 73: [: 64: unexpected operator
./include/lapi/syscalls/generate_arch.sh: 85: /tmp/tmp.sVfa08a9De/list-syscalls: not found
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm/unistd*.h: No such file or directory
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm-generic/unistd.h: No such file or directory
./include/lapi/syscalls/generate_arch.sh: 73: [: 32: unexpected operator
./include/lapi/syscalls/generate_arch.sh: 85: /tmp/tmp.sVfa08a9De/list-syscalls: not found
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm/unistd*.h: No such file or directory
grep: /tmp/tmp.sVfa08a9De/headers/usr/include/asm-generic/unistd.h: No such file or directory
./include/lapi/syscalls/generate_arch.sh: 73: [: 32: unexpected operator
/tmp/tmp.sVfa08a9De/list-syscalls.c: In function 'main':
/tmp/tmp.sVfa08a9De/list-syscalls.c:11:32: warning: missing terminating " character
   11 |                         printf("_llseek %d
      |                                ^
/tmp/tmp.sVfa08a9De/list-syscalls.c:12:1: warning: missing terminating " character
   12 | ", __NR__llseek);
      | ^

That fails in generate_table on:
if [ $bits == 32 ]; then

When I use "!/bin/sh -eux" I see:

make -s -C /home/foo/sources/linux ARCH=alpha O=/tmp/tmp.G3HzE6EnFu/headers headers_install
grep: /tmp/tmp.G3HzE6EnFu/headers/usr/include/asm/unistd*.h: No such file or directory

This looks like it requires to have build kernel before running this script,
right? (I have 6.12-rc4 in the kernel directory). As a result of running the
script are empty include/lapi/syscalls/*.in files.

Again, it can be a combination of some problem with my environment (some
variable set or shell setup) + dash as /bin/sh. Changing script to /bin/bash
fixes everything. It would be nice if anybody test it with installed dash and
!#/bin/dash in both scripts.

And successful run changes include/lapi/syscalls/arm.in:

+++ include/lapi/syscalls/arm.in
@@ -1,406 +1,415 @@
-restart_syscall (__NR_SYSCALL_BASE+  0)
-exit (__NR_SYSCALL_BASE+  1)
-fork (__NR_SYSCALL_BASE+  2)
-read (__NR_SYSCALL_BASE+  3)
...
+restart_syscall 0
+exit 1
+fork 2
+read 3
+write 4

Maybe we could update syscalls with generate_arch.sh after we merge this?

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-10-31 13:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 11:57 [LTP] [PATCH v7 0/4] Automatically generate syscalls.h Andrea Cervesato
2024-10-31 11:57 ` [LTP] [PATCH v7 1/4] Refactor regen.sh script to generate syscalls Andrea Cervesato
2024-10-31 13:01   ` Petr Vorel
2024-10-31 13:18     ` Cyril Hrubis
2024-10-31 13:44       ` Petr Vorel
2024-10-31 13:37     ` Andrea Cervesato via ltp
2024-10-31 14:08       ` Petr Vorel
2024-10-31 11:57 ` [LTP] [PATCH v7 2/4] Add script to generate arch(s) dependant syscalls Andrea Cervesato
2024-10-31 13:58   ` Petr Vorel [this message]
2024-10-31 14:52     ` Andrea Cervesato via ltp
2024-10-31 15:31       ` pvorel
2024-10-31 11:57 ` [LTP] [PATCH v7 3/4] Delete obsolete strip_syscall.awk file Andrea Cervesato
2024-10-31 11:57 ` [LTP] [PATCH v7 4/4] Add documentation about syscalls.h generator Andrea Cervesato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241031135814.GB1049242@pevik \
    --to=pvorel@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox