<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/scripts/checkkconfigsymbols.py, branch linux-5.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.10.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.10.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2023-03-17T07:45:15Z</updated>
<entry>
<title>scripts: handle BrokenPipeError for python scripts</title>
<updated>2023-03-17T07:45:15Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-01-12T02:30:06Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=42bb1e6b7fe8f826851eb4c5f1bac2b22a06a80b'/>
<id>urn:sha1:42bb1e6b7fe8f826851eb4c5f1bac2b22a06a80b</id>
<content type='text'>
[ Upstream commit 87c7ee67deb7fce9951a5f9d80641138694aad17 ]

In the follow-up of commit fb3041d61f68 ("kbuild: fix SIGPIPE error
message for AR=gcc-ar and AR=llvm-ar"), Kees Cook pointed out that
tools should _not_ catch their own SIGPIPEs [1] [2].

Based on his feedback, LLVM was fixed [3].

However, Python's default behavior is to show noisy bracktrace when
SIGPIPE is sent. So, scripts written in Python are basically in the
same situation as the buggy llvm tools.

Example:

  $ make -s allnoconfig
  $ make -s allmodconfig
  $ scripts/diffconfig .config.old .config | head -n1
  -ALIX n
  Traceback (most recent call last):
    File "/home/masahiro/linux/scripts/diffconfig", line 132, in &lt;module&gt;
      main()
    File "/home/masahiro/linux/scripts/diffconfig", line 130, in main
      print_config("+", config, None, b[config])
    File "/home/masahiro/linux/scripts/diffconfig", line 64, in print_config
      print("+%s %s" % (config, new_value))
  BrokenPipeError: [Errno 32] Broken pipe

Python documentation [4] notes how to make scripts die immediately and
silently:

  """
  Piping output of your program to tools like head(1) will cause a
  SIGPIPE signal to be sent to your process when the receiver of its
  standard output closes early. This results in an exception like
  BrokenPipeError: [Errno 32] Broken pipe. To handle this case,
  wrap your entry point to catch this exception as follows:

    import os
    import sys

    def main():
        try:
            # simulate large output (your code replaces this loop)
            for x in range(10000):
                print("y")
            # flush output here to force SIGPIPE to be triggered
            # while inside this try block.
            sys.stdout.flush()
        except BrokenPipeError:
            # Python flushes standard streams on exit; redirect remaining output
            # to devnull to avoid another BrokenPipeError at shutdown
            devnull = os.open(os.devnull, os.O_WRONLY)
            os.dup2(devnull, sys.stdout.fileno())
            sys.exit(1)  # Python exits with error code 1 on EPIPE

    if __name__ == '__main__':
        main()

  Do not set SIGPIPE’s disposition to SIG_DFL in order to avoid
  BrokenPipeError. Doing that would cause your program to exit
  unexpectedly whenever any socket connection is interrupted while
  your program is still writing to it.
  """

Currently, tools/perf/scripts/python/intel-pt-events.py seems to be the
only script that fixes the issue that way.

tools/perf/scripts/python/compaction-times.py uses another approach
signal.signal(signal.SIGPIPE, signal.SIG_DFL) but the Python
documentation clearly says "Don't do it".

I cannot fix all Python scripts since there are so many.
I fixed some in the scripts/ directory.

[1]: https://lore.kernel.org/all/202211161056.1B9611A@keescook/
[2]: https://github.com/llvm/llvm-project/issues/59037
[3]: https://github.com/llvm/llvm-project/commit/4787efa38066adb51e2c049499d25b3610c0877b
[4]: https://docs.python.org/3/library/signal.html#note-on-sigpipe

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Reviewed-by: Nicolas Schier &lt;nicolas@fjasle.eu&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: remove '---help---' support</title>
<updated>2020-08-14T04:30:03Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-06-17T03:02:19Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f70f74d15ca80d73eca6d5a731257627fb6370c5'/>
<id>urn:sha1:f70f74d15ca80d73eca6d5a731257627fb6370c5</id>
<content type='text'>
The conversion is done. No more user of '---help---'.

Cc: Ulf Magnusson &lt;ulfalizer@gmail.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166</title>
<updated>2019-05-30T18:26:39Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-27T06:55:14Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4f19048fd0a0036e02443237952db5bfa5b5cdf0'/>
<id>urn:sha1:4f19048fd0a0036e02443237952db5bfa5b5cdf0</id>
<content type='text'>
Based on 1 normalized pattern(s):

  licensed under the terms of the gnu gpl license version 2

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 62 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.929121379@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymbols.py: support Kconfig's 'imply' statement</title>
<updated>2017-02-03T10:49:06Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2017-02-02T17:00:44Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3b28f4f2c2c7fcb6770cdfe5e8cd284ee1bc9783'/>
<id>urn:sha1:3b28f4f2c2c7fcb6770cdfe5e8cd284ee1bc9783</id>
<content type='text'>
Support the new imply statement in Kconfig.  The imply statement has
been added by commit 237e3ad0f195 ("Kconfig: Introduce the "imply"
keyword") and is a weak version of a select, but the target symbol can
still be turned off.

Signed-off-by: Andreas Ziegler &lt;andreas.ziegler@fau.de&gt;
Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymbols.py: don't sort similar symbols</title>
<updated>2017-01-19T10:28:31Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2017-01-18T12:08:19Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8e8e333179d6ea50fd0491b138e71dc9d98378ba'/>
<id>urn:sha1:8e8e333179d6ea50fd0491b138e71dc9d98378ba</id>
<content type='text'>
Don't sort the list of string-similar Kconfig symbols alphabetically to
preserve the correct order of string similarity.

Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymbols.py: support git's "^" syntax</title>
<updated>2016-10-28T12:12:14Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2016-10-27T12:34:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=0d18c19288601b66ad2852cceb66ae68972243dc'/>
<id>urn:sha1:0d18c19288601b66ad2852cceb66ae68972243dc</id>
<content type='text'>
Support git's "^" syntax for diffing two commits, for instance via
"--diff HEAD^^^..HEAD".

Signed-off-by: Michael Ellermann &lt;mpe@ellerman.id.au&gt;
Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymbols: use arglist instead of cmd string</title>
<updated>2016-08-28T09:08:34Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2016-08-28T06:51:32Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2f9cc12bb34a4a90f18839a5ce35e1e4d33d6413'/>
<id>urn:sha1:2f9cc12bb34a4a90f18839a5ce35e1e4d33d6413</id>
<content type='text'>
Splitting a command string could lead to unintended arguments.  Use an
argument list in the execute() function instead.

Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymblos: consistent symbol terminology</title>
<updated>2016-08-28T09:08:34Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2016-08-28T06:51:31Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ef3f55438d95f0bfc5d4730db6e59058647832e2'/>
<id>urn:sha1:ef3f55438d95f0bfc5d4730db6e59058647832e2</id>
<content type='text'>
'symbol' and 'feature' are used synonymously to refer to Kconfig symbols
(configs, menus, etc.).  Use the term 'symbol' to have a consistent
terminology and to make the code more comprehensible.

Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymbols.py: fix pylint and pep8 warnings</title>
<updated>2016-08-28T09:08:34Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2016-08-28T06:51:30Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=36c79c7face54ca10e2b57f42cfc956a53246c10'/>
<id>urn:sha1:36c79c7face54ca10e2b57f42cfc956a53246c10</id>
<content type='text'>
Fix pylint and pep8 warnings to have a consistent syntax and style.

Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>checkkconfigsymbols: use ArgumentParser</title>
<updated>2016-08-28T09:08:34Z</updated>
<author>
<name>Valentin Rothberg</name>
<email>valentinrothberg@gmail.com</email>
</author>
<published>2016-08-28T06:51:29Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=14390e31641e6fb482ad75b7f46bc54d798f8b87'/>
<id>urn:sha1:14390e31641e6fb482ad75b7f46bc54d798f8b87</id>
<content type='text'>
Replace the deprecated OptionParser with ArgumentParser, as recommended
by pylint.

Signed-off-by: Valentin Rothberg &lt;valentinrothberg@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
