Bug #5668
tvheadend dvr adds invalid utf-8 character in filename for recording where title contains/ends with: 'в)' symbol
0%
Description
Hello,
What was initially believed to be a bug with the iOS client for tvheadend, see https://github.com/zipleen/tvheadend-iphone-client/issues/246, turns out to be a tvheadend bug.
The issue:
When you create a recording from a title that contains/ends with 'в)' symbol, the filename attribute inside the dvr file contains an invalid utf-8 byte which prevents tvheadend from serving the recording (500 error) and causes the side defect of the iOS app as per the bug referenced earlier.
Reproducible: always
Steps to reproduce:
1.) Craft a specially designed unicode title into your EPG, import into EPG the below example file epg.xml(adjust the dates to match current or future time and your channel id)
2.) Configure your DVR profile like the attached dvr profile: dvr-profile.json
Files
History
Updated by Nikolay Kichukov over 5 years ago
The report submitted too early, continuing with steps to reproduce:
3.) Schedule a recording for the EPG entry from epg.xml
4.) Observe how TVHeadend creates a filename with invalid utf-8 character:
Jun 25 22:54:40 localhost tvheadend[25053]: subscription: 0001: "DVR: Осъдени души (110 години от рождението на Димитър Дим" subscribing on channel "BG Top Music", weight: 300, adapter: "IPTV", ... profile="matroska" Jun 25 22:54:40 localhost tvheadend[25053]: spawn: Executing "/usr/bin/ffmpeg" Jun 25 22:54:41 localhost tvheadend[25053]: dvr: /home/kodi/videos/recordings/BG-Top-Music-Осъдени-души-(110-години-от-рождението-на-Димитър-Димо�-2019-06-25_21-00.mkv from adapter: ...
5.) Look at the filename on the filesystem:
6.) Look at the dvr log file for it:
"files": [ { "filename": "/somewhere/BG-Top-Music-Осъдени-души-(110-години-от-рождението-на-Димитър-Димо�-2019-06-25_21-00.mkv", "info": [ {
7.) Try to play the recording over http and see the 500 error from tvheadend: 'error: HTTP/1.0 500 Internal Server Error'
HTTP/1.0 GET /dvrfile/380554f189c1a1a0b1923583a69e73cd -- 500
What has been attempted:
1.) Initially I believed the invalid byte/character came through the EPG, so I sanitized it to strip any invalid utf-8 sequences before uploading to tvheadend and yet the issue reappeared.
Updated by Nikolay Kichukov over 5 years ago
The recording can be played over the HTSP protocol fine.
Expected behaviour:
Do not replace 'в)' with invalid utf-8 in the filename attribute in the dvr recording.
System information:
GNU/Gentoo Linux, arm architecture with 5.1.9 kernel.
Any additional questions, let me know.
Thank you,
-Nik
Updated by Jaroslav Kysela over 5 years ago
From the config the title is limited to 99 bytes. The utf-8 validation check was added in 4.3 (utf8_validate_inplace() function).
Updated by Nikolay Kichukov over 5 years ago
Can you refer me to the commit that introduced this validation so I can try to backport to 4.2.8(source based distro here)?
Cheers,
-N
Updated by Jaroslav Kysela over 5 years ago
- Status changed from New to Fixed
Cherry-picked to v4.2.8-28-g74765a3fb : https://tvheadend.org/projects/tvheadend/repository/revisions/74765a3fb6b70731a29875bce35ea0e8d5f50b2e
Updated by Nikolay Kichukov over 5 years ago
Thanks. This indeed solves it.
Unrelated to this, I see a difference in one character in the log(this was like that before patching too):
tvheadend[19308]: subscription: 0001: "DVR: Осъдени души (110 години от рождението на Димитър Дим" subscribing on channel "BG Top Music", weight: 300,...profile="matroska" tvheadend[19308]: spawn: Executing "/usr/bin/ffmpeg" tvheadend[19308]: dvr: /somewhere/BG-Top-Music-Осъдени-души-(110-години-от-рождението-на-Димитър-Димо-2019-06-26_00-10.mkv from adapter: "IPTV", ...
On line 1, it ends with 'Дим' and in the filename on line 3 it truncates to 'Димо'.
This can be closed. I appreciate the quick response.
Cheers,
-N