perf trace beauty: Fix generation of errno id->str table on ALT Linux
Arnaldo Carvalho de Melo
maintainerPATCH 1/1 perf trace beauty: Fix generation of errno id->str table on ALT Linux
Fyi, I'm carrying this on my perf tools tree to keep building on:
[perfbuilder@five sisyphus]$ podman pull alt:sisyphus
Trying to pull docker.io/library/alt:sisyphus...
Getting image source signatures
Copying blob 2b39ef1520dd skipped: already exists
Copying blob 12717fd4baa0 skipped: already exists
Copying config 6d48f46445 done
Writing manifest to image destination
Storing signatures 6d48f4644518cd96ffe1de6cd0333d2abc8312c0e4449e03b58b1d480f0f5905 [perfbuilder@five sisyphus]$ dsh .
sh-4.4# bash
[root@b8318c77142b /]# cat /etc/os-release
NAME="starter kit"
VERSION="p10 (Hypericum)"
ID=altlinux
VERSION_ID=p10
PRETTY_NAME="ALT Starterkit (Hypericum)"
ANSI_COLOR="1;33"
CPE_NAME="cpe:/o:alt:starterkit:p10" HOME_URL="http://en.altlinux.org/starterkits" BUG_REPORT_URL="https://bugs.altlinux.org/"
[root@b8318c77142b /]# rpm -qi bash
Name : bash
Version : 4.4.23
Release : alt1
DistTag : sisyphus+221902.500.4.1
Architecture: noarch
Install Date: Fri Jun 3 23:03:32 2022
Group : Shells
Size : 0
License : None
Signature : DSA/SHA1, Tue Feb 19 14:40:44 2019, Key ID 95c584d5ae4ae412
Source RPM : bash-defaults-4.4.23-alt1.src.rpm
Build Date : Tue Feb 19 14:40:42 2019
Build Host : ldv-sisyphus.hasher.altlinux.org
Relocations : (not relocatable)
Packager : Dmitry V. Levin <[email protected]>
Vendor : ALT Linux Team
Summary : The GNU Bourne Again SHell (/bin/bash)
Description :
This package provides default setup for the GNU Bourne Again SHell (/bin/bash). [root@b8318c77142b /]#
Perf uses that script to generate an id->str errno table for all arches, implemented in:
But it is failing on:
10 62.99 alt:p8 : Ok x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final)
11 91.50 alt:p9 : Ok x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0
12 89.80 alt:p10 : Ok x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1
13 8.99 alt:sisyphus : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt1) (GCC)
| ^~~~
442 | case 47: return "EL3RST";
| ^~~~
443 | case 48: return "ELNRNG";The generated file lacks the function start/end due to some strange glitch:
http://vger.kernel.org/~acme/perf/generated-altlinux-sisyphus-arch_errno_name_array.c
So I'm adding this workaround, can you please check why this is happening?
- Arnaldo
---
For some reason using:
cat <<EoFuncBegin
static const char *errno_to_name__$arch(int err)
{
switch (err) {EoFuncBegin
In tools/perf/trace/beauty/arch_errno_names.sh isn't working on ALT Linux sisyphus (development version), which could be some distro specific glitch, so just get this done in an alternative way that works everywhere while giving notice to the people working on that distro to try and figure our what really took place.
--- tools/perf/trace/beauty/arch_errno_names.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
tools/perf/trace/beauty/arch_errno_names.sh +2 -12
@@ -33,23 +33,13 @@ create_errno_lookup_func() local arch=$(arch_string "$1") local nr name - cat <<EoFuncBegin -static const char *errno_to_name__$arch(int err) -{ - switch (err) { -EoFuncBegin + printf "static const char *errno_to_name__%s(int err)\n{\n\tswitch (err) {\n" $arch while read name nr; do printf '\tcase %d: return "%s";\n' $nr $name done - cat <<EoFuncEnd - default: - return "(unknown)"; - } -} - -EoFuncEnd + printf '\tdefault: return "(unknown)";\n\t}\n}\n' } process_arch()
Signature · 1 line
2.36.1
Hi,
Quoted 61 lines · Arnaldo Carvalho de Melo
Fyi, I'm carrying this on my perf tools tree to keep building on:
[perfbuilder@five sisyphus]$ podman pull alt:sisyphus
Trying to pull docker.io/library/alt:sisyphus...
Getting image source signatures
Copying blob2b39ef1520ddskipped: already exists
Copying blob12717fd4baa0skipped: already exists
Copying config6d48f46445done
Writing manifest to image destination
Storing signatures6d48f4644518cd96ffe1de6cd0333d2abc8312c0e4449e03b58b1d480f0f5905[perfbuilder@five sisyphus]$ dsh .
sh-4.4# bash
[root@b8318c77142b /]# cat/etc/os-release
NAME="starter kit"
VERSION="p10 (Hypericum)"
ID=altlinux
VERSION_ID=p10
PRETTY_NAME="ALT Starterkit (Hypericum)"
ANSI_COLOR="1;33"
CPE_NAME="cpe:/o:alt:starterkit:p10" HOME_URL="http://en.altlinux.org/starterkits" BUG_REPORT_URL="https://bugs.altlinux.org/"
[root@b8318c77142b /]# rpm -qi bash
Name : bash
Version : 4.4.23
Release : alt1
DistTag : sisyphus+221902.500.4.1
Architecture: noarch
Install Date: Fri Jun 3 23:03:32 2022
Group : Shells
Size : 0
License : None
Signature : DSA/SHA1, Tue Feb 19 14:40:44 2019, Key ID95c584d5ae4ae412
Source RPM : bash-defaults-4.4.23-alt1.src.rpm
Build Date : Tue Feb 19 14:40:42 2019
Build Host : ldv-sisyphus.hasher.altlinux.org
Relocations : (not relocatable)
Packager : Dmitry V. Levin <[email protected]>
Vendor : ALT Linux Team
Summary : The GNU Bourne Again SHell (/bin/bash)
Description :
This package provides default setup for the GNU Bourne Again SHell (/bin/bash). [root@b8318c77142b /]#Perf uses that script to generate an
id->strerrno table for all arches, implemented in:But it is failing on:
10 62.99 alt:p8 : Ok x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final) 11 91.50 alt:p9 : Ok x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0 12 89.80 alt:p10 : Ok x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1 13 8.99 alt:sisyphus : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt1) (GCC) | ^~~~ 442 | case 47: return "EL3RST"; | ^~~~ 443 | case 48: return "ELNRNG";
Quoted 7 lines
The generated file lacks the function start/end due to some strange glitch:
http://vger.kernel.org/~acme/perf/generated-altlinux-sisyphus-arch_errno_name_array.c
So I'm adding this workaround, can you please check why this is happening?
arch_errno_names.sh uses here-documents which are implemented in bash using temporary files. Looks like it couldn't create a temporary file, e.g. because $TMPDIR points to a directory that doesn't exist or not writable. If there was some "cannot create temp file for here-document" diagnostics in stderr, that's it. If that's the case, it's not a problem in the script but in the environment.
I've Cc'ed more people, maybe they could have a look.
Signature · 1 line
ldv
Dmitry, Arnaldo,
Quoted 72 lines · Dmitry V. Levin
Hi,
Quoted 61 lines · Arnaldo Carvalho de Melo
Fyi, I'm carrying this on my perf tools tree to keep building on:
[perfbuilder@five sisyphus]$ podman pull alt:sisyphus
Trying to pull docker.io/library/alt:sisyphus...
Getting image source signatures
Copying blob2b39ef1520ddskipped: already exists
Copying blob12717fd4baa0skipped: already exists
Copying config6d48f46445done
Writing manifest to image destination
Storing signatures6d48f4644518cd96ffe1de6cd0333d2abc8312c0e4449e03b58b1d480f0f5905[perfbuilder@five sisyphus]$ dsh .
sh-4.4# bash
[root@b8318c77142b /]# cat/etc/os-release
NAME="starter kit"
VERSION="p10 (Hypericum)"
ID=altlinux
VERSION_ID=p10
PRETTY_NAME="ALT Starterkit (Hypericum)"
ANSI_COLOR="1;33"
CPE_NAME="cpe:/o:alt:starterkit:p10" HOME_URL="http://en.altlinux.org/starterkits" BUG_REPORT_URL="https://bugs.altlinux.org/"
[root@b8318c77142b /]# rpm -qi bash
Name : bash
Version : 4.4.23
Release : alt1
DistTag : sisyphus+221902.500.4.1
Architecture: noarch
Install Date: Fri Jun 3 23:03:32 2022
Group : Shells
Size : 0
License : None
Signature : DSA/SHA1, Tue Feb 19 14:40:44 2019, Key ID95c584d5ae4ae412
Source RPM : bash-defaults-4.4.23-alt1.src.rpm
Build Date : Tue Feb 19 14:40:42 2019
Build Host : ldv-sisyphus.hasher.altlinux.org
Relocations : (not relocatable)
Packager : Dmitry V. Levin <[email protected]>
Vendor : ALT Linux Team
Summary : The GNU Bourne Again SHell (/bin/bash)
Description :
This package provides default setup for the GNU Bourne Again SHell (/bin/bash). [root@b8318c77142b /]#Perf uses that script to generate an
id->strerrno table for all arches, implemented in:But it is failing on:
10 62.99 alt:p8 : Ok x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1) , clang version 3.8.0 (tags/RELEASE_380/final) 11 91.50 alt:p9 : Ok x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) , clang version 10.0.0 12 89.80 alt:p10 : Ok x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) , clang version 11.0.1 13 8.99 alt:sisyphus : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt1) (GCC) | ^~~~ 442 | case 47: return "EL3RST"; | ^~~~ 443 | case 48: return "ELNRNG";Quoted 7 lines
The generated file lacks the function start/end due to some strange glitch:
http://vger.kernel.org/~acme/perf/generated-altlinux-sisyphus-arch_errno_name_array.c
So I'm adding this workaround, can you please check why this is happening?
Quoted 8 lines
arch_errno_names.shuses here-documents which are implemented in bash using temporary files. Looks like it couldn't create a temporary file, e.g. because $TMPDIR points to a directory that doesn't exist or not writable. If there was some "cannot create temp file for here-document" diagnostics in stderr, that's it. If that's the case, it's not a problem in the script but in the environment.I've Cc'ed more people, maybe they could have a look.
I cannot reproduce this, from Fedora 35 (Cloud Edition) virtual machine in QEMU[1], then using:
# podman run --security-opt label=disable -it -v $PWD/linux:/linux alt:sisyphus
Where linux is v5.19-rc3-48-gde5c208d533a, then apt-get update & install gcc, then:
[root@3b364fe4fc22 linux]# tools/perf/trace/beauty/arch_errno_names.sh gcc tools/ | head /* SPDX-License-Identifier: GPL-2.0 */
#include <string.h>
static const char *errno_to_name__generic(int err)
{
switch (err) {
case 1: return "EPERM";
case 2: return "ENOENT";
case 3: return "ESRCH";
case 4: return "EINTR";
case 5: return "EIO";Thanks,
[1] https://github.com/Obirvalger/vml
Quoted 4 lines
Signature · 2 lines
-- ldv