View Issue Details

IDProjectCategoryView StatusLast Update
0036603FPCPackagespublic2020-05-03 19:26
ReporterCyrax Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinux x86_64OSArch 
Fixed in Version3.3.1 
Summary0036603: Due to recent changes to FPC 3.3.1 trunk RegExpr unit, IDE Find dialog now shows error dialog.
DescriptionFind dialog shows now a error dialog with this context when trying to search a term: 'TRegExpr exec: empty input string'
TagsNo tags attached.
Fixed in Revision44179
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

Cyrax

2020-01-19 08:10

reporter   ~0120531

Strange, only x86-64-linux version is affected. Lazarus trunk i386-linux works nicely.

Cyrax

2020-01-19 08:14

reporter   ~0120532

Related to bug report https://bugs.freepascal.org/view.php?id=36482

Cyrax

2020-01-19 08:25

reporter   ~0120533

Backtrace from GDB:

Breakpoint 1, TREGEXPR__EXECPRIM (this=0x49eb608, AOFFSET=1, ATRYONCE=false, ASLOWCHECKS=false) at regexpr/src/regexpr.pas:4178
4178	    Error(reeNoInputStringSpecified);
(gdb) bt
#0  0x00000000010092f6 in TREGEXPR__EXECPRIM (this=0x49eb608, AOFFSET=1, ATRYONCE=false, ASLOWCHECKS=false) at regexpr/src/regexpr.pas:4178
0000001  0x00007fffffffcb00 in  ()
0000002  0x0000000000000001 in  ()
0000003  0x0000000002244200 in VMT_$SYNEDITTEXTTABEXPANDER_$$_TSYNEDITSTRINGTABEXPANDER ()
0000004  0x0000000000000001 in  ()
0000005  0x00000000049eb608 in  ()
0000006  0x000000000100913b in TREGEXPR__EXECPOS (this=0x49eb8e0, AOFFSET=720) at regexpr/src/regexpr.pas:4116
0000007  0x00007fffffffcb55 in  ()
0000008  0x0000000004c89c98 in  ()
0000009  0x0000000000000000 in  ()

Cyrax

2020-01-19 08:32

reporter   ~0120534

You need to have 'Regular expression' option checked on the Find window.

Cyrax

2020-01-19 08:50

reporter   ~0120536

Call stack via debugging Lazarus with Lazarus (x86_64-linux):

#0 TREGEXPR__EXECPRIM(0x4830b28, 1, false, false) at regexpr/src/regexpr.pas:4176
0000001 ?? at :0
0000002 ?? at :0
0000003 VMT_$SYNEDITTEXTTABEXPANDER_$$_TSYNEDITSTRINGTABDATA$indirect at :0
0000004 ?? at :0
0000005 ?? at :0
0000006 TREGEXPR__EXECPOS(0x4830e00, 720) at regexpr/src/regexpr.pas:4116
0000007 ?? at :0
0000008 ?? at :0
0000009 ?? at :0

Cyrax

2020-01-19 09:45

reporter   ~0120538

Okay, looks like that FPC trunk compiler is the culprit. Namely inlining of subroutines and/or optimization (or both same time) is the cause of this bug to happen.

Michael Van Canneyt

2020-01-19 10:39

administrator   ~0120540

Disabled inline in regexpr, please check and close if OK.

Do-wan Kim

2020-01-20 04:57

reporter   ~0120567

Inputstring checking in 'execprim' makes problem.
36603-regexpr.pas.patch (413 bytes)   
Index: packages/regexpr/src/regexpr.pas
===================================================================
--- packages/regexpr/src/regexpr.pas	(revision 44002)
+++ packages/regexpr/src/regexpr.pas	(working copy)
@@ -4176,7 +4176,7 @@
   // Check InputString presence
   if fInputString = '' then
   begin
-    Error(reeNoInputStringSpecified);
+    //Error(reeNoInputStringSpecified);
     Exit;
   end;
 
36603-regexpr.pas.patch (413 bytes)   

Cyrax

2020-01-20 06:45

reporter   ~0120568

