Skip to content

Commit 2e77179

Browse files
authored
Merge pull request #374 from nirmoy/patchscan-e-vs-w-and-26.04
patchscan: fix E: vs W: classification and extend to 26.04_linux-nvidia
2 parents 4d02591 + 7a07732 commit 2e77179

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

.github/scripts/patchscan

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ def get_src_commit_strs(msg):
3030
# Match common backport/cherry-pick annotations:
3131
# (cherry picked from commit <sha>)
3232
# (backported from commit <sha>)
33-
# upstream commit <sha>
34-
# Upstream commit <sha>
35-
matches = list(re.finditer(r"(?:from commit|[Uu]pstream commit) ([a-fA-F0-9]+)", msg))
33+
# Upstream commit <sha> (only at start of line, used as a trailer)
34+
# Note: "upstream commit <sha>" embedded in prose is intentionally NOT matched
35+
# to avoid false positives from commits that reference upstream SHAs informally.
36+
matches = list(re.finditer(r"(?:from commit|^[Uu]pstream commit) ([a-fA-F0-9]+)", msg, re.MULTILINE))
3637
return list(map(lambda m: m.group(1) if len(m.groups()) == 1 else None, matches))
3738

3839
def references_upstream(commit):

.github/workflows/patchscan.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request_target:
55
branches:
66
- 24.04_linux-nvidia-6.17-next
7+
- 26.04_linux-nvidia-bos
8+
- 26.04_linux-nvidia
79
workflow_dispatch:
810
inputs:
911
pr_number:
@@ -106,14 +108,14 @@ jobs:
106108
sed 's/\x1B\[[0-9;]*[A-Za-z]//g; s/\x1B\]8;;[^\x1B]*\x1B\\//g; s/\x1B\]8;;[^\a]*\a//g' \
107109
patchscan_output.txt > patchscan_clean.txt
108110
109-
# Record runtime errors so the comment step can report them before failing
110-
if [ $exit_code -ne 0 ]; then
111-
echo "fixes_found=error" >> $GITHUB_OUTPUT
112-
fi
113-
114-
# Check if missing fixes or scan errors were found
115-
if grep -qE "^W:|^E:|Fixes for" patchscan_clean.txt; then
111+
# Classify the outcome — order matters: W: (missing fixes) takes priority,
112+
# then E: / non-zero exit (verification errors), then all-clear.
113+
# Writing fixes_found twice to GITHUB_OUTPUT would make the last write win,
114+
# so use a single mutually-exclusive block.
115+
if grep -qE "^W:|Fixes for" patchscan_clean.txt; then
116116
echo "fixes_found=true" >> $GITHUB_OUTPUT
117+
elif grep -qE "^E:" patchscan_clean.txt || [ $exit_code -ne 0 ]; then
118+
echo "fixes_found=error" >> $GITHUB_OUTPUT
117119
else
118120
echo "fixes_found=false" >> $GITHUB_OUTPUT
119121
fi
@@ -142,9 +144,12 @@ jobs:
142144
);
143145
144146
const body = [
145-
'## :x: Patchscan: Scan Error',
147+
'## :x: Patchscan: Upstream Verification Error',
146148
'',
147-
'Patchscan encountered an error while scanning this PR:',
149+
'Patchscan could not fully verify one or more commits in this PR.',
150+
'This is often a false positive caused by a SAUCE commit whose message',
151+
'body references an upstream SHA but has a different title.',
152+
'No `Fixes:` patches appear to be missing.',
148153
'',
149154
'````',
150155
truncated.trim(),
@@ -260,7 +265,7 @@ jobs:
260265
if: steps.patchscan.outputs.fixes_found == 'true' || steps.patchscan.outputs.fixes_found == 'error'
261266
run: |
262267
if [ "${{ steps.patchscan.outputs.fixes_found }}" = "error" ]; then
263-
echo "::error::Patchscan encountered a runtime error — see PR comment for details."
268+
echo "::error::Patchscan upstream verification error — see PR comment for details."
264269
else
265270
echo "::warning::Missing upstream fixes detected — see PR comment for details."
266271
fi

0 commit comments

Comments
 (0)