Superb quality and spec AB-Com PULSe 4K SE. Crazy offer! Only £99! FREE UK DELIVERY! 4K UHD, Enigma 2, Multiboot 4 images & more!...
Superb quality and spec AB-Com PULSe 4K Rev II Twin Satellite tuner only £149! FREE UK DELIVERY! 4K UHD, Enigma 2, SATA HDD facility, Multiboot 4 images & more!...

[Zgemma H7] Crash creating Autotimer that only matches when description contains a certain string.

BrianG61UK

Forum Supporter
Donated Member
Joined
Oct 1, 2022
Messages
122
Reaction score
2
Points
18
Location
Berkshire England. 51.4°N, 0.9°W
Website
www.brian-gregory.me.uk
I think what's happening is that the string entered is supposed to be a regular expression.
However, I wanted to match "(S5" which is an invalid regular expression.
It seems to accept it if I input "\(S5" instead so that too points to a regular expression being required here.

Crash logs:
View attachment Enigma2_crash_2023-06-07_00-22-37.log
View attachment Enigma2_crash_2023-06-07_00-44-14.log

Allowing a regular expression for this feature is a great idea, however I think ideally an invalid regular expression should not cause a crash. But I'm not sure how I would want it dealt with.

Later: Yes, I now realize "\(S5" won't do what I want.
 
Last edited:
Please explain post an example of the string you are trying to match and the contents of the description field.

And I agree that bad user input should not bring the house down.
 
The program in question has a description field something like this:

Blah blah blah blah ... blah blah (S1 E7/22).

Where the part at the end indicates, in this case, season 1, episode 7 out of 22.

I was hoping to just record the most recent season 5 if it gets shown again at some point. They seem to be working through from the beginning again at the moment.

I've now put this in the string to match "\(S[5-9]" (without the quotes) which I think will match season 5 through season 9 to catch season 5 and some possible new seasons they might make in the future.
 
Allowing a regular expression for this feature is a great idea,
I suspect it isn't - particularly if there is no indication that a regular expression is what is expected.

I'm not aware of regular expressions ever being used (but will have a look).

You can use filters to further trim the original matches.
 
I'm not aware of regular expressions ever being used (but will have a look).
No sign of regexes being used.
The code does a search of the EPGcache, and all it does is use strncasecmp() or memcmp().

(There is some poor coding there though, as having set up an enum for the types of a query you then have things like if (querytype == 1)!).
 
Okay. I was beginning to realize that regular expressions are too complicated for most users anyway.

Then I think the crash is caused by something in

Code:
https://github.com/oe-alliance/enigma2-plugins/blob/master/autotimer/src/AutoTimerComponent.py

that's trying to use regular expressions (on line 149) for unknown reasons.

-

Has anyone been able to reproduce this crash?
If not, maybe I messed up something in my build.
 
No sign of regexes being used.
The code does a search of the EPGcache, and all it does is use strncasecmp() or memcmp().

(There is some poor coding there though, as having set up an enum for the types of a query you then have things like if (querytype == 1)!).

Yes, regular expressions are used and there is no fail safe if the user enters junk.

Code:
	def setInclude(self, include):
		if include:
			self._include = (
				[re_compile(x) for x in include[0]],
				[re_compile(x) for x in include[1]],
				[re_compile(x) for x in include[2]],
				include[3]
			)
		else:
			self._include = ([], [], [], [])
 
@Brian

Can you print include?

Code:
	def setInclude(self, include):
		print("DEBUG include", include)
		if include:
			self._include
 

Code:
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from re import compile as re_compile
>>>
>>> str = "Blah blah blah blah ... blah blah (S1 E7/22)."
>>>
>>> include = ([], [], ['\(S[5-9]'], [])
>>>
>>> out = ([], [], [re_compile(x) for x in include[2]], [])
>>>
>>> for include in out[2]:
...     if include.search(str):
...         print("Found")
...     else:
...         print("Not found")
...
Not found
>>>
>>>
>>> str = "Blah blah blah blah ... blah blah (S6 E7/22)."
>>>
>>> include = ([], [], ['\(S[5-9]'], [])
>>>
>>> out = ([], [], [re_compile(x) for x in include[2]], [])
>>>
>>> for include in out[2]:
...     if include.search(str):
...         print("Found")
...     else:
...         print("Not found")
...
...
Found
>>>
So, what is not working for you when you add the escape?
 
I don't know if it works or not with a valid regular expression (with the bracket escaped).
I was initially concentrating on reporting the crash, which seems to occur when the string isn't a valid regular expression.

If you look at the crash in either log you see:

DEBUG include ([], [], ['(S[5-9]'], [])

Just before the crash, with an unescaped '('.

Is there something you don't understand about what I'm reporting?
Does it seem to work fine for you, and you can't reproduce it on an official OpenViX image?
 
Yes, regular expressions are used and there is no fail safe if the user enters junk.
Ah, sorry. I missed those. Seems to have been there for 15 years. I was playing around in this area a few years back and don't recall noticing that regexes were in use.

So two bugs here.

  • The code needs to do something (and not crash) if the regex is invalid (Needs to be done at setting time*).
  • The user needs to be told this is a regex

* possibly in editFilterCallback() (in AutoTimerEditor.py)
 
Last edited:
So, what is not working for you when you add the escape?

Just realized, you're probably referring to:
Later: Yes, I now realize "\(S5" won't do what I want.

I was thinking the 5 means repeat 5 times. But I don't think it does, and it would probably work.
 
Just realized, you're probably referring to:


I was thinking the 5 means repeat 5 times. But I don't think it does, and it would probably work.

5x of the "S" would be:
Code:
"\(S{5}

But, yes, I already agreed this should not crash. There should be a test of the values on save.
 
And, in one of those oddities that seems to occur so often (although it's just that of it didn't you wouldn't notice anything...) I've now had reason to use this.

the cricket highlights are being sent out as "Today at the Test" (day 1) and "Today at the Ashes" (days 2 to 5).

So I'm matching "Today at the" then want to include if Test or Ashes is there. But includes must all be present for a match (excludes fail instantly on a match). So the solution is to have once include that is "Test|Ashes".

Which may be why it it a regex.

PS: I think a fix is still required?

EDIT: So I'll have a look and make one up....
 
Last edited:
I've got the test in place, but am having issues trying to get a MessageBox up about any error (as I'm in a ConfigXXX routine at the time).

Even when this is in place I'll need to look at how OpenWebIF sets new ATs as well.
 
I've now got any errors being reported.

However, there are two files changed.
  • config.py (in enimga2)
  • AutoTimerEditor.py (in enigma2-plugins)

Is that enigma2-plugins git only for Vix? If not, I'll have to modify AutoTimerEditor.py to revert to the old behaviour if the addition to config.py isn't available.
 
What edition to config.py? We are not going to hack that for a broken plugin.

enigma-plugins is an open repo for everyone.
 
What edition to config.py? We are not going to hack that for a broken plugin.
It adds a ConfigRegex entry, which is a ConfigText object but with a check that it is a valid regex in setValue().

I could try adding it all in AutoTimerEditor.py. My first attempt failed, but I seem to recall having similar issues in EPGTranslator, so could look at what I did there.

The plugin is only "broken" to the extent that it contains a bug. Fixing bugs is surely what we should be doing?
 
So what produces the warning, config,py or the plugin?
 

OpenViX Feeds Status

Back
Top