Jump to content


Photo

Menu: createMenuList assertation fails


  • Please log in to reply
10 replies to this topic

#1 athoik

  • PLi® Core member
  • 7,399 posts

+261
Excellent

Posted 17 March 2018 - 13:15

Hi,

When I am building enigma2 on Ubuntu (trusty) and trying to display menu (using spacebar) it crashes because of an assertion error.
 
crashdate=Sat Mar 17 12:14:39 2018
compiledate=Mar 17 2018
skin=skin.xml
sourcedate=2018-03-10
branch=develop
rev=59459e2
component=Enigma2

kernelcmdline=BOOT_IMAGE=/boot/vmlinuz-4.4.0-112-generic root=UUID=c21559dd-2ca1-4b52-af0d-eb13c8f3ca60 ro vga=792
imageissue=Ubuntu 14.04.5 LTS


Traceback (most recent call last):
  File "/usr/local/lib/enigma2/python/Components/ActionMap.py", line 46, in action
    res = self.actions[action]()
  File "/usr/local/lib/enigma2/python/Screens/InfoBarGenerics.py", line 876, in mainMenu
    self.session.openWithCallback(self.mainMenuClosed, MainMenu, menu)
  File "/usr/local/lib/enigma2/python/mytest.py", line 287, in openWithCallback
    dlg = self.open(screen, *arguments, **kwargs)
  File "/usr/local/lib/enigma2/python/mytest.py", line 297, in open
    dlg = self.current_dialog = self.instantiateDialog(screen, *arguments, **kwargs)
  File "/usr/local/lib/enigma2/python/mytest.py", line 240, in instantiateDialog
    return self.doInstantiateDialog(screen, arguments, kwargs, self.desktop)
  File "/usr/local/lib/enigma2/python/mytest.py", line 257, in doInstantiateDialog
    dlg = screen(self, *arguments, **kwargs)
  File "/usr/local/lib/enigma2/python/Screens/Menu.py", line 451, in __init__
    Menu.__init__(self, *x)
  File "/usr/local/lib/enigma2/python/Screens/Menu.py", line 168, in __init__
    self.createMenuList()
  File "/usr/local/lib/enigma2/python/Screens/Menu.py", line 283, in createMenuList
    self["menu"].updateList(self.list)
  File "/usr/local/lib/enigma2/python/Components/Sources/List.py", line 102, in updateList
    assert len(list) == len(self.__list)
AssertionError
So on Screens/Menu.py init we are starting with an empty list and then call createMenuList.
 
                self["menu"] = List([])
                self["menu"].enableWrapAround = True
                self.createMenuList()

But on Sources/List.py we accept lists with the same lenghts!
 
        def updateList(self, list):
                """Changes the list without changing the selection or emitting changed Events"""
                assert len(list) == len(self.__list)
Of course when assert is comment out, menu is displayed without issues.

But, why we are not getting this problem on our boxes?

Since menu starts with [] and createMenuList adds the real menu elements, assert should always fail the first time!

Obviously it works on enigma2 receivers, but how? What adds values to __list between List([]) and self.createMenuList()?

Edited by athoik, 17 March 2018 - 13:16.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Menu: createMenuList assertation fails #2 athoik

  • PLi® Core member
  • 7,399 posts

+261
Excellent

Posted 20 March 2018 - 20:41

Since nobody bothers...

@box# cat test.py
assert 2 + 2 == 5, "Houston we've got a problem"

@box# python test.py
no problem?

@box# python -N test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    assert 2 + 2 == 5, "Houston we've got a problem"
AssertionError: Houston we've got a problem
@ubuntu-trusty:~# cat test.py
assert 2 + 2 == 5, "Houston we've got a problem"
print "no problem?"

@ubuntu-trusty:~# python test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    assert 2 + 2 == 5, "Houston we've got a problem"
AssertionError: Houston we've got a problem

@ubuntu-trusty:~# python -O test.py
no problem?

Next action, delete all assert from e2, it's dead code... since we are always running by default with python optimize.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Menu: createMenuList assertation fails #3 WanWizard

  • Forum Moderator
    PLi® Core member
  • 41,562 posts

+662
Excellent

Posted 20 March 2018 - 21:35

I would have liked to bother, but unfortunately it's still beyond my knowledge at the moment...


Many answers to your question can be found in our new and improved wiki.

Currently in active use: VU+Solo 4K (1xFBC, 2xS2), VU+Zero, Edision OS mini+, Amiko Viper 2TC, Zgemma H3.2TC, Zgemma H6

For testing purposes: XP1000, Formuler F1 (2xS2), Miraclebox Premium Micro (S2+C/T), ET7500 (S2), ET8500 (S2), Zgemma H2.H (S2+C), Zgemma H5.2TC, SAB TripleAlpha (S2+C/T), Galaxy 4K (FBC), VU Zero 4K, HD2400 (4xS2), ET10000 (4xS2), VU+Duo2 (1xS2), Edision OS nino


Re: Menu: createMenuList assertation fails #4 Erik Slagter

  • PLi® Core member
  • 43,349 posts

+469
Excellent

Posted 22 March 2018 - 12:29

I would have liked to bother, but unfortunately it's still beyond my knowledge at the moment...

That ;)

 

I guess the assertion code is in to be able to help debugging, but then the debugging person would need to create a version without optimisation for himself. I guess that doesn't happen very often.

 

OTOH if the optimisation feature eliminates the code, I don't think it will hurt immediately to leave it in.


* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: Menu: createMenuList assertation fails #5 athoik

  • PLi® Core member
  • 7,399 posts

+261
Excellent

Posted 27 March 2018 - 16:29

But assertation seems wrong..

Somebody created a bug that nobody notice till now (actually people running e2pc notice it...), because assert never runs.

Is somebody more familiar able to fix bug pointed by assert?

I can replace assert with exception, then you will understand what I am saying ;)
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Menu: createMenuList assertation fails #6 Erik Slagter

  • PLi® Core member
  • 43,349 posts

+469
Excellent

Posted 27 March 2018 - 17:50

I understood from your story that the assertion is active and triggered when the code is not optimised, but it's elimited when the code is optimised. Did I understand that incorrectly?

 

I am a Python n00b you know ;)


Edited by Erik Slagter, 27 March 2018 - 17:51.

* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: Menu: createMenuList assertation fails #7 athoik

  • PLi® Core member
  • 7,399 posts

+261
Excellent

Posted 27 March 2018 - 18:01

Yes that's right.

But when running in non optimized code, menu crashes, because assert fails.

So either assert is wrong either bug is not visible due to assert not executed.

(So changing to exception I will force somebody to remove exception or fix the code ...)

Edited by athoik, 27 March 2018 - 18:02.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Menu: createMenuList assertation fails #8 Erik Slagter

  • PLi® Core member
  • 43,349 posts

+469
Excellent

Posted 27 March 2018 - 19:09

That last one seems to be the proper approach ;)


* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: Menu: createMenuList assertation fails #9 mrvica

  • Senior Member
  • 582 posts

+33
Good

Posted 27 March 2018 - 19:11

I tried once E2 for Raspi, I can remember that with an external USB keyboard I was able to get menu with pressing the spacebar without crash, means something goes wrong on E2PC, this patch could be usefull for E2PC too, you can get menu with pressing
CTRL_SHIFT_ALT_KEY_HOME=KEY_MENU
https://github.com/P...3baee13e65e302a

well. I didn´t see it, the patch already comes from enigma2pc

Edited by mrvica, 27 March 2018 - 19:13.


Re: Menu: createMenuList assertation fails #10 Pr2

  • PLi® Contributor
  • 2,832 posts

+119
Excellent

Posted 27 March 2018 - 19:18

Hi,

 

From what I read: assert are used to test exception that should never happens, so they are used in debug phase and so they are simply suppressed when you use the -O (optimised option). So that can explain the difference that you report here.

 

Use raise if you want the test to be kept when compile with -O option.

 

Pr2


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.

If you think that my answer helps you, you can press the up arrow in bottom right the answer.

 

Octagon SF-4008: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W (+DVB-C)
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C)
Zgemma H5: 1*DVB-S2 + 1*DVB-C

Zgemma H7C: 1*DVB-S2 + 2*DVB-C


Re: Menu: createMenuList assertation fails #11 Erik Slagter

  • PLi® Core member
  • 43,349 posts

+469
Excellent

Posted 28 March 2018 - 16:20

In a C/C++, compiled environment the concept of assert is that it checks either things that can be checked during compilation or things that can be checked during runtime but are preferred not be checked during production builds, for instance because the check adds quite a bit of code that makes the program run slow or it may reveal internal knowledge that's not meant to leave the factory.

 

In case of Python, it's a bit different, because Python doesn't really get compiled, not in the way like C/C++ does.

 

In any way I am not too keen on using it. Either use a check that is low on resources and raise a neat, user friendly error message or, if possible, prove such a condition can never happen and remove the check completely.


* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users