Well, it wasn't inline which caused this problem. My paths to compiled units were messed up which I have now sorted out.

Although disabling it allowed me to make a fix for this at Lazarus side. Unfortunately my patch is slightly a logical mess due to enclosing those lines at TSynEditSearch.FindNextOne (SearchRegExprInLine nested procedure) method which call TRegExpr.ExecPos method, in try..except blocks.

I would suggest that old behaviour where exception isn't raised when there is empty string to be evaluated, is restored or current behaviour is put behind an option flag which is disabled by default.

Andi Friess

2020-02-15 09:00

reporter   ~0121102

i have the issue on win32 and win64 too

CudaText man

2020-02-15 12:57

reporter   ~0121106

I made a patch to Sorokin's regex, it is the same issue as here. Copy my patch
https://github.com/andgineer/TRegExpr/issues/137

Michael Van Canneyt

2020-02-15 14:22

administrator   ~0121107

I added a boolean that disables the check by default, restoring the old behaviour. Please test and close if OK

@CudaText Man:
This kind of changes in behaviour were introduced by copying the upstream file.

And that is why I want to have clear and small patches to the FPC codebase, to be able to detect such changes in behaviour.
Referring to some upstream repository is asking for problems.

So next time you want changes in the FPC codebase, please submit patches made on FPC trunk.

Michael Van Canneyt

2020-02-15 14:23

administrator   ~0121108

Since the inline was not the cause of the bug, I moved the issue back to category "packages".

Issue History

Date Modified Username Field Change
2020-01-19 08:08 Cyrax New Issue
2020-01-19 08:10 Cyrax Note Added: 0120531
2020-01-19 08:14 Cyrax Note Added: 0120532
2020-01-19 08:25 Cyrax Note Added: 0120533
2020-01-19 08:32 Cyrax Note Added: 0120534
2020-01-19 08:50 Cyrax Note Added: 0120536
2020-01-19 09:45 Cyrax Note Added: 0120538
2020-01-19 10:38 Michael Van Canneyt Project Lazarus => FPC
2020-01-19 10:38 Michael Van Canneyt Category IDE => General
2020-01-19 10:39 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-01-19 10:39 Michael Van Canneyt Status new => resolved
2020-01-19 10:39 Michael Van Canneyt Resolution open => fixed
2020-01-19 10:39 Michael Van Canneyt Fixed in Version => 3.3.1
2020-01-19 10:39 Michael Van Canneyt Fixed in Revision => 43977
2020-01-19 10:39 Michael Van Canneyt FPCTarget => 3.2.0
2020-01-19 10:39 Michael Van Canneyt Note Added: 0120540
2020-01-19 10:40 Michael Van Canneyt Category General => Packages
2020-01-19 10:40 Michael Van Canneyt Product Version 2.1 (SVN) =>
2020-01-19 13:18 Jonas Maebe Assigned To Michael Van Canneyt =>
2020-01-19 13:18 Jonas Maebe Status resolved => new
2020-01-19 13:18 Jonas Maebe Resolution fixed => reopened
2020-01-19 13:18 Jonas Maebe Category Packages => Compiler
2020-01-20 04:57 Do-wan Kim File Added: 36603-regexpr.pas.patch
2020-01-20 04:57 Do-wan Kim Note Added: 0120567
2020-01-20 06:45 Cyrax Note Added: 0120568
2020-02-15 09:00 Andi Friess Note Added: 0121102
2020-02-15 12:57 CudaText man Note Added: 0121106
2020-02-15 14:22 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-02-15 14:22 Michael Van Canneyt Status new => resolved
2020-02-15 14:22 Michael Van Canneyt Resolution reopened => fixed
2020-02-15 14:22 Michael Van Canneyt Fixed in Revision 43977 => 44179
2020-02-15 14:22 Michael Van Canneyt Note Added: 0121107
2020-02-15 14:22 Michael Van Canneyt Category Compiler => Packages
2020-02-15 14:23 Michael Van Canneyt Note Added: 0121108
2020-03-01 04:32 Cyrax Status resolved => closed