Hello Guest, if you are reading this it means you have not registered yet. Please take a second, Click here to register, and in a few simple steps you will be able to enjoy our community and use our OpenViX support section.

View Entry Info: Crash creating Autotimer that only matches when description contains a certain string.

Category:
Possible Bug
What ViX Image build number are you using?
Please provide your ViX Team image build number. Menu > Information > About > Build number > ENTER THIS NUMBER e.g. 4.2.028
6.4.001.007 developer
Have you tried a flash WITHOUT settings restore?
Have you tried this? PLEASE SELECT YES OR NO.
No
Have you tried a flash WITH settings restore?
Have you tried this? PLEASE SELECT YES OR NO.
Yes
Attachments
Page 1 of 2 12 LastLast
Results 1 to 15 of 30

Thread: Crash creating Autotimer that only matches when description contains a certain string.

  1. #1

    Title
    Forum Supporter
    Donated Member
    Join Date
    Oct 2022
    Location
    Berkshire England. 51.4°N, 0.9°W
    Posts
    80
    Thanks
    107
    Thanked 24 Times in 17 Posts

    Post Crash creating Autotimer that only matches when description contains a certain string.

    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:
    Enigma2_crash_2023-06-07_00-22-37.log
    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 by BrianG61UK; 07-06-23 at 01:28.
    Zgemma H7S, Fixed 28.2°E dish, Freeview (Hannington). ABM Providers: [Sky UK; Thames Valley SD Custom; HD swap], [Freeview (UK); Berks and North Hants]

  2. #2
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,632
    Thanks
    2,007
    Thanked 4,956 Times in 3,276 Posts
    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.
    Help keep OpenViX servers online.Please donate!

  3. The Following User Says Thank You to Huevos For This Useful Post:

    BrianG61UK (08-06-23)

  4. #3

    Title
    Forum Supporter
    Donated Member
    Join Date
    Oct 2022
    Location
    Berkshire England. 51.4°N, 0.9°W
    Posts
    80
    Thanks
    107
    Thanked 24 Times in 17 Posts
    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.
    Zgemma H7S, Fixed 28.2°E dish, Freeview (Hannington). ABM Providers: [Sky UK; Thames Valley SD Custom; HD swap], [Freeview (UK); Berks and North Hants]

  5. #4
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,798
    Thanks
    237
    Thanked 1,659 Times in 1,307 Posts
    Quote Originally Posted by BrianG61UK View Post
    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.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  6. The Following User Says Thank You to birdman For This Useful Post:

    BrianG61UK (08-06-23)

  7. #5
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,798
    Thanks
    237
    Thanked 1,659 Times in 1,307 Posts
    Quote Originally Posted by birdman View Post
    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)!).
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  8. #6

    Title
    Forum Supporter
    Donated Member
    Join Date
    Oct 2022
    Location
    Berkshire England. 51.4°N, 0.9°W
    Posts
    80
    Thanks
    107
    Thanked 24 Times in 17 Posts
    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.
    Zgemma H7S, Fixed 28.2°E dish, Freeview (Hannington). ABM Providers: [Sky UK; Thames Valley SD Custom; HD swap], [Freeview (UK); Berks and North Hants]

  9. #7
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,632
    Thanks
    2,007
    Thanked 4,956 Times in 3,276 Posts
    Quote Originally Posted by birdman View Post
    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 = ([], [], [], [])
    Help keep OpenViX servers online.Please donate!

  10. #8
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,632
    Thanks
    2,007
    Thanked 4,956 Times in 3,276 Posts
    @Brian

    Can you print include?

    Code:
    	def setInclude(self, include):
    		print("DEBUG include", include)
    		if include:
    			self._include
    Help keep OpenViX servers online.Please donate!

  11. The Following User Says Thank You to Huevos For This Useful Post:

    BrianG61UK (08-06-23)

  12. #9

    Title
    Forum Supporter
    Donated Member
    Join Date
    Oct 2022
    Location
    Berkshire England. 51.4°N, 0.9°W
    Posts
    80
    Thanks
    107
    Thanked 24 Times in 17 Posts
    Zgemma H7S, Fixed 28.2°E dish, Freeview (Hannington). ABM Providers: [Sky UK; Thames Valley SD Custom; HD swap], [Freeview (UK); Berks and North Hants]

  13. #10
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,632
    Thanks
    2,007
    Thanked 4,956 Times in 3,276 Posts
    Quote Originally Posted by BrianG61UK View Post
    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?
    Help keep OpenViX servers online.Please donate!

  14. #11

    Title
    Forum Supporter
    Donated Member
    Join Date
    Oct 2022
    Location
    Berkshire England. 51.4°N, 0.9°W
    Posts
    80
    Thanks
    107
    Thanked 24 Times in 17 Posts
    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?
    Zgemma H7S, Fixed 28.2°E dish, Freeview (Hannington). ABM Providers: [Sky UK; Thames Valley SD Custom; HD swap], [Freeview (UK); Berks and North Hants]

  15. #12
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,798
    Thanks
    237
    Thanked 1,659 Times in 1,307 Posts
    Quote Originally Posted by Huevos View Post
    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 by birdman; 08-06-23 at 01:43.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  16. The Following User Says Thank You to birdman For This Useful Post:

    BrianG61UK (08-06-23)

  17. #13

    Title
    Forum Supporter
    Donated Member
    Join Date
    Oct 2022
    Location
    Berkshire England. 51.4°N, 0.9°W
    Posts
    80
    Thanks
    107
    Thanked 24 Times in 17 Posts
    Quote Originally Posted by Huevos View Post
    So, what is not working for you when you add the escape?
    Just realized, you're probably referring to:
    Quote Originally Posted by BrianG61UK View Post
    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.
    Zgemma H7S, Fixed 28.2°E dish, Freeview (Hannington). ABM Providers: [Sky UK; Thames Valley SD Custom; HD swap], [Freeview (UK); Berks and North Hants]

  18. #14
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,632
    Thanks
    2,007
    Thanked 4,956 Times in 3,276 Posts
    Quote Originally Posted by BrianG61UK View Post
    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.
    Help keep OpenViX servers online.Please donate!

  19. The Following User Says Thank You to Huevos For This Useful Post:

    BrianG61UK (08-06-23)

  20. #15
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,798
    Thanks
    237
    Thanked 1,659 Times in 1,307 Posts
    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 by birdman; 19-06-23 at 01:22.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.