Ticket #54 (closed defect: fixed)

Opened 9 months ago

Last modified 8 months ago

properly escape '?'

Reported by: okan@demirmen.com Assigned to: athomas
Priority: major Component: DevTodo
Severity: normal Keywords:
Cc:

Description

need to properly escape '?' so that some regex implementations don't complain about a repetition operator error; but really, '?' should be escaped anyway.

without this, no xml database may be read.

Attachments

patch-util_XML_cc (0.5 kB) - added by okan@demirmen.com on 12/10/07 22:13:23.

Change History

12/10/07 22:13:23 changed by okan@demirmen.com

  • attachment patch-util_XML_cc added.

12/11/07 10:00:43 changed by athomas

  • component changed from bpkg to DevTodo.

(follow-up: ↓ 3 ) 12/11/07 10:02:21 changed by athomas

The ? is a modifier for * to prevent a greedy match. On what system did you see this error?

(in reply to: ↑ 2 ) 12/11/07 10:58:43 changed by anonymous

Replying to athomas:

The ? is a modifier for * to prevent a greedy match. On what system did you see this error?

OpenBSD. i tried on FreeBSD as well with the same result.

basically, the thing compiles. once an xml database is created, devtodo can't read it due to the regex pattern sent to regcomp().

from our regex(3):

A repetition operator (?, *, +, or bounds) cannot follow another repeti- tion operator. A repetition operator cannot begin an expression or subexpression or follow ^' or |'.

i now see what you meant by using '?' as to control the greediness, and not to match the last '?' in the spec.

(follow-up: ↓ 5 ) 12/11/07 16:02:11 changed by okan@demirmen.com

how about: "<\\?xml[\\?].*\\?>[[:space:]]*" instead?

(in reply to: ↑ 4 ) 12/11/07 16:03:29 changed by okan@demirmen.com

Replying to okan@demirmen.com:

how about: "<\\?xml[\\?].*\\?>[[:space:]]*" instead?

uhm, wiki ate my last one:

"<\\?xml[^\\?].*\\?>[[:space:]]*"

12/14/07 18:04:36 changed by athomas

Yeah, that looks good to me.

12/26/07 22:39:57 changed by athomas

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r491, thanks!


Add/Change #54 (properly escape '?')




Change Properties
Action