lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1693037031.git.quic_gurus@quicinc.com>
Date:   Sat, 26 Aug 2023 01:07:41 -0700
From:   Guru Das Srinagesh <quic_gurus@...cinc.com>
To:     Masahiro Yamada <masahiroy@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Nicolas Schier" <nicolas@...sle.eu>,
        Konstantin Ryabitsev <konstantin@...uxfoundation.org>,
        Kees Cook <keescook@...omium.org>,
        "Bjorn Andersson" <andersson@...nel.org>, <robh+dt@...nel.org>,
        <krzysztof.kozlowski+dt@...aro.org>, Will Deacon <will@...nel.org>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        <quic_pkondeti@...cinc.com>
CC:     <linux-kernel@...r.kernel.org>, <kernel@...cinc.com>,
        <workflows@...r.kernel.org>, <tools@...ux.kernel.org>,
        <devicetree@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>, <linux-pm@...r.kernel.org>,
        "Guru Das Srinagesh" <quic_gurus@...cinc.com>
Subject: [PATCH v3 0/1] Add add-maintainer.py script

When pushing patches to upstream, the `get_maintainer.pl` script is used to
determine whom to send the patches to. Instead of having to manually process
the output of the script, add a wrapper script to do that for you.

The add-maintainer.py script adds maintainers (and mailing lists) to a patch,
editing it in-place. It also optionally undoes this operation if so desired.

Please try out this script with `--verbosity debug` for verifying that it's
doing "the right thing". I've tested this with a patch series from various
subsystems to ensure variety of maintainers and lists output and found it to be
behaving as expected. For an example output of this script, please see [1].

Thanks to Bjorn for being a sounding board to this idea and for his valuable
suggestions.

I referred to these links [2][3][4] during development of this script.

Apropos workflow:

Thanks to Krzysztof for sharing his workflow - I found his suggestion to use
git branch description as cover letter [5] particularly useful. Incorporating
that into the ideal workflow envisioned [6] for this script, we get:

    1. Do `git config format.coverFromDescription subject`
    2. Do `git branch --edit-description` and write cover letter
    3. Generate patches using `git format-patch --cover-letter -n --thread -v<N>`
    4. Run `add-maintainer.py` on the above patches
    5. `git send-email` the patches.

b4 is an amazing tool whose `b4 prep --auto-to-cc` does part of what this
script does, but with the above workflow, we have an in-tree solution to the
basic problem of preparing patches to be sent to LKML.  For multiple patchsets,
all one will need to do is to increment `-v` while git-formatting patches and
make corresponding changes to the cover letter via step #2 as necessary!

Changelog:

(v2 -> v3)
- Change patches nargs * -> + (Nicolas)
- Add entry in MAINTAINERS and add self as maintainer (Pavan)
- Bail out early if file does not exist (Pavan)
- Change From: line determination logic (Nicolas)
  - Look for From: line and stop at the first occurrence of it - don't search
    entire file
- Wrap the get_maintainer.pl call with a try-except block.
- Use a better (arguably so) email validation regex
- Don't disallow multiple "From:" in patch:
  - When the change is authored by someone other than the person generating the
    patch, there will be two "From: <email address>" lines in the patch. This
    is very valid, so don't error out.
- Reviewers also go in To: in addition to Maintainers.
- Add new "--undo" flag to undo effects of this script on a patch (tested)

(v1 -> v2)
- Added set-union logic based on Pavan's comments [7] and Bjorn's early suggestion
- Expanded audience and added more mailing lists to get more review comments and feedback

[1] https://lore.kernel.org/lkml/20230824214436.GA22659@quicinc.com/
[2] https://stackoverflow.com/questions/4427542/how-to-do-sed-like-text-replace-with-python
[3] https://stackoverflow.com/questions/4146009/python-get-list-indexes-using-regular-expression
[4] https://stackoverflow.com/questions/10507230/insert-line-at-middle-of-file-with-python
[5] https://lore.kernel.org/lkml/6f475c9b-dc0e-078e-9aa2-d876a1e02467@linaro.org/
[6] https://lore.kernel.org/lkml/20230816171538.GB26279@quicinc.com/
[7] https://lore.kernel.org/lkml/63764b84-3ebd-4081-836f-4863af196228@quicinc.com/

Guru Das Srinagesh (1):
  scripts: Add add-maintainer.py

 MAINTAINERS               |   5 ++
 scripts/add-maintainer.py | 164 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 169 insertions(+)
 create mode 100755 scripts/add-maintainer.py

-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