> Date: Tue, 04 Nov 2008 20:36:26 +0100
> From: Roland Mainz <roland.mainz at nrubsig.org>
> X-Accept-Language: en
> To: April Chin <April.Chin at eng.sun.com>
> CC: Korn Shell 93 integration/migration project discussion 
<ksh93-integration-discuss at opensolaris.org>
> Subject: Re: [ksh93-integration-discuss] CR 6766246 Updated P3 shell/korn93 
bugin  pattern matching
> X-Virus-Scanned: ClamAV 0.93.3/8567/Tue Nov  4 15:24:07 2008 on 
mail-in-05.arcor-online.net
> X-Virus-Status: Clean
> 
> bugmail-sender at Sun.COM wrote:
> > *Synopsis*: bug in pattern matching
> > 
> > CR 6766246 changed on Nov 4 2008 by <User 1-5Q-1267>
> [snip]
> > Category
> >    shell
> > Sub-Category
> >    bourne
> > Description
> >    This was already reported as
> > http://www.opensolaris.org/jive/thread.jspa?threadID=80967
> > The bootstrap script of pkgsrc contains this code
> > checkarg_sane_absolute_path() {
> >   case "$1" in
> >     "") ;; # the default value will be used.
> >     *[!-A-Za-z0-9_./]*)
> >       die "ERROR: Invalid characters in path $1 (from $2)." ;;
> >     /*) ;;
> >     *) die "ERROR: The argument to $2 must be an absolute path." ;;
> >   esac
> > }
> > It turns out, the leading "!" in the pattern is not interpreted as 
> > negation, 
and the first "-" not as a literal. Instead the character range "! to A" is 
constructed. Paths containing "%" or "@" are accepted, but paths containing "-" 
are rejected. Note that this interpretation makes the whole pattern 
syntactically wrong, which isn't noticed either.
> > Frequency
> >    Always
> > Regression
> >    Solaris 10
> > Steps to Reproduce
> >    run example below
> > Expected Result
> >    strings containing a "-" should be accepted, strings containing a "@" 
should be rejected
> > Actual Result
> >    strings containing a "-" are rejected, strings containing a "@" are 
accepted
> > Error Message(s)
> > 
> > Test Case
> >    #!/bin/sh
> > case "$1" in
> > *[!-A-Za-z0-9_./]*)
> >         echo invalid characters used in $1
> >         ;;
> > *)
> >         echo only valid characters used in $1
> >         ;;
> > esac
> > Workaround
> >    The pattern "*[!A-Za-z0-9_./-]*" (i.e. shifting the dash to the end) 
works as expected.
> > Submitter wants to work on bug
> >    No
> > Additional configuration information
> > 
> > *** (#1 of 1): 2008-10-31 17:54:10 GMT+00:00 <User 1-F4SZV>
> > 
> > === *Public Comments* 
========================================================
> > Since the post on the forums that was posted to says "I am using OpenSolaris
> > 2008.05.", assigning this to shell/korn93, not shell/bourne.
> > (2008.05 /bin/sh is ksh93.)
> > 
> > *** (#1 of 2): 2008-11-04 04:09:56 GMT+00:00 alan.coopersmith at sun.com
> > *** Last Edit: 2008-11-04 15:23:49 GMT+00:00 alan.coopersmith at sun.com
> > 
> > Glenn Fowler has responded to the bug report on the 
ksh93-integration-discuss
> > list/forum on opensolaris.org with:
> > 
> > thanks for the report
> > its a coding bug exposed by character class ranges in non-C locales
> > as a temporary workaround, the matching should work as expected for LC_ALL=C
> > the fix has been posted in the official 2008-11-04 source tarballs at
> >   http://www.research.att.com/sw/download/
> > 
> > [Thread at 
http://www.opensolaris.org/jive/thread.jspa?threadID=81453&tstart=0 ]
> 
> April: Can you add the comment that the matching testcase now sits in
> 
http://svn.genunix.org/repos/on/branches/ksh93/gisburn/scripts/tests/sun_solaris
_cr_6766246_pattern_matching_bug.sh
> , please ?

Yes, the bug has been updated now.

        April
> 
> I'll update the prototype012 tree to ast-ksh.2008-11-04 in a few
> hours...
> 
> ----
> 
> Bye,
> Roland
> 
> -- 
>   __ .  . __
>  (o.\ \/ /.o) roland.mainz at nrubsig.org
>   \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
>   /O /==\ O\  TEL +49 641 3992797
>  (;O/ \/ \O;)


Reply via email to