Skip to contentSkip to conversation

parse-options.c:parse_options_check() change OPTION_NUMBER to OPTION_CMDMODE

PATCH In review Sun He 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Sun He

author
#0 lore raw

PATCH 1/1 parse-options.c:parse_options_check() change OPTION_NUMBER to OPTION_CMDMODE

---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parse-options.c +1 -1
index 7b8d3fa..59a52b0 100644
@@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
 		case OPTION_NEGBIT:
 		case OPTION_SET_INT:
 		case OPTION_SET_PTR:
-		case OPTION_NUMBER:
+		case OPTION_CMDMODE:
 			if ((opts->flags & PARSE_OPT_OPTARG) ||
 			    !(opts->flags & PARSE_OPT_NOARG))
 				err |= optbug(opts, "should not accept an argument");
Signature · 10 lines
1.9.0.138.g2de3478.dirty

Hi,
When I was reading code yesterday, I came across this protential bug.
parse-options.h says that OPTION_CMDMODE is an option with no arguments and OPTION_NUMBER is special type option.

According to the information the program says (Should not accept an argument), I think you should take this patch into consideration.
Thanks.

He Sun
#1 lore raw
Quoted 30 lines · Sun He
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parse-options.c +1 -1
index 7b8d3fa..59a52b0 100644
@@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
 		case OPTION_NEGBIT:
 		case OPTION_SET_INT:
 		case OPTION_SET_PTR:
-		case OPTION_NUMBER:
+		case OPTION_CMDMODE:
 			if ((opts->flags & PARSE_OPT_OPTARG) ||
 			    !(opts->flags & PARSE_OPT_NOARG))
 				err |= optbug(opts, "should not accept an argument");
Signature · 11 lines
-- 
1.9.0.138.g2de3478.dirty

Hi,
When I was reading code yesterday, I came across this protential bug.
parse-options.h says that OPTION_CMDMODE is an option with no arguments and OPTION_NUMBER is special type option.

According to the information the program says (Should not accept an argument), I think you should take this patch into consideration.
Thanks.

He Sun

Please resubmit this change in the proper format (as described by Eric Sunshine WRT another one of your patches). Also please remember to distinguish between information that should go in the commit log message, which will be stored permanently to the repository and help future developers understand your change, vs. side notes meant only for the mailing list. For example, for the log message, stuff like:

OPTION_CMDMODE should be used when ... So change the mode to OPTION_CMDMODE so that ...

vs. for the mailing list discussion:

When I was reading code yesterday ...

The former goes above the "---" line and the latter goes directly below it.

BTW, none of my comments should be taken to indicate whether the commit itself makes sense or not. I haven't checked that far.

Michael

Signature · 3 lines
Michael Haggerty
[email protected]
http://softwareswirl.blogspot.com/
#2 lore raw
Quoted 65 lines · Michael Haggerty
Quoted 22 lines · Sun He
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parse-options.c +1 -2
index 7b8d3fa..59a52b0 100644
@@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
              case OPTION_NEGBIT:
              case OPTION_SET_INT:
              case OPTION_SET_PTR:
-             case OPTION_NUMBER:
+             case OPTION_CMDMODE:
                      if ((opts->flags & PARSE_OPT_OPTARG) ||
                          !(opts->flags & PARSE_OPT_NOARG))
                              err |= optbug(opts, "should not accept an argument");
 
--

1.9.0.138.g2de3478.dirty

Quoted 8 lines

Hi,
When I was reading code yesterday, I came across this protential bug.
parse-options.h says that OPTION_CMDMODE is an option with no arguments and OPTION_NUMBER is special type option.

According to the information the program says (Should not accept an argument), I think you should take this patch into consideration. Thanks.

He Sun

Please resubmit this change in the proper format (as described by Eric Sunshine WRT another one of your patches). Also please remember to distinguish between information that should go in the commit log message, which will be stored permanently to the repository and help future developers understand your change, vs. side notes meant only for the mailing list. For example, for the log message, stuff like:

OPTION_CMDMODE should be used when ... So change the mode to OPTION_CMDMODE so that ...

vs. for the mailing list discussion:

When I was reading code yesterday ...

The former goes above the "---" line and the latter goes directly below it.

BTW, none of my comments should be taken to indicate whether the commit itself makes sense or not. I haven't checked that far.

Michael

--
Michael Haggerty
[email protected]
http://softwareswirl.blogspot.com/
--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

.<

#3 lore raw
In reply to Michael Haggerty
Quoted 20 lines · Michael Haggerty
Quoted 19 lines · Sun He
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parse-options.c +1 -1
index 7b8d3fa..59a52b0 100644
@@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
 		case OPTION_NEGBIT:
 		case OPTION_SET_INT:
 		case OPTION_SET_PTR:
-		case OPTION_NUMBER:
+		case OPTION_CMDMODE:
 			if ((opts->flags & PARSE_OPT_OPTARG) ||
 			    !(opts->flags & PARSE_OPT_NOARG))
 				err |= optbug(opts, "should not accept an argument");
Quoted 6 lines
Quoted 6 lines
Signature · 5 lines
1.9.0.138.g2de3478.dirty

Hi,
When I was reading code yesterday, I came across this protential bug.
parse-options.h says that OPTION_CMDMODE is an option with no arguments and OPTION_NUMBER is special type option.

Please, no overlong line in the text part that makes things unnecessarily hard to read.

I agree with all the comments in the message I am responding to.

Quoted 2 lines

BTW, none of my comments should be taken to indicate whether the commit itself makes sense or not. I haven't checked that far.

While I think it is sensible to make sure CMDMODE is not marked to allow arguments, I do not understand why "special type" would imply "it is allowed to be marked to take an argument". Why is it a good change to remove "case OPTION_NUMBER:" here?

author
#4 lore raw

2014-03-01 3:42 GMT+08:00 Junio C Hamano <[email protected]>:

Quoted 25 lines
Quoted 23 lines · Michael Haggerty
Quoted 22 lines · Sun He
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parse-options.c +1 -2
index 7b8d3fa..59a52b0 100644
@@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
             case OPTION_NEGBIT:
             case OPTION_SET_INT:
             case OPTION_SET_PTR:
-            case OPTION_NUMBER:
+            case OPTION_CMDMODE:
                     if ((opts->flags & PARSE_OPT_OPTARG) ||
                         !(opts->flags & PARSE_OPT_NOARG))
                             err |= optbug(opts, "should not accept an argument");
 
--

1.9.0.138.g2de3478.dirty

Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Hi,
When I was reading code yesterday, I came across this protential bug.
parse-options.h says that OPTION_CMDMODE is an option with no arguments and OPTION_NUMBER is special type option.

Please, no overlong line in the text part that makes things unnecessarily hard to read.

I agree with all the comments in the message I am responding to.

OK, got it. Thanks.

Quoted 7 lines
Quoted 2 lines

BTW, none of my comments should be taken to indicate whether the commit itself makes sense or not. I haven't checked that far.

While I think it is sensible to make sure CMDMODE is not marked to allow arguments, I do not understand why "special type" would imply "it is allowed to be marked to take an argument". Why is it a good change to remove "case OPTION_NUMBER:" here?

The comments in parse-options.h (Line 10-16) says that CMDMODE is not marked to allow arguments. And I am not sure if removing OPTION_NUMBER is a proper way.