Ticket #54 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

properly escape '?'

Reported by: okan@… Owned by: 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@… 3 years ago.

Change History

Changed 3 years ago by okan@…

  Changed 3 years ago by athomas

  • component changed from bpkg to DevTodo

follow-up: ↓ 3   Changed 3 years ago by athomas

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

in reply to: ↑ 2   Changed 3 years ago 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   Changed 3 years ago by okan@…

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

in reply to: ↑ 4   Changed 3 years ago by okan@…

Replying to okan@demirmen.com:

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

uhm, wiki ate my last one:

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

  Changed 3 years ago by athomas

Yeah, that looks good to me.

  Changed 3 years ago by athomas

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

Fixed in r491, thanks!

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

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.