* [PATCH] parse-options: fix sparse 'plain integer as NULL pointer'
@ 2026-04-23 16:05 Ramsay Jones
2026-04-24 2:47 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2026-04-23 16:05 UTC (permalink / raw)
To: Jiamu Sun; +Cc: GIT Mailing-list, Junio C Hamano
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Jiamu Sun,
If you need to re-roll your 'js/parseopt-subcommand-autocorrection'
branch, could you please squash this into the patch corresponding
to commit b9e6a2d30a ("parseopt: autocorrect mistyped subcommands",
2026-04-23).
Thanks.
ATB,
Ramsay Jones
parse-options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parse-options.c b/parse-options.c
index d60e7bd3c9..14f3f385eb 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -658,7 +658,7 @@ static const char *autocorrect_subcommand(const char *cmd,
for_each_string_list_item(cand, cmds) {
if (starts_with(cand->string, cmd)) {
- cand->util = 0;
+ cand->util = NULL;
} else {
int edit = levenshtein(cmd, cand->string,
0, 2, 1, 3) + 1;
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] parse-options: fix sparse 'plain integer as NULL pointer'
2026-04-23 16:05 [PATCH] parse-options: fix sparse 'plain integer as NULL pointer' Ramsay Jones
@ 2026-04-24 2:47 ` Junio C Hamano
2026-04-26 12:14 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2026-04-24 2:47 UTC (permalink / raw)
To: Ramsay Jones; +Cc: Jiamu Sun, GIT Mailing-list
Another thing from GitHub CI
https://github.com/git/git/actions/runs/24825391649/job/72659919418#step:9:144
Error: parse-options.c:680:30: comparison of integer expressions of
different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
680 | (n < cmds->nr && best == (intptr_t)cmds->items[n].util);
| ^~
2026年4月24日(金) 1:05 Ramsay Jones <ramsay@ramsayjones.plus.com>:
>
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Jiamu Sun,
>
> If you need to re-roll your 'js/parseopt-subcommand-autocorrection'
> branch, could you please squash this into the patch corresponding
> to commit b9e6a2d30a ("parseopt: autocorrect mistyped subcommands",
> 2026-04-23).
>
> Thanks.
>
> ATB,
> Ramsay Jones
>
> parse-options.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parse-options.c b/parse-options.c
> index d60e7bd3c9..14f3f385eb 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -658,7 +658,7 @@ static const char *autocorrect_subcommand(const char *cmd,
>
> for_each_string_list_item(cand, cmds) {
> if (starts_with(cand->string, cmd)) {
> - cand->util = 0;
> + cand->util = NULL;
> } else {
> int edit = levenshtein(cmd, cand->string,
> 0, 2, 1, 3) + 1;
> --
> 2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] parse-options: fix sparse 'plain integer as NULL pointer'
2026-04-24 2:47 ` Junio C Hamano
@ 2026-04-26 12:14 ` Johannes Schindelin
2026-04-29 5:13 ` Jiamu Sun
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2026-04-26 12:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ramsay Jones, Jiamu Sun, GIT Mailing-list
[-- Attachment #1: Type: text/plain, Size: 2840 bytes --]
Hi Junio,
On Sun, 26 Apr 2026, Junio C Hamano wrote:
> Another thing from GitHub CI
>
> https://github.com/git/git/actions/runs/24825391649/job/72659919418#step:9:144
>
> Error: parse-options.c:680:30: comparison of integer expressions of
> different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
> 680 | (n < cmds->nr && best == (intptr_t)cmds->items[n].util);
> | ^~
Indeed. With this patch on top of Ramsay's fixup, it passes the build:
https://github.com/dscho/git/actions/runs/24955417618
-- snip --
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Sun, 26 Apr 2026 11:11:35 +0000
Subject: [PATCH] fixup! parseopt: autocorrect mistyped subcommands
Fix a build warning in `linux32`: Change `best` from `unsigned int` to
`intptr_t` to match the `(intptr_t)` casts it is compared against, fixing
a sign-compare warning on 32-bit platforms where `intptr_t` is `int`.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
parse-options.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/parse-options.c b/parse-options.c
index 14f3f385eb4..0ba6905fed5 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -648,7 +648,8 @@ static const char *autocorrect_subcommand(const char *cmd,
struct string_list *cmds)
{
struct autocorrect autocorrect = { 0 };
- unsigned int n = 0, best = 0;
+ unsigned int n = 0;
+ intptr_t best = 0;
struct string_list_item *cand;
autocorrect_resolve(&autocorrect);
-- snap --
Ciao,
Johannes
>
> 2026年4月24日(金) 1:05 Ramsay Jones <ramsay@ramsayjones.plus.com>:
> >
> >
> > Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> > ---
> >
> > Hi Jiamu Sun,
> >
> > If you need to re-roll your 'js/parseopt-subcommand-autocorrection'
> > branch, could you please squash this into the patch corresponding
> > to commit b9e6a2d30a ("parseopt: autocorrect mistyped subcommands",
> > 2026-04-23).
> >
> > Thanks.
> >
> > ATB,
> > Ramsay Jones
> >
> > parse-options.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/parse-options.c b/parse-options.c
> > index d60e7bd3c9..14f3f385eb 100644
> > --- a/parse-options.c
> > +++ b/parse-options.c
> > @@ -658,7 +658,7 @@ static const char *autocorrect_subcommand(const char *cmd,
> >
> > for_each_string_list_item(cand, cmds) {
> > if (starts_with(cand->string, cmd)) {
> > - cand->util = 0;
> > + cand->util = NULL;
> > } else {
> > int edit = levenshtein(cmd, cand->string,
> > 0, 2, 1, 3) + 1;
> > --
> > 2.54.0
>
>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] parse-options: fix sparse 'plain integer as NULL pointer'
2026-04-26 12:14 ` Johannes Schindelin
@ 2026-04-29 5:13 ` Jiamu Sun
0 siblings, 0 replies; 4+ messages in thread
From: Jiamu Sun @ 2026-04-29 5:13 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, Ramsay Jones, GIT Mailing-list
On Sun, Apr 26, 2026 at 02:14:03PM +0200, Johannes Schindelin wrote:
> Indeed. With this patch on top of Ramsay's fixup, it passes the build:
>
> Assisted-by: Claude Opus 4.6
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> parse-options.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/parse-options.c b/parse-options.c
> index 14f3f385eb4..0ba6905fed5 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -648,7 +648,8 @@ static const char *autocorrect_subcommand(const char *cmd,
> struct string_list *cmds)
> {
> struct autocorrect autocorrect = { 0 };
> - unsigned int n = 0, best = 0;
> + unsigned int n = 0;
> + intptr_t best = 0;
> struct string_list_item *cand;
>
> autocorrect_resolve(&autocorrect);
> -- snap --
>
> > > Ramsay Jones
> > >
> > > parse-options.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/parse-options.c b/parse-options.c
> > > index d60e7bd3c9..14f3f385eb 100644
> > > --- a/parse-options.c
> > > +++ b/parse-options.c
> > > @@ -658,7 +658,7 @@ static const char *autocorrect_subcommand(const char *cmd,
> > >
> > > for_each_string_list_item(cand, cmds) {
> > > if (starts_with(cand->string, cmd)) {
> > > - cand->util = 0;
> > > + cand->util = NULL;
> > > } else {
> > > int edit = levenshtein(cmd, cand->string,
> > > 0, 2, 1, 3) + 1;
> > > --
> > > 2.54.0
Will squash these in next re-roll.
Thanks everyone for catching these issues and providing the fixups.
--
Jiamu Sun <39@barroit.sh>
<sunjiamu@outlook.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-29 5:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 16:05 [PATCH] parse-options: fix sparse 'plain integer as NULL pointer' Ramsay Jones
2026-04-24 2:47 ` Junio C Hamano
2026-04-26 12:14 ` Johannes Schindelin
2026-04-29 5:13 ` Jiamu Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox