Skip to content

Upstream Commit Checker. - #80

Open
PlaidCat wants to merge 1 commit into
mainlinefrom
{jmaple}_quick_static_analysis
Open

Upstream Commit Checker.#80
PlaidCat wants to merge 1 commit into
mainlinefrom
{jmaple}_quick_static_analysis

Conversation

@PlaidCat

@PlaidCat PlaidCat commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

This is a quickly written script that Claude built based off many of LPE and embargo's we've needed to address over the past 3 months. This should be decomposed into kt libraries more specifically but is here just so we have something to share quickly.

NOTE ITS PRETTY SLOW but that is less important than the information at the moment

example with Januscape

[jmaple@devbox kernel-src-tree]$ ../check-upstream-commit.sh 2032a93d66fa

━━━ Checking 2032a93d66fa ━━━
    (resolved to 2032a93d66fa282ba0f2ea9152eeff9511fa9a96)

  BRANCH                               CONTAINS    BACKPORT    DETAILS
  ------                               --------    --------    -------
  CBR 7.9                              YES          no
  LTS 8.6                              YES          YES          2 commits reference this SHA
  LTS 8.8                              YES          no
  LTS 9.2                              YES          YES          2 commits reference this SHA
  LTS 9.4                              YES          no
  LTS 9.6                              YES          YES          2 commits reference this SHA
  CLK 6.12                             YES          YES          2 commits reference this SHA
  CLK 6.18                             YES          YES          2 commits reference this SHA
  RLC 8 (4.18.0-553.148.1.el8_10)      YES          YES
  RLC 9 (5.14.0-687.31.1.el9_8)        YES          YES          2 commits reference this SHA
  RLC 10 (6.12.0-211.39.1.el10_2)      YES          YES          2 commits reference this SHA

Coverage Report

Name Stmts Miss Branch BrPart Cover Missing
check_fips_changes.py 42 42 12 0 0% 8-67
check_kernel_commits.py 179 179 76 0 0% 3-371
ciq-cherry-pick.py 190 190 50 0 0% 1-426
ciq-tag.py 146 146 16 0 0% 3-378
ciq_tag.py 232 232 54 0 0% 1-464
jira_pr_check.py 180 180 80 0 0% 3-381
kt/ktlib/command_runner.py 33 20 6 0 33% 16, 20-33, 37-61, 65-66
kt/ktlib/config.py 47 4 8 2 89% 52, 82-85
kt/ktlib/kernel_workspace.py 111 77 18 0 26% 22-35, 49-66, 73-76, 80-91, 94-100, 113-124, 135-145, 162-165, 169-202, 210-213, 216-220
kt/ktlib/kernels.py 78 16 12 2 78% 54-62, 79-81, 111, 127-134
kt/ktlib/local.py 5 1 0 0 80% 12
kt/ktlib/repo.py 29 15 2 0 45% 30-31, 34-35, 43-55
kt/ktlib/ssh.py 10 2 0 0 80% 10, 14
kt/ktlib/util.py 14 0 0 0 100%
kt/ktlib/virt.py 64 29 2 0 53% 23, 31-34, 47-69, 73-79, 83-84, 88, 92, 96, 100, 106-108, 112-117, 121-126
kt/ktlib/vm.py 243 120 36 0 48% 120-133, 161-170, 178-189, 256-266, 269, 281-285, 288, 291-307, 310-317, 326-330, 333-344, 347-348, 351, 355-360, 372-383, 396-403, 412, 421-433, 436-443, 446-455, 458
release_config.py 2 2 0 0 0% 7-27
rolling-release-update.py 264 264 106 0 0% 1-412
run_interdiff.py 165 165 56 0 0% 3-244
update_lt_spec.py 219 219 46 0 0% 9-411
TOTAL 2253 1903 580 4 13%

This is a quickly written script that Claude built based off many of LPE
and embargo's we've needed to address over the past 3 months.  This
should be decomposed into kt libraries more specifically but is here
just so we have something to share quickly.
@PlaidCat PlaidCat self-assigned this Aug 3, 2026
Copilot AI review requested due to automatic review settings August 3, 2026 18:28
@PlaidCat
PlaidCat marked this pull request as ready for review August 3, 2026 18:28
@PlaidCat
PlaidCat requested a review from kerneltoast August 3, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Bash utility (check-upstream-commit.sh) intended to help triage whether a given upstream commit SHA is present (directly or via backport references) across a set of CIQ-maintained kernel branches, with optional fetch, verbose output, quiet filtering, and JSON output.

Changes:

  • Introduces check-upstream-commit.sh to check commit ancestry across a fixed branch set plus latest-per-family RLC branches.
  • Implements two detection modes: message grep for backport references and direct ancestry checks for the upstream commit object.
  • Adds multiple output formats (human table with optional color, and JSON).
Suppressed comments (2)

check-upstream-commit.sh:139

  • When reading SHAs from --file, the script removes only literal spaces (line="${line// /}"). Files with tabs or CRLF line endings (common when copying from emails/spreadsheets) will leave extra whitespace and then fail validate_sha. Strip all whitespace characters to make file input more robust.
    while IFS= read -r line; do
        line="${line%%#*}"
        line="${line// /}"
        [[ -n "$line" ]] && SHA_LIST+=("$line")

check-upstream-commit.sh:346

  • The JSON output only escapes backslashes and double quotes in details. If a commit subject contains tabs/newlines/CR (or other control chars), the emitted JSON becomes invalid. At minimum, escape \n, \r, and \t as well (and ideally apply escaping consistently to other string fields like branch/label).
            if [[ -n "$details" ]]; then
                details_escaped="${details//\\/\\\\}"
                details_escaped="${details_escaped//\"/\\\"}"
                json_results+=",\"details\":\"${details_escaped}\""
            fi

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread check-upstream-commit.sh
Comment on lines +6 to +9
# Usage:
# ./scripts/check-upstream-commit.sh <sha> [sha2 ...]
# ./scripts/check-upstream-commit.sh -f file_of_shas.txt
# ./scripts/check-upstream-commit.sh --fetch <sha>
Comment thread check-upstream-commit.sh
Comment on lines +122 to +126
-h|--help) usage;;
-f|--file) SHA_FILE="$2"; shift 2;;
-F|--fetch) FETCH=1; shift;;
-r|--remote) REMOTE="$2"; shift 2;;
-v|--verbose) VERBOSE=1; shift;;

@bmastbergen bmastbergen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥌

@shreeya-patel98 shreeya-patel98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants