isRegexMatch Fehler: "TRegExpr exec: empty input string"

Antworten
abruening
Beiträge: 15
Registriert: 06 Feb 2019, 15:34

isRegexMatch Fehler: "TRegExpr exec: empty input string"

Beitrag von abruening »

Moin,

einige meiner Pakete funktionieren seit kurzem nicht mehr, wenn ein leerer String an die Funktion isRegexMatch übergeben wird. Habe mir erst mal damit beholfen, vorher auf strlength zu prüfen. Im Netz konnte ich folgenden FreePascal-Bug dazu finden: https://bugs.freepascal.org/view.php?id=36603

Testfall:

Code: Alles auswählen

[Actions]
SetLogLevel=7

if isRegexMatch("", "^TestTest+$")
	Message "Match"
endif
Ausgabe:

Code: Alles auswählen

[1] [2020-09-28 17:09:24.052] [] --
[1] [2020-09-28 17:09:24.053] [] --
[1] [2020-09-28 17:09:24.054] [] c:\opsi.org\log\opsi-script-part-Ng78Nz51.log
[1] [2020-09-28 17:09:24.057] [] opsi-script 4.12.4.1 started at >>
[1] [2020-09-28 17:09:24.058] [] opsi-script log file with encoding utf8
[1] [2020-09-28 17:09:24.060] [] startmessage opsi-script created at CentralForm.FormCreate: 28.09.2020 17:09:15
[1] [2020-09-28 17:09:24.061] [] Loading skin from: C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winstskin
[1] [2020-09-28 17:09:24.063] [] startmessage StartProgramModes and create log: 28.09.2020 17:09:15
[1] [2020-09-28 17:09:24.064] [] pm: 2 28.09.2020 17:09:15
[1] [2020-09-28 17:09:24.067] [] Cleanup old part files at 28.09.2020 17:09:24
[6] [2020-09-28 17:09:24.069] [] Using new Depot path:  C:\opsi.org\cache\depot
[1] [2020-09-28 17:09:24.073] [] 
[1] [2020-09-28 17:09:24.074] [] ============ Version 4.12.4.1 script "C:\Users\ab\Desktop\case1.ins"
[1] [2020-09-28 17:09:24.077] []              used script encoding: cp1252
[1] [2020-09-28 17:09:24.079] []              used system encoding: cp1252
[1] [2020-09-28 17:09:24.081] []              start: 2020-09-28  17:09:24
[1] [2020-09-28 17:09:24.084] []              on client named    "STAGING-VM"
[1] [2020-09-28 17:09:24.087] []              loggedin user    "ab"
[1] [2020-09-28 17:09:24.090] []              opsi-script running as    "ab"
[1] [2020-09-28 17:09:24.094] []              opsi-script running with admin privileges
[1] [2020-09-28 17:09:24.097] []              opsi-script running in standard script mode
[1] [2020-09-28 17:09:24.100] [] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [2020-09-28 17:09:24.105] [] system infos:
[1] [2020-09-28 17:09:24.114] [] XX-XX-XX-XX-XX-XX  -  PC hardware address
[1] [2020-09-28 17:09:24.119] [] staging-vm.XXXXXX  -  IP name
[1] [2020-09-28 17:09:24.122] [] 10.100.30.200  -  IP address
[1] [2020-09-28 17:09:24.125] [] DEU  -  System default locale
[7] [2020-09-28 17:09:24.128] [] Registry started without redirection (64 Bit)
[7] [2020-09-28 17:09:24.131] [] Registry started readonly
[7] [2020-09-28 17:09:24.135] [] Registry started without redirection (64 Bit)
[6] [2020-09-28 17:09:24.139] [] Registry key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion]  opened
[6] [2020-09-28 17:09:24.142] [] Key closed
[1] [2020-09-28 17:09:24.145] [] MS Windows 10.0 64 Bit, Release: 1909, Edition: PRODUCT_PROFESSIONAL
[1] [2020-09-28 17:09:24.148] [] 
[7] [2020-09-28 17:09:24.152] [] Registry started readonly
[7] [2020-09-28 17:09:24.156] [] Registry started without redirection (64 Bit)
[6] [2020-09-28 17:09:24.160] [] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [2020-09-28 17:09:24.163] [] Key closed
[7] [2020-09-28 17:09:24.220] [] Starting with script...
[6] [2020-09-28 17:09:24.224] [] LogLevel was 7
[6] [2020-09-28 17:09:24.227] [] LogLevel set to 7
[6] [2020-09-28 17:09:24.230] [] If
[3] [2020-09-28 17:09:24.236] []   Exception in CreateAndProcessScript: Handling Aktionsliste: TRegExpr exec: empty input string
[1] [2020-09-28 17:09:24.246] [] ___________________
[1] [2020-09-28 17:09:24.250] [] script finished: failed
[1] [2020-09-28 17:09:24.253] [] 0 errors
[1] [2020-09-28 17:09:24.257] [] 0 warnings
[1] [2020-09-28 17:09:24.261] [] 
[1] [2020-09-28 17:09:24.264] [] 
Workaround:

Code: Alles auswählen

if strlength($MeinString$) INT> "0"
	if isRegexMatch($MeinString$, "^TestTest+$")
		Message "Match"
	endif
endif
Antworten