From: Akira Yokosawa <akiyks@gmail.com>
To: "Jonathan Corbet" <corbet@lwn.net>,
"Tomasz Warniełło" <tomasz.warniello@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] docs: scripts/kernel-doc: Detect absence of FILE arg
Date: Thu, 24 Feb 2022 22:02:46 +0900 [thread overview]
Message-ID: <7b136049-a3ba-0eb5-8717-364d773ff914@gmail.com> (raw)
Currently, when there is no FILE argument following a switch such
as -man, -rst, or -none, kernel-doc exits with a warning from perl
(long msg folded):
Use of uninitialized value $ARGV[0] in pattern match (m//)
at ./scripts/kernel-doc line 438.
, which is unhelpful.
Improve the behavior by adding a check at the bottom of parsing
loop.
If the argument is absent, display help text and exit with
the code of 1 (via usage()).
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Tomasz Warniełło <tomasz.warniello@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Changes since v1 [1]:
- No code change
- Amend subject and reword the whole changelog.
- The message from perl is not an error but a warning.
(I thank Tomasz for pointing it out.)
I thought the change of exit code might affect sphinx-build processing,
and tested with several runs of "make htmldocs" and "make pdfdocs".
So far, I've not seen any regression.
[1] v1: https://lore.kernel.org/r/1c71e5d2-f87e-6c8e-6176-e5ce42e4d41b@gmail.com
Thanks, Akira
--
scripts/kernel-doc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 3106b7536b89..faefe2977f0e 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -494,7 +494,11 @@ while ($ARGV[0] =~ m/^--?(.*)/) {
}
} else {
# Unknown argument
- usage();
+ usage();
+ }
+ if ($#ARGV < 0){
+ print "No FILE!\n";
+ usage();
}
}
base-commit: b62ef3a1cca0553613adce16515f3640400725b4
--
2.17.1
next reply other threads:[~2022-02-24 13:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 13:02 Akira Yokosawa [this message]
2022-02-24 19:15 ` Jonathan Corbet
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=7b136049-a3ba-0eb5-8717-364d773ff914@gmail.com \
--to=akiyks@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=tomasz.warniello@gmail.com \
/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
all inboxes | Powered by JetHome®