threads / patch / 35994

patchOPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

Subject: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

## tl;dr

6 messages between Feb 28, 2014 and Feb 28, 2014. Diffs are folded; open one to read it.

replies: 5people: 3as markdown or json

Sun He· Feb 28, 2014, 14:29 UTC · lore
Signed-off-by: Sun He <sunheehnus@gmail.com>
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to parse-options.c +1 −1
diff --git a/parse-options.c b/parse-options.c
index 7b8d3fa..59a52b0 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -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
---
I came across this protential bug.
According to parse-options.h OPTION_CMDMODE is an option with noarguments and OPTION_NUMBER is special type option.

Thanks,
He Sun
孙赫· Feb 28, 2014, 14:32 UTC · re: Sun He · lore

Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

I am not sure if this is a bug. I need your help to find out it.

Cheers, He Sun

2014-02-28 22:29 GMT+08:00 Sun He <sunheehnus@gmail.com>:
Show 26 quoted lines
> Signed-off-by: Sun He <sunheehnus@gmail.com>
> ---
>  parse-options.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parse-options.c b/parse-options.c
> index 7b8d3fa..59a52b0 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -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
> ---
> I came across this protential bug.
> According to parse-options.h OPTION_CMDMODE is an option with noarguments and OPTION_NUMBER is special type option.
>
> Thanks,
> He Sun
Duy Nguyen· Feb 28, 2014, 14:42 UTC · re: 孙赫 · lore

Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

Way too long subject line. Keep it within 70-75 chars. The rest could be put in the body.

On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <sunheehnus@gmail.com> wrote:
> I am not sure if this is a bug.
> I need your help to find out it.

Tip:git has a wonderful history (most of it anyway). Try "git log --patch parse-options.[ch]" to understand parse-options evolution. Add -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose diff contains that keyword.

-- 
Duy
孙赫· Feb 28, 2014, 15:21 UTC · re: Duy Nguyen · lore

Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

2014-02-28 22:43 GMT+08:00 Duy Nguyen [via git] <ml-node+s661346n7604517h28@n2.nabble.com>:

Show 14 quoted lines
> Way too long subject line. Keep it within 70-75 chars. The rest could
> be put in the body.
>
> On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <[hidden email]> wrote:
>> I am not sure if this is a bug.
>> I need your help to find out it.
>
> Tip:git has a wonderful history (most of it anyway). Try "git log
> --patch parse-options.[ch]" to understand parse-options evolution. Add
> -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
> diff contains that keyword.
> --
> Duy
> --

Got it, Thanks

Show 13 quoted lines
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://git.661346.n2.nabble.com/PATCH-OPTION-CMDMODE-should-be-used-when-not-accept-an-argument-and-OPTION-NUMBER-is-of-special-typeE-tp7604513p7604517.html
> To start a new topic under git, email
> ml-node+s661346n661346h27@n2.nabble.com
> To unsubscribe from git, click here.
> NAML
Junio C Hamano· Feb 28, 2014, 20:02 UTC · re: Duy Nguyen · lore

Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

Duy Nguyen <pclouds@gmail.com> writes:
Show 11 quoted lines
> Way too long subject line. Keep it within 70-75 chars. The rest could
> be put in the body.
>
> On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <sunheehnus@gmail.com> wrote:
>> I am not sure if this is a bug.
>> I need your help to find out it.
>
> Tip:git has a wonderful history (most of it anyway). Try "git log
> --patch parse-options.[ch]" to understand parse-options evolution. Add
> -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
> diff contains that keyword.

Also, I do not think this should be done in a single patch. What if it turns out that explicitly making sure that CMDMODE does not take any argument is a good idea, but the other change is a bad one?

He Sun· Feb 28, 2014, 23:50 UTC · re: Junio C Hamano · lore

Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

2014-03-01 4:02 GMT+08:00 Junio C Hamano [via git] <ml-node+s661346n7604560h61@n2.nabble.com>:

Show 17 quoted lines
> Duy Nguyen <[hidden email]> writes:
>
>> Way too long subject line. Keep it within 70-75 chars. The rest could
>> be put in the body.
>>
>> On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <[hidden email]> wrote:
>>> I am not sure if this is a bug.
>>> I need your help to find out it.
>>
>> Tip:git has a wonderful history (most of it anyway). Try "git log
>> --patch parse-options.[ch]" to understand parse-options evolution. Add
>> -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
>> diff contains that keyword.
>
> Also, I do not think this should be done in a single patch.  What if
> it turns out that explicitly making sure that CMDMODE does not take
> any argument is a good idea, but the other change is a bad one?
OK, I will try to figure it out.
Show 14 quoted lines
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://git.661346.n2.nabble.com/PATCH-OPTION-CMDMODE-should-be-used-when-not-accept-an-argument-and-OPTION-NUMBER-is-of-special-typeE-tp7604513p7604560.html
> To start a new topic under git, email
> ml-node+s661346n661346h27@n2.nabble.com
> To unsubscribe from git, click here.
> NAML

← back to recent threads