Mailing List Archive

Re: Fwd: RT 4.0.13 REST.pm faulty regex?
On 10/29/2013 08:52 AM, Gene Hsu wrote:
>
>
> ---------- Forwarded message ----------
> From: *Gene Hsu* <gene@hsufarm.com <mailto:gene@hsufarm.com>>
> Date: Tue, Oct 29, 2013 at 6:53 AM
> Subject: Re: [rt-devel] RT 4.0.13 REST.pm faulty regex?
> To: Jason Baum <jbaum-contractor@marchex.com
> <mailto:jbaum-contractor@marchex.com>>
>
>
> '-' must be at the beginning or end of a character class in order to be
> interpreted as a '-', otherwise it is interpreted as a range separator.
>
> I know nothing about the business logic around the regex, but it could
> conceivably be this:
>
> my $field = '[a-z][a-z0-9_ ~/-]*’;
>
> The error exists because '_' comes after ' ' in the character set, since
> a range is specified from lower bounds to upper bounds.
>
> -- Gene

This makes sense to me. I'll make the change & report back. Thank you.

>
>
>
> On Tue, Oct 29, 2013 at 12:04 AM, Jason Baum
> <jbaum-contractor@marchex.com <mailto:jbaum-contractor@marchex.com>> wrote:
>
> Hello,
>
> We recently upgraded from RT 3.6 to RT 4.0.13, and suddenly a couple
> previously working Perl scripts that use the RT::Client::REST
> convenience library (version 0.44) stopped working, and started
> indicating an error with the regex in
> /rt-4.0.13/lib/RT/Interface/REST.pm line 141, which in turn
> references the $field variable defined on line 74 in that same file.
>
> The regex defined there is as follows:
>
> my $field = '[a-z][a-z0-9_- ~/]*’;
>
> Perl is complaining about an “Invalid [] range “_- “ in regex” at
> this location, which you can see follows the 9 character.
>
> I’m wondering if anyone else has come across this problem and if
> they have a suggested solution or knows what the correct regex
> should be.
>
> Thanks,
> Jason
>
>
>
Re: Fwd: RT 4.0.13 REST.pm faulty regex? [ In reply to ]
On 10/29/2013 09:03 AM, Tim Wiley wrote:
> On 10/29/2013 08:52 AM, Gene Hsu wrote:
>>
>>
>> ---------- Forwarded message ----------
>> From: *Gene Hsu* <gene@hsufarm.com <mailto:gene@hsufarm.com>>
>> Date: Tue, Oct 29, 2013 at 6:53 AM
>> Subject: Re: [rt-devel] RT 4.0.13 REST.pm faulty regex?
>> To: Jason Baum <jbaum-contractor@marchex.com
>> <mailto:jbaum-contractor@marchex.com>>
>>
>>
>> '-' must be at the beginning or end of a character class in order to be
>> interpreted as a '-', otherwise it is interpreted as a range separator.
>>
>> I know nothing about the business logic around the regex, but it could
>> conceivably be this:
>>
>> my $field = '[a-z][a-z0-9_ ~/-]*’;
>>
>> The error exists because '_' comes after ' ' in the character set, since
>> a range is specified from lower bounds to upper bounds.

That worked beautifully. Thank you for the regex help. I guess it's
true that you learn something new every day.
Re: Fwd: RT 4.0.13 REST.pm faulty regex? [ In reply to ]
On Wed, Oct 30, 2013 at 10:09:09AM -0700, Tim Wiley wrote:
> >>my $field = '[a-z][a-z0-9_ ~/-]*’;
> >>
> >>The error exists because '_' comes after ' ' in the character set, since
> >>a range is specified from lower bounds to upper bounds.
>
> That worked beautifully. Thank you for the regex help. I guess
> it's true that you learn something new every day.

The regex you're changing is actually the one for parsing

Subject:
Requestors:

from the REST submission. The code for handling
CF.{Foo} comes from the custom_field_spec and is much more liberal
already. I expect some other problem, but you didn't show a REST
trace.

On 4.2.0 I can run
./bin/rt ls "'CF.{F~G/Bar}' = 1"
and see over the wire
CF.{F~G/Bar}: 1
and that gets parsed properly and returns values.

Your report did uncover another interesting thing, but not the bug as
reported/fixed by your change.

-kevin