man/man3/strftime.3: Check parameter
PATCH v2 1/1 man/man3/strftime.3: Check parameter
From: "Dr. David Alan Gilbert" <[email protected]>
The strftime example requires a format paramter. If you don't pass one it crashes.
Check for the parameter.
---
v2
Use a more standard Usage: format.
man/man3/strftime.3 | 5 +++++ 1 file changed, 5 insertions(+)
man/man3/strftime.3 +5 -0
@@ -739,6 +739,11 @@ .SS Program source char outstr[200]; time_t t; struct tm *tmp; +\& + if (argc != 2) { + fprintf(stderr,"Usage: %s: <format\-string>\[rs]n", argv[0]); + exit(EXIT_FAILURE); + } \& t = time(NULL); tmp = localtime(&t);
Signature · 1 line
2.50.1
Alejandro Colomar
maintainerHi Dave,
Quoted 7 lines · On Mon, Aug 18, 2025 at 06:45:53PM +0100, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The strftime example requires a format paramter. If you don't pass one it crashes.
Check for the parameter.Signed-off-by Dr. David Alan Gilbert <[email protected]>
Thanks! I've applied the patch. (But see some minor comment below.)
Have a lovely day!
Alex
Quoted 12 lines
---
v2
Use a more standard Usage: format.man/man3/strftime.3 | 5 +++++ 1 file changed, 5 insertions(+)man/man3/strftime.3 +0
-0
man/man3/strftime.3 .SS Program source · line 744
Quoted 6 lines
man/man3/strftime.3 +3
-0@@ -739,6 +739,11 @@ .SS Program source char outstr[200]; time_t t; struct tm *tmp; +\& + if (argc != 2) { + fprintf(stderr,"Usage: %s: <format\-string>\[rs]n", argv[0]);
CI detected some issue in this line of code:
remote: .tmp/man/man3/strftime.3.d/strftime.c:14: Missing space after , [whitespace/comma] [3]
I've amended it with a space.
Quoted 8 lines
man/man3/strftime.3 +2
-0+ exit(EXIT_FAILURE); + } \& t = time(NULL); tmp = localtime(&t);Signature · 1 line
2.50.1
Signature · 1 line
<https://www.alejandro-colomar.es/>
Quoted 5 lines · * Alejandro Colomar ([email protected]) wrote:
Hi Dave,
Quoted 2 lines · On Mon, Aug 18, 2025 at 06:45:53PM +0100, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
Quoted 7 lines
Quoted 5 lines
The strftime example requires a format paramter. If you don't pass one it crashes.
Check for the parameter.Signed-off-by Dr. David Alan Gilbert <[email protected]>Thanks! I've applied the patch. (But see some minor comment below.)
Thanks!
Is that something that I can spot locally?
Since I seem to be working my way through the set checking most of the examples, I'm probably going to be posting some more so I should get the checks running.
I'm trying to run:
make -R lint build-all check
but it seems to be missing 'checkpatch' and I'm not sure which checkpatch that is. (I'm on Fedora 42).
Dave
Quoted 40 lines
Have a lovely day!
AlexQuoted 12 lines
---
v2
Use a more standard Usage: format.man/man3/strftime.3 | 5 +++++ 1 file changed, 5 insertions(+)man/man3/strftime.3 +0
-0man/man3/strftime.3 .SS Program source · line 744
Quoted 6 lines
man/man3/strftime.3 +3
-0@@ -739,6 +739,11 @@ .SS Program source char outstr[200]; time_t t; struct tm *tmp; +\& + if (argc != 2) { + fprintf(stderr,"Usage: %s: <format\-string>\[rs]n", argv[0]);CI detected some issue in this line of code:
remote:
.tmp/man/man3/strftime.3.d/strftime.c:14: Missing space after , [whitespace/comma] [3]I've amended it with a space.
Quoted 8 lines
man/man3/strftime.3 +2
-0+ exit(EXIT_FAILURE); + } \& t = time(NULL); tmp = localtime(&t);Signature · 1 line
2.50.1Signature · 1 line
<https://www.alejandro-colomar.es/>
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Alejandro Colomar
maintainerHi Dave,
Quoted 12 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Alejandro Colomar ([email protected]) wrote:
Hi Dave,
Quoted 7 lines · On Mon, Aug 18, 2025 at 06:45:53PM +0100, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The strftime example requires a format paramter. If you don't pass one it crashes.
Check for the parameter.Signed-off-by Dr. David Alan Gilbert <[email protected]>
Quoted 7 lines
Quoted 1 line
Thanks! I've applied the patch. (But see some minor comment below.)
Thanks!
Is that something that I can spot locally?
Since I seem to be working my way through the set checking most of the examples, I'm probably going to be posting some more so I should get the checks running.
Yes, you can.
Quoted 2 lines
I'm trying to run:
make -R lint build-all check
This is essentially what it does. Here's the full script I use in my server (the linters are run on pushes to refs/heads/contrib):
alx@www:/srv/src/alx/linux/man-pages/man-pages.git$ cat hooks/post-update; #!/bin/bash
set -uo pipefail;
cd /home/alx/src/linux/man-pages/man-pages/.bare.git/;
unset $(git rev-parse --local-env-vars);
git fetch srv >/dev/null;
export LANG=C.utf8;
test "$1" = "refs/heads/main" \
&& (
cd /home/alx/src/linux/man-pages/man-pages/main/;
git reset srv/main --hard >/dev/null;
export pdfdir="/srv/www/share/dist/man-pages/git/HEAD";
export DISTNAME="man-pages-HEAD";
make -R install-pdf-book 2>&1 \
| sed '/bashrc.*PS1/d';
echo '$?: '"$?";
)
test "$1" = "refs/heads/contrib" \
&& (
set -Ee;
export PS1=;
cd /home/alx/src/linux/man-pages/man-pages/contrib/;
old="$(git rev-parse HEAD)";
git reset srv/contrib --hard >/dev/null;
make_opts='';
make_opts="$make_opts -R";
make_opts="$make_opts -j4";
make_opts="$make_opts -Otarget";
make_opts="$make_opts --no-print-directory";
export VERSION=contrib;
#export GROFFBINDIR=/opt/local/gnu/groff/deri-gropdf-ng/bin;
#export PRECONV=$GROFFBINDIR/preconv;
#export PIC=$GROFFBINDIR/pic;
#export TBL=$GROFFBINDIR/tbl;
#export EQN=$GROFFBINDIR/eqn;
#export TROFF=$GROFFBINDIR/troff;
#export GROPDF=$GROFFBINDIR/gropdf;
make_target()
{
make $make_opts "$@" 2>&1 \
| sed '/bashrc.*PS1/d';
}
make_target lint;
make_target build-pdf-book;
make_target build-all;
make_target check;
make_target dist;
echo '$?: '"$?";
echo 'URI:';
git rev-list "$old..HEAD" \
| sed 's,.*,https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib\&id=&,';
)Quoted 2 lines
but it seems to be missing 'checkpatch' and I'm not sure which checkpatch that is. (I'm on Fedora 42).
Yup, checkpatch is the one you can't run. I have a fork of the kernel's checkpatch, which I want to eventually package. I need to find some time to do it.
For now, you should be able to do what CONTRIBUTING.d/lint says about make's -t and -k options, which will allow you to ignore those failures. Let me know if that doesn't work.
Have a lovely day!
Alex
Signature · 1 line
<https://www.alejandro-colomar.es/>
Quoted 104 lines · * Alejandro Colomar ([email protected]) wrote:
Hi Dave,
Quoted 12 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Alejandro Colomar ([email protected]) wrote:
Hi Dave,
Quoted 7 lines · On Mon, Aug 18, 2025 at 06:45:53PM +0100, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
The strftime example requires a format paramter. If you don't pass one it crashes.
Check for the parameter.Signed-off-by Dr. David Alan Gilbert <[email protected]>Quoted 7 lines
Quoted 1 line
Thanks! I've applied the patch. (But see some minor comment below.)
Thanks!
Is that something that I can spot locally?
Since I seem to be working my way through the set checking most of the examples, I'm probably going to be posting some more so I should get the checks running.Yes, you can.
Quoted 2 lines
I'm trying to run:
make -R lint build-all checkThis is essentially what it does. Here's the full script I use in my server (the linters are run on pushes to refs/heads/contrib):
alx@www:/srv/src/alx/linux/man-pages/man-pages.git$ cat hooks/post-update; #!/bin/bashset -uo pipefail; cd /home/alx/src/linux/man-pages/man-pages/.bare.git/; unset $(git rev-parse --local-env-vars); git fetch srv >/dev/null; export LANG=C.utf8; test "$1" = "refs/heads/main" \ && ( cd /home/alx/src/linux/man-pages/man-pages/main/; git reset srv/main --hard >/dev/null; export pdfdir="/srv/www/share/dist/man-pages/git/HEAD"; export DISTNAME="man-pages-HEAD"; make -R install-pdf-book 2>&1 \ | sed '/bashrc.*PS1/d'; echo '$?: '"$?"; ) test "$1" = "refs/heads/contrib" \ && ( set -Ee; export PS1=; cd /home/alx/src/linux/man-pages/man-pages/contrib/; old="$(git rev-parse HEAD)"; git reset srv/contrib --hard >/dev/null; make_opts=''; make_opts="$make_opts -R"; make_opts="$make_opts -j4"; make_opts="$make_opts -Otarget"; make_opts="$make_opts --no-print-directory"; export VERSION=contrib; #export GROFFBINDIR=/opt/local/gnu/groff/deri-gropdf-ng/bin; #export PRECONV=$GROFFBINDIR/preconv; #export PIC=$GROFFBINDIR/pic; #export TBL=$GROFFBINDIR/tbl; #export EQN=$GROFFBINDIR/eqn; #export TROFF=$GROFFBINDIR/troff; #export GROPDF=$GROFFBINDIR/gropdf; make_target() { make $make_opts "$@" 2>&1 \ | sed '/bashrc.*PS1/d'; } make_target lint; make_target build-pdf-book; make_target build-all; make_target check; make_target dist; echo '$?: '"$?"; echo 'URI:'; git rev-list "$old..HEAD" \ | sed 's,.*,https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib\&id=&,'; )Quoted 2 lines
but it seems to be missing 'checkpatch' and I'm not sure which checkpatch that is. (I'm on Fedora 42).
Quoted 7 lines
Yup, checkpatch is the one you can't run. I have a fork of the kernel's checkpatch, which I want to eventually package. I need to find some time to do it.
For now, you should be able to do what CONTRIBUTING.d/lint says about make's -t and -k options, which will allow you to ignore those failures. Let me know if that doesn't work.
OK great, I'll give those a go and hopefully you'll see some more patches!
Dave
Quoted 6 lines
Have a lovely day!
AlexSignature · 1 line
<https://www.alejandro-colomar.es/>
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Alejandro Colomar
maintainerHi Dave,
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 7 lines
Quoted 2 lines
but it seems to be missing 'checkpatch' and I'm not sure which checkpatch that is. (I'm on Fedora 42).
Yup, checkpatch is the one you can't run. I have a fork of the kernel's checkpatch, which I want to eventually package. I need to find some time to do it.
Quoted 5 lines
Quoted 3 lines
For now, you should be able to do what CONTRIBUTING.d/lint says about make's -t and -k options, which will allow you to ignore those failures. Let me know if that doesn't work.
OK great, I'll give those a go and hopefully you'll see some more patches!
Thanks!!
Actually, it's even simpler. I hadn't thought of it, but you can do
export CHECKPATCH=true
make -R lint build-all check
And that should make all checkpatch-related targets succeed. :)
Cheers,
Alex
Signature · 1 line
<https://www.alejandro-colomar.es/>