From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Ali Alnubani <alialnu@nvidia.com>
Subject: [PATCH v2] devtools: check patch from stdin only if nothing else
Date: Fri, 28 Nov 2025 15:40:48 +0100 [thread overview]
Message-ID: <20251128144127.1552516-1-thomas@monjalon.net> (raw)
In-Reply-To: <26063275.kmuVQn2iE0@thomas>
From: Ali Alnubani <alialnu@nvidia.com>
The checkpatches.sh script was checking if stdin is a terminal before
honoring the -n flag, causing it to incorrectly attempt to read patches
from stdin when run without a TTY (e.g., in Jenkins/CI pipelines).
Reorder the conditionals to check for the -n and -r flags
before checking stdin state.
This ensures the -n/-r flags takes precedence
and the script checks git commits as intended.
Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: make also -r a priority (before considering stdin)
---
devtools/checkpatches.sh | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 9fb8fd0a07..47e8ca57b4 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -421,8 +421,8 @@ check_release_notes() { # <patch>
grep -v $current_rel_notes
}
-number=0
-range='origin/main..'
+number=
+range=
quiet=false
verbose=false
while getopts hn:qr:v ARG ; do
@@ -558,17 +558,20 @@ if [ -n "$1" ] ; then
for patch in "$@" ; do
check "$patch" ''
done
-elif [ ! -t 0 ] ; then # stdin
- check '' ''
-else
- if [ $number -eq 0 ] ; then
- commits=$(git rev-list --reverse $range)
- else
+elif [ -n "$number" ] || [ -n "$range" ] || [ -t 0 ]; then
+ if [ -n "$number" ] ; then
commits=$(git rev-list --reverse --max-count=$number HEAD)
+ else
+ if [ -z "$range" ] ; then
+ range='origin/main..' # default
+ fi
+ commits=$(git rev-list --reverse $range)
fi
for commit in $commits ; do
check '' $commit
done
+else # stdin
+ check '' ''
fi
pass=$(($total - $status))
$quiet || printf '\n%d/%d valid patch' $pass $total
--
2.51.0
prev parent reply other threads:[~2025-11-28 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 7:43 [PATCH] devtools: honor -n flag regardless of stdin state Ali Alnubani
2025-10-23 14:33 ` Thomas Monjalon
2025-10-23 14:51 ` Thomas Monjalon
2025-11-28 14:40 ` Thomas Monjalon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251128144127.1552516-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=alialnu@nvidia.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).