found and fixed this problem and added libast optget() regression tests
solaris style long options are handled as a translation to an ast optget() 
string
the translation loop had an off-by-one bug
you can see the translated string via the --'??usage' option

# the working test case
$ getopts 'f:(file)o:(output-file)d:' opt --'??usage'
[-][f:file]:[string][o:output-file]:[string][d]:[string]

# the test case without patched optget() (used by ksh93)
$ getopts 'd:f:(file)o:(output-file)' opt --'??usage'
[-][d]:[string][::file][o:output-file]:[string]

# the test case with patched optget()
$ getopts 'd:f:(file)o:(output-file)' opt --'??usage'
[-][d]:[string][f:file]:[string][o:output-file]:[string]

On Thu, 17 Dec 2009 07:20:44 -0700 (MST) bugmail-sender at Sun.COM wrote:
> *Synopsis*: getopts in ksh93 failed to deal with short/long options mix

> CR 6909579 changed on Dec 17 2009 by <User 1-PWPBN>

> === Field ============ === New Value ============= === Old Value =============

> Status                 3-Accepted                  1-Dispatched               
> Work Around            New Note                                               
> ====================== =========================== ===========================

>      
> *Change Request ID*: 6909579

> *Synopsis*: getopts in ksh93 failed to deal with short/long options mix

>   Product: solaris
>   Category: shell
>   Subcategory: korn93
>   Type: Defect
>   Subtype: 
>   Status: 3-Accepted
>   Substatus: 
>   Priority: 3-Medium
>   Introduced In Release: 
>   Introduced In Build: 
>   Responsible Engineer: <User 1-PWPBN>
>   Keywords: 

> === *Description* ============================================================
> in the opensolaris of snv_128, getopts failed to deal with a short/long 
> options mix.
> getopts "d:(directory)f:(file)(input-file)o:(output-file)" opt
> and getopts "d:f:o:" opt worked fine, but
> getopts "d:f:(file)(input-file)o:(output-file)" opt failed with "-f: unknown 
> option" when invoked with "-f tmpfile"

> *** (#1 of 1): 2009-12-11 07:58:07 GMT+00:00 <User 1-FHVYR>

> === *Public Comments* ========================================================

> === *Workaround* =============================================================
> Move long options to the beginning of optstring

> This works
>     f:(file)o:(output-file)d:

> This does not
>     d:f:(file)o:(output-file)

> *** (#1 of 1): 2009-12-17 14:03:43 GMT+00:00 <User 1-PWPBN>

> === *Additional Details* =====================================================
>         Targeted Release: 
>         Commit To Fix In Build: 
>         Fixed In Build: 
>         Integrated In Build: 
>         Verified In Build: 
>   See Also: 6909580
>   Duplicate of: 
>   Hooks:
>         Hook1: 
>         Hook2: 
>         Hook3: 
>         Hook4: 
>         Hook5: 
>         Hook6: 
>   Program Management: 
>   Root Cause: 
>   Fix Affects Documentation: No
>   Fix Affects Localization: No

> === *History* ================================================================
>         Date Submitted: 2009-12-11 07:58:07 GMT+00:00
>         Submitted By: <User 1-FHVYR>

>         Status Changed    Date Updated                  Updated By
>         2-Incomplete      2009-12-15 15:38:53 GMT+00:00 <User 1-PWPBN>
>         1-Dispatched      2009-12-16 01:34:27 GMT+00:00 <User 1-FHVYR>
>         3-Accepted        2009-12-17 14:03:43 GMT+00:00 <User 1-PWPBN>

> === *Service Request* ========================================================
>         Impact: Significant
>         Functionality: Secondary
>         Severity: 3
>         Product Name: solaris
>         Product Release: osol_2009.06u9
>         Product Build: 
>         Operating System: osol_2009.06u6
>         Hardware: generic
>         Submitted Date: 2009-12-11 07:58:08 GMT+00:00

> === *Multiple Release (MR) Cluster* - 0 ======================================

> _______________________________________________
> ksh93-integration-discuss mailing list
> ksh93-integration-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss

Reply via email to