Issue Details (XML | Word | Printable)

Key: CORE-5907
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Pavel Zotov
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Regression: can not launch trace if its 'database' section contains regexp pattern with curvy brackets to enclose quantifier

Created: 05/Sep/18 11:29 AM   Updated: 05/Oct/18 02:24 PM
Component/s: TRACEMGR
Affects Version/s: 4.0 Alpha 1, 3.0.3
Fix Version/s: 4.0 Beta 1, 3.0.5

QA Status: Done successfully


 Description  « Hide
Suppose that you have several databases with names 'e25.fdb', 'e26.fdb', 'e27.fdb', ...
If you want to trace activity in any of them it is reasonable do not enumerate all these names in the trace config; rather specify just pattern.

1) For 2.5 trace config will be like this:
<database (%[\\/](e[[:DIGIT:]]{2}).fdb)>
    enabled true
     . . .
</database>

It is enough to launch ISQL and check whether we use correct pattern in <database> section:

echo set list on; select 1 from rdb$database where 'C:\MIX\firebird\QA\fbt-repo\tmp\e25.fdb' similar to '%[\\/](e[[:DIGIT:]]{2}).fdb'; | C:\MIX\firebird\fb25\bin\isql /:employee

Output on 2.5.9.27115 will be: 1, i.e. all fine.

2) For 3.0+ we have to modify 'database' section and replace "< ... >" with "{... }" because of changed syntax, but the pattern will (and must) be the same:

database = (%[\\/](e[[:DIGIT:]]{2}).fdb)
{
  enabled = true
   . . .
}

But this does not work.
Trace log will be like this:
===
Trace session ID 1 started
Error creating trace session for database "":
Passed text: illegal line <database = (%[\\/](e[[:DIGIT:]]{2}).fdb)>
===

AFAIU, the problem relates to "{" and "}" that are used within pattern.
If we change 'database' section in such manner that no curvy brackets will be used than all again fine:

database = (%[\\/](e[[:DIGIT:]][[:DIGIT:]]).fdb) # this DOES work, no errors.
{
  . . .
}


Checked on: WI-T4.0.0.1198 ; WI-V3.0.4.33045.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 23/Sep/18 05:06 PM
It's impossible tor restore 1to1 2.5 behavior - "{" and "}" have special meaning since fb3. Therefore added special rule - to enter that symbols type them twice, i.e. "{{" and "}}". Line from the sample will look like:
 database = (%[\\/](e[[:DIGIT:]]{{2}}).fdb)

Pavel Zotov added a comment - 23/Sep/18 09:28 PM
What about database with exotic name, e.g. {e25}.fdb ? (i.e. curvy brackets are part of this name)

In 2.5 following pattern will work for such names:

<database (%[\\/](e\{[[:DIGIT:]]{2}\}).fdb)>
...

How should this pattern look in 3.0 ?



Alexander Peshkov added a comment - 24/Sep/18 06:45 AM
No, it will not work for {e25}.fdb, only for e{25}.fdb. And for HEAD that pattern is:
database = (%[\\/](e\{{[[:DIGIT:]]{{2}}\}}).fdb)
...

Vlad Khorsun added a comment - 24/Sep/18 06:55 AM
Will be good to have it noted at fbtrace.conf

Pavel Zotov added a comment - 25/Sep/18 09:55 PM
> And for HEAD that pattern is:
> database = (%[\\/](e\{{[[:DIGIT:]]{{2}}\}}).fdb)

Unfortunately, it does not work (checked on WI-T4.0.0.1224 F, build of 25.09.2018).

Test is trivial: i just copy string that you've provided to trace config:
===
database = (%[\\/](e\{{[[:DIGIT:]]{{2}}\}}).fdb)
{
  enabled = true
  time_threshold = 0
  log_statement_finish = true
}
===

-- then launching trace. And immediately get error:

C:\MIX\firebird\fb30\fbsvcmgr.exe localhost:service_mgr action_trace_start trc_cfg C:\MIX\firebird\QA\fbt-repo\tmp\tmp_trace_5907.cfg

Trace session ID 8 started
Error creating trace session for database "":
Passed text: illegal line <database = (%[\\/](e\{{[[:DIGIT:]]{{2}}\}}).fdb)>

Duplicating of back slashes: database = (%[\\/](e\\{{[[:DIGIT:]]{{2}}\\}}).fdb) -- also does not help ,same error.

Pavel Zotov added a comment - 25/Sep/18 10:01 PM
BTW, quote from doc ( https://firebirdsql.org/refdocs/langrefupd25-similar-to.html ):
===
Building regular expressions
Characters

Within regular expressions, most characters represent themselves. The only exceptions are the special characters below:

    [ ] ( ) | ^ - + * % _ ? {

...and the escape character, if it is defined.
===

Where is CLOSING curvy bracket, "}", in this list ?


Pavel Zotov added a comment - 26/Sep/18 06:09 AM
> Unfortunately, it does not work (checked on WI-T4.0.0.1224 F, build of 25.09.2018).
> Test is trivial: i just copy

Sorry for noise... It DOES work on WI-T4.0.0.1224, i did mistake related to multiple instances of FB installed on my machine.