bugGNU Gengetopt - Bugs: bug #35724, wrong abbreviation of non uniq...

 
 

bug #35724: wrong abbreviation of non uniq long options

Submitted by:  Ruediger Meier <rudimeier>
Submitted on:  Mon 05 Mar 2012 02:43:57 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Originator Name: Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 05 Mar 2012 03:50:11 PM UTC, comment #4:

Ok, attaching foo.ggo
and a patch for the resulting cmdline.c (made by gengetopt -i foo.ggo).

It's not really tested - just to see how to go.
I guess within the new pseudo_shortopt* cases we still need to correct the update_arg() call and maybe removing the useless strcmp().

(file #25267, file #25268)

Ruediger Meier <rudimeier>
Mon 05 Mar 2012 03:07:47 PM UTC, comment #3:

yes, please! if this fix can be generalized

Lorenzo Bettini <bettini>
Project Administrator
Mon 05 Mar 2012 03:06:29 PM UTC, comment #2:

I haven't fixed it in gengetopt but could send you an example how I would fix the gengetopt generated code if this would be useful for you.

Ruediger Meier <rudimeier>
Mon 05 Mar 2012 02:50:06 PM UTC, comment #1:

can you please attach an example of fix?

Lorenzo Bettini <bettini>
Project Administrator
Mon 05 Mar 2012 02:43:57 PM UTC, original submission:

If you have long options without corresponding sort opts like this for example:

option "koma" -
"help text koma"
optional

option "komb" -
"help text komb"
optional

then
myprog --ko
does not return an error "option '--f' is ambiguous" like it does if you also specify different shortopts for both --kom* opts.
Instead it just sets koma_given.

The fix would be to use other vals than 0 for such options in
struct option long_options.
For a good example how to do this nicely see ls.c from coreutils how they handle 3 longopts starting with --f.

Ruediger Meier <rudimeier>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #25267:  foo.ggo added by rudimeier (115B - application/octet-stream)
file #25268:  cmdline.patch added by rudimeier (2kB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bettini (Posted a comment)
  • -unavailable- added by rudimeier (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 05 Mar 2012 03:50:11 PM UTCrudimeierAttached File-=>Added foo.ggo, #25267
      Attached File-=>Added cmdline.patch, #25268

    Back to the top


    Powered by Savane 3.1-cleanup