Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
firebird-automations opened this issue Sep 5, 2018 · 11 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

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.

Commits: c285c28 3239c9a 60f32c3

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

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)

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

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 ?

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

No, it will not work for {e25}.fdb, only for e{25}.fdb. And for HEAD that pattern is:
database = (%[\\/](e\{{[[:DIGIT:]]{{2}}\}}).fdb)
...

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Will be good to have it noted at fbtrace.conf

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

> 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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

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 ?

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

> 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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Open [ 1 ] => Open [ 1 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.5 [ 10885 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment