public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] man/man3/strftime.3: Check parameter
@ 2025-08-18 17:45 dave
  2025-08-19 11:24 ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: dave @ 2025-08-18 17:45 UTC (permalink / raw)
  To: alx; +Cc: linux-man, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dave@treblig.org>

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 <dave@treblig.org>
---
 v2
    Use a more standard Usage: format.

 man/man3/strftime.3 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/man/man3/strftime.3 b/man/man3/strftime.3
index 4a3f805bb..a27dfd01b 100644
--- a/man/man3/strftime.3
+++ b/man/man3/strftime.3
@@ -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);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] man/man3/strftime.3: Check parameter
  2025-08-18 17:45 [PATCH v2] man/man3/strftime.3: Check parameter dave
@ 2025-08-19 11:24 ` Alejandro Colomar
  2025-08-19 11:46   ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2025-08-19 11:24 UTC (permalink / raw)
  To: dave; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

Hi Dave,

On Mon, Aug 18, 2025 at 06:45:53PM +0100, dave@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
> 
> 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 <dave@treblig.org>

Thanks!  I've applied the patch.  (But see some minor comment below.)


Have a lovely day!
Alex

> ---
>  v2
>     Use a more standard Usage: format.
> 
>  man/man3/strftime.3 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/man/man3/strftime.3 b/man/man3/strftime.3
> index 4a3f805bb..a27dfd01b 100644
> --- a/man/man3/strftime.3
> +++ b/man/man3/strftime.3
> @@ -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.

> +        exit(EXIT_FAILURE);
> +    }
>  \&
>      t = time(NULL);
>      tmp = localtime(&t);
> -- 
> 2.50.1
> 

-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] man/man3/strftime.3: Check parameter
  2025-08-19 11:24 ` Alejandro Colomar
@ 2025-08-19 11:46   ` Dr. David Alan Gilbert
  2025-08-19 12:50     ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2025-08-19 11:46 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

* Alejandro Colomar (alx@kernel.org) wrote:
> Hi Dave,
> 
> On Mon, Aug 18, 2025 at 06:45:53PM +0100, dave@treblig.org wrote:
> > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> > 
> > 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 <dave@treblig.org>
> 
> 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

> 
> Have a lovely day!
> Alex
> 
> > ---
> >  v2
> >     Use a more standard Usage: format.
> > 
> >  man/man3/strftime.3 | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/man/man3/strftime.3 b/man/man3/strftime.3
> > index 4a3f805bb..a27dfd01b 100644
> > --- a/man/man3/strftime.3
> > +++ b/man/man3/strftime.3
> > @@ -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.
> 
> > +        exit(EXIT_FAILURE);
> > +    }
> >  \&
> >      t = time(NULL);
> >      tmp = localtime(&t);
> > -- 
> > 2.50.1
> > 
> 
> -- 
> <https://www.alejandro-colomar.es/>


-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] man/man3/strftime.3: Check parameter
  2025-08-19 11:46   ` Dr. David Alan Gilbert
@ 2025-08-19 12:50     ` Alejandro Colomar
  2025-08-19 18:03       ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2025-08-19 12:50 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 3221 bytes --]

Hi Dave,

On Tue, Aug 19, 2025 at 11:46:07AM +0000, Dr. David Alan Gilbert wrote:
> * Alejandro Colomar (alx@kernel.org) wrote:
> > Hi Dave,
> > 
> > On Mon, Aug 18, 2025 at 06:45:53PM +0100, dave@treblig.org wrote:
> > > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> > > 
> > > 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 <dave@treblig.org>
> > 
> > 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.

> 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=&,';
	)

> 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

-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] man/man3/strftime.3: Check parameter
  2025-08-19 12:50     ` Alejandro Colomar
@ 2025-08-19 18:03       ` Dr. David Alan Gilbert
  2025-08-20 12:30         ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2025-08-19 18:03 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

* Alejandro Colomar (alx@kernel.org) wrote:
> Hi Dave,
> 
> On Tue, Aug 19, 2025 at 11:46:07AM +0000, Dr. David Alan Gilbert wrote:
> > * Alejandro Colomar (alx@kernel.org) wrote:
> > > Hi Dave,
> > > 
> > > On Mon, Aug 18, 2025 at 06:45:53PM +0100, dave@treblig.org wrote:
> > > > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> > > > 
> > > > 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 <dave@treblig.org>
> > > 
> > > 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.
> 
> > 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=&,';
> 	)
> 
> > 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.

OK great, I'll give those a go and hopefully you'll see some more patches!

Dave

> 
> Have a lovely day!
> Alex
> 
> -- 
> <https://www.alejandro-colomar.es/>


-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] man/man3/strftime.3: Check parameter
  2025-08-19 18:03       ` Dr. David Alan Gilbert
@ 2025-08-20 12:30         ` Alejandro Colomar
  0 siblings, 0 replies; 6+ messages in thread
From: Alejandro Colomar @ 2025-08-20 12:30 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

Hi Dave,

On Tue, Aug 19, 2025 at 06:03:14PM +0000, Dr. David Alan Gilbert wrote:
> > > 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.
> 
> 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

-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-20 12:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 17:45 [PATCH v2] man/man3/strftime.3: Check parameter dave
2025-08-19 11:24 ` Alejandro Colomar
2025-08-19 11:46   ` Dr. David Alan Gilbert
2025-08-19 12:50     ` Alejandro Colomar
2025-08-19 18:03       ` Dr. David Alan Gilbert
2025-08-20 12:30         ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox