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 when folder contains filenames with Windows encoding

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.2.005
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.
No
Attachments
Page 9 of 10 FirstFirst ... 78910 LastLast
Results 121 to 135 of 138

Thread: Crash when folder contains filenames with Windows encoding

  1. #121

    Title
    Member
    Join Date
    Jun 2022
    Posts
    70
    Thanks
    1
    Thanked 33 Times in 19 Posts
    Crash happens in elistboxcontent.cpp, line 920
    Code:
    const char *string = (PyUnicode_Check(pstring)) ? PyUnicode_AsUTF8(pstring) : "<not-a-string>";
    "pstring" contains escaped characters and PyUnicode_AsUTF8(pstring) fails. Changed it to this bellow and it doesn't crash anymore. (Note: there are atleast 5 similar checks in this file, possibly they all should be fixed same way)

    Code:
    const char *string = (PyUnicode_Check(pstring)) ? PyBytes_AsString(PyUnicode_AsEncodedString(pstring, "utf-8", "surrogateescape")) : "<not-a-string>";
    But that only fixes the crash. GUI expects UTF-8. Movielist change "decode(encoding)" is still needed to display latin-1 characters correctly.

  2. #122
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,681
    Thanks
    2,013
    Thanked 4,966 Times in 3,282 Posts
    How do you trigger this crash?

    Are the current changes in enigma repo of service.cpp working for you?
    Help keep OpenViX servers online.Please donate!

  3. #123
    twol's Avatar
    Title
    Moderator
    Join Date
    Apr 2012
    Posts
    8,438
    Thanks
    997
    Thanked 2,903 Times in 2,255 Posts
    Quote Originally Posted by ocean View Post
    Crash happens in elistboxcontent.cpp, line 920
    Code:
    const char *string = (PyUnicode_Check(pstring)) ? PyUnicode_AsUTF8(pstring) : "<not-a-string>";
    "pstring" contains escaped characters and PyUnicode_AsUTF8(pstring) fails. Changed it to this bellow and it doesn't crash anymore. (Note: there are atleast 5 similar checks in this file, possibly they all should be fixed same way)

    Code:
    const char *string = (PyUnicode_Check(pstring)) ? PyBytes_AsString(PyUnicode_AsEncodedString(pstring, "utf-8", "surrogateescape")) : "<not-a-string>";
    But that only fixes the crash. GUI expects UTF-8. Movielist change "decode(encoding)" is still needed to display latin-1 characters correctly.
    Is this crash still from movielist or another location?
    if another issue how did you get there
    Gigablue Quad 4K & UE 4K
    .........FBC Tuners:
    ------------------> GT-Sat unicable LNB to 1.5M dish(28.2E)
    ------------------> Gigablue unicable LNB to 80 cm dish(19.2E)
    .......................> FBC & DVB-S2X into 90cm dish (27.5W) Opticum robust Unicable LNB
    AX HD61, Edision Osmio 4K+, Zgemma H9Combo, Octagon SF8008 , gbtrio4k, h9se using unicable ports
    Zgemma H9 C/S into Giga4K

  4. #124

    Title
    Member
    Join Date
    Jun 2022
    Posts
    70
    Thanks
    1
    Thanked 33 Times in 19 Posts
    Quote Originally Posted by Huevos View Post
    How do you trigger this crash?
    That is the original crash without any changes to movielist. (You asked to test with old movielist)
    Quote Originally Posted by Huevos View Post
    Are the current changes in enigma repo of service.cpp working for you?
    Yes, service.cpp changes are working fine.

  5. #125
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,681
    Thanks
    2,013
    Thanked 4,966 Times in 3,282 Posts
    @ocean, what are you using to FTP the file to the STB?

    Is it possible that FTP is interfering with the filename. Windows is supposed to save filenames as UTF16.
    Help keep OpenViX servers online.Please donate!

  6. #126

    Title
    Member
    Join Date
    Jun 2022
    Posts
    70
    Thanks
    1
    Thanked 33 Times in 19 Posts
    Quote Originally Posted by Huevos View Post
    Is it possible that FTP is interfering with the filename. Windows is supposed to save filenames as UTF16.
    No, it's not only FTP issue. If files are saved to USB drive in Windows. When you plug that USB drive to box, it has same issues.

    But with current changes in repo it's already working. Just include latest movielist changes I posted earlier, then it doesn't affect anything in movieselection.py

  7. #127
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,823
    Thanks
    237
    Thanked 1,661 Times in 1,308 Posts
    Quote Originally Posted by ocean View Post
    But that only fixes the crash. GUI expects UTF-8. Movielist change "decode(encoding)" is still needed to display latin-1 characters correctly.
    Linux filenames have no concept of Latin-1 (or of iso8859-1, Windows-1252, utf8 etc.) They are just an array of bytes.
    The filename has to be kept (and passed around) as bytes while any display has to use a utf8 representation of this.
    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. #128
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,681
    Thanks
    2,013
    Thanked 4,966 Times in 3,282 Posts
    Quote Originally Posted by birdman View Post
    Linux filenames have no concept of Latin-1 (or of iso8859-1, Windows-1252, utf8 etc.) They are just an array of bytes.
    The filename has to be kept (and passed around) as bytes while any display has to use a utf8 representation of this.
    Gordon, we are talking about GUI display. We have to feed something to the GUI that it understands.
    Help keep OpenViX servers online.Please donate!

  9. #129
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,823
    Thanks
    237
    Thanked 1,661 Times in 1,308 Posts
    Quote Originally Posted by Huevos View Post
    Gordon, we are talking about GUI display. We have to feed something to the GUI that it understands.
    Yes. But you also need to retain the original name in bytes in order to pass it to the filesystem.
    If you start with a filename you should only ever need to decode it (in some lossless way) to produce a display value.
    If you start with a display string (such as setting up a timer/Autotimer) then you only ever need to encode it to get a filename.

    So if you ever find yourself encoding and decoding the same value then something has gone wrong in the logic.
    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

  10. #130
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,681
    Thanks
    2,013
    Thanked 4,966 Times in 3,282 Posts
    The current code works so far but open to any improvements you suggest.
    Help keep OpenViX servers online.Please donate!

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

    abu baniaz (07-09-22)

  12. #131

    Title
    Member
    Join Date
    Jun 2022
    Posts
    70
    Thanks
    1
    Thanked 33 Times in 19 Posts
    @Huevos Could you still add some fix for RedirectOutput.py? There are debug prints, one in navigation.py, line 110, print("[Navigation] playing ref", ref and ref.toString())

    If you don't like try/except, maybe change this:
    Code:
    		if isinstance(data, bytes):
    			data = data.decode(encoding="UTF-8", errors="ignore")
    To this in RedirectOutput.py?

    Code:
    		if isinstance(data, bytes):
    			data = data.decode(encoding="UTF-8", errors="ignore")
    		else:
    			data = data.encode("UTF-8", "ignore").decode()
    Everything else seems working for me.

  13. #132
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,681
    Thanks
    2,013
    Thanked 4,966 Times in 3,282 Posts
    Quote Originally Posted by ocean View Post
    @Huevos Could you still add some fix for RedirectOutput.py? There are debug prints, one in navigation.py, line 110, print("[Navigation] playing ref", ref and ref.toString())

    If you don't like try/except, maybe change this:
    Code:
    		if isinstance(data, bytes):
    			data = data.decode(encoding="UTF-8", errors="ignore")
    To this in RedirectOutput.py?

    Code:
    		if isinstance(data, bytes):
    			data = data.decode(encoding="UTF-8", errors="ignore")
    		else:
    			data = data.encode("UTF-8", "ignore").decode()
    Everything else seems working for me.
    That crash was caused by something nasty in RecordTimer.py...
    Code:
    < 4037.8571> 17:38:38.4681 Traceback (most recent call last):
    < 4037.8572> 17:38:38.4681 File "/usr/lib/enigma2/python/StartEnigma.py", line 224, in processDelay
    < 4037.8581> 17:38:38.4690 callback(*retval)
    < 4037.8581> 17:38:38.4691 File "/usr/lib/enigma2/python/Screens/InfoBarGenerics.py", line 3333, in recordQuestionCallback
    < 4037.8585> 17:38:38.4694 File "/usr/lib/enigma2/python/Screens/InfoBarGenerics.py", line 3253, in startInstantRecording
    < 4037.8588> 17:38:38.4697 File "/usr/lib/enigma2/python/RecordTimer.py", line 1275, in record
    < 4037.8591> 17:38:38.4701 File "/usr/lib/enigma2/python/timer.py", line 229, in addTimerEntry
    < 4037.8594> 17:38:38.4704 File "/usr/lib/enigma2/python/timer.py", line 268, in calcNextActivation
    < 4037.8597> 17:38:38.4706 File "/usr/lib/enigma2/python/timer.py", line 363, in processActivation
    < 4037.8601> 17:38:38.4710 File "/usr/lib/enigma2/python/RecordTimer.py", line 1009, in doActivate
    < 4037.8607> 17:38:38.4717 File "/usr/lib/enigma2/python/RecordTimer.py", line 676, in activate
    < 4037.8611> 17:38:38.4720 File "/usr/lib/enigma2/python/RecordTimer.py", line 485, in log_tuner
    < 4037.8614> 17:38:38.4723 File "/usr/lib/enigma2/python/RecordTimer.py", line 284, in log
    < 4037.8617> 17:38:38.4726 File "/usr/lib/enigma2/python/Tools/RedirectOutput.py", line 16, in write
    < 4037.8620> 17:38:38.4729 TypeError: in method 'ePythonOutput', argument 1 of type 'char const *
    What exactly is that bad output?
    Help keep OpenViX servers online.Please donate!

  14. #133
    Huevos's Avatar
    Title
    Administrator
    Join Date
    Jun 2010
    Location
    38.5N, 0.5W
    Posts
    13,681
    Thanks
    2,013
    Thanked 4,966 Times in 3,282 Posts
    Python:
    Code:
    ePythonOutput(self.line, self.level)
    C++:
    Code:
    void ePythonOutput(const char *, int lvl = lvlDebug);
    const char * ... shouldn't we be feeding that bytes?
    Help keep OpenViX servers online.Please donate!

  15. #134
    twol's Avatar
    Title
    Moderator
    Join Date
    Apr 2012
    Posts
    8,438
    Thanks
    997
    Thanked 2,903 Times in 2,255 Posts
    Quote Originally Posted by Huevos View Post
    Python:
    Code:
    ePythonOutput(self.line, self.level)
    C++:
    Code:
    void ePythonOutput(const char *, int lvl = lvlDebug);
    const char * ... shouldn't we be feeding that bytes?
    Thats in eerror.h but its also in eerror.cpp
    Code:
     void ePythonOutput(const char *string, int lvl)
    Which confuses me - why in both
    Gigablue Quad 4K & UE 4K
    .........FBC Tuners:
    ------------------> GT-Sat unicable LNB to 1.5M dish(28.2E)
    ------------------> Gigablue unicable LNB to 80 cm dish(19.2E)
    .......................> FBC & DVB-S2X into 90cm dish (27.5W) Opticum robust Unicable LNB
    AX HD61, Edision Osmio 4K+, Zgemma H9Combo, Octagon SF8008 , gbtrio4k, h9se using unicable ports
    Zgemma H9 C/S into Giga4K

  16. #135

    Title
    Member
    Join Date
    Jun 2022
    Posts
    70
    Thanks
    1
    Thanked 33 Times in 19 Posts
    Quote Originally Posted by Huevos View Post
    ... shouldn't we be feeding that bytes?
    It's possible to change that to take bytes. But do you want log files to be other than UTF-8? In receiver menu there is option to view log, it most likely crashes if log is not UTF-8

Page 9 of 10 FirstFirst ... 78910 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.