xbmc / vfs.rar

RAR VFS addon for Kodi
GNU General Public License v2.0
37 stars 23 forks source link

I don't know if its vfs.rar but it seems like long folder and file names cause crashes #68

Open kraaa opened 4 years ago

kraaa commented 4 years ago

example while scanning this file it crashes: 2020-03-18 03:04:18.328 T:9388 DEBUG: VideoInfoScanner: Found episode match rar://rar%3a%2f%2fG%253a%255crar3%255ctv%255cThe%2520Americans%25202013%255cSeason%25201%255cThe.Americans.2013.S01E02.720p.BluRay.x264-Counterfeit%255cThe.Americans.2013.S01E02.SUBFIX.720p.BluRay.x264-Counterfeit%255cthe.americans.2013.s01e02.720p.bluray.x264-counterfeit.subfix.rar%2fthe.americans.2013.s01e02.720p.bluray.x264-counterfeit.rar/the.americans.2013.s01e02.720p.bluray.x264-counterfeit.sub (s1e2) [S(\d{1,3})E(\d{1,3})(?:[^\/]*$)]

AlwinEsch commented 4 years ago

I will soon see what happens with it and fix it, I hadn't tested that long path yet.

Thanks for report.

kraaa commented 4 years ago

Another example: 2020-03-20 16:10:31.855 T:6188 DEBUG: AddOnLog: RAR archive support: CRARControl::ArchiveList: List file from G:\rar3\tv\Better Call Saul\Season 1\Better.Call.Saul.S01E01.720p.BluRay.X264-REWARD\Subs\better.call.saul.s01e01.720p.bluray.x264-reward.subs.rar: better.call.saul.s01e01.720p.bluray.x264-reward.idx (encrypted: no)

2020-03-20 16:10:31.855 T:6188 DEBUG: AddOnLog: RAR archive support: CRARControl::ArchiveList: List file from G:\rar3\tv\Better Call Saul\Season 1\Better.Call.Saul.S01E01.720p.BluRay.X264-REWARD\Subs\better.call.saul.s01e01.720p.bluray.x264-reward.subs.rar: better.call.saul.s01e01.720p.bluray.x264-reward.rar (encrypted: no)

Seems it's always the subtitles that causes issues. Thanks for your hard work :)

amazingdash commented 4 years ago

I have noticed the same problem with the new 2.2.2 version. I think it is caused by rars inside rars. In @kraaa's example, the rar contains a rar which contains a .sub file. It is when scanning that sub that Kodi crashes. When the .sub file is only compressed once, the .sub file is not even visible when browsing it.

An easy way to trigger the crash: browse the subtitles rar, then attempting to add the sub file to the library. The backtrace looks like that:

#0  0x00007ffff4f25257 in __vfscanf_internal () at /lib64/libc.so.6                                                                           
#1  0x00007ffff4f24b46 in __isoc99_sscanf () at /lib64/libc.so.6                                                                              
#2  0x0000555556508f79 in CURL::Decode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()             
#3  0x000055555650b820 in CURL::Parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()              
#4  0x000055555615f428 in URIUtils::IsInRAR(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()        
#5  0x0000555555f78d94 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#6  0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#7  0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#8  0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#9  0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#10 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#11 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#12 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#13 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#14 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#15 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#16 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#17 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#18 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#19 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#20 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#21 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#22 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#23 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#24 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#25 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#26 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#27 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#28 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#29 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#30 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#31 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#32 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#33 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#34 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#35 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#36 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
#37 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                             
...
#4244 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4245 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4246 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4247 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4248 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4249 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4250 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4251 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4252 0x0000555555f79046 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()                                           
#4253 0x0000555555f79ac5 in CVideoTagLoaderNFO::CVideoTagLoaderNFO(CFileItem const&, std::shared_ptr<ADDON::CScraper>, bool) ()               
#4254 0x0000555555f742a1 in VIDEO::CVideoInfoTagLoaderFactory::CreateLoader(CFileItem const&, std::shared_ptr<ADDON::CScraper>, bool, bool) ()
#4255 0x0000555555f80482 in CVideoLibraryRefreshingJob::Work(CVideoDatabase&) ()                                                              
#4256 0x0000555555f7dfb3 in CVideoLibraryJob::DoWork() ()                                                                                     
#4257 0x0000555555f7ef53 in CVideoLibraryProgressJob::DoWork() ()                                                                             
#4258 0x000055555612a3c4 in CProgressJob::DoModal() ()                                                                                        
#4259 0x000055555606c2ed in CVideoLibraryQueue::RefreshItemModal(std::shared_ptr<CFileItem>, bool, bool) ()                                   
#4260 0x0000555555f5ddbc in CGUIWindowVideoBase::ShowIMDB(std::shared_ptr<CFileItem>, std::shared_ptr<ADDON::CScraper> const&, bool) ()       
#4261 0x0000555555f5fe63 in CGUIWindowVideoBase::OnItemInfo(CFileItem const&, std::shared_ptr<ADDON::CScraper>&) ()                           
#4262 0x0000555555f6afb6 in CGUIWindowVideoNav::OnItemInfo(CFileItem const&, std::shared_ptr<ADDON::CScraper>&) ()                            
#4263 0x0000555555f9b1c8 in CGUIDialogVideoInfo::ShowFor(CFileItem const&) ()                                                                 
#4264 0x0000555555f6cae7 in CGUIWindowVideoNav::OnContextButton(int, CONTEXT_BUTTON) ()                                                       
#4265 0x00005555560788a3 in CGUIMediaWindow::OnPopupMenu(int) ()                                                                              
#4266 0x000055555607e9c6 in CGUIMediaWindow::OnMessage(CGUIMessage&) ()                                                                       
#4267 0x0000555555f64a52 in CGUIWindowVideoBase::OnMessage(CGUIMessage&) ()                                                                   
#4268 0x0000555555f672e3 in CGUIWindowVideoNav::OnMessage(CGUIMessage&) ()                                                                    
#4269 0x000055555623bdd1 in CGUIBaseContainer::OnClick(int) ()                                                                                
#4270 0x00005555562b2d85 in CGUIWindow::OnAction(CAction const&) ()                                                                           
#4271 0x00005555560799d5 in CGUIMediaWindow::OnAction(CAction const&) ()                                                                      
#4272 0x0000555555f5da1c in CGUIWindowVideoBase::OnAction(CAction const&) ()                                                                  
#4273 0x0000555555f67144 in CGUIWindowVideoNav::OnAction(CAction const&) ()                                                                   
#4274 0x00005555562baf4a in CGUIWindowManager::HandleAction(CAction const&) const ()                                                          
#4275 0x00005555562bd8e3 in CGUIWindowManager::OnAction(CAction const&) const ()                                                              
#4276 0x0000555556482358 in CApplication::OnAction(CAction const&) ()                                                                         
#4277 0x00005555561fea25 in CInputManager::HandleKey(CKey const&) ()                                                                          
#4278 0x0000555556200859 in CInputManager::OnKeyUp(CKey const&) ()                                                                            
#4279 0x0000555556200b69 in CInputManager::OnEvent(XBMC_Event&) ()                                                                            
#4280 0x0000555556483872 in CApplication::HandlePortEvents() ()                                                                               
#4281 0x0000555556483ad2 in CApplication::FrameMove(bool, bool) ()                                                                            
#4282 0x000055555651be6a in CXBApplicationEx::Run(CAppParamParser const&) ()                                                                  
#4283 0x00005555561afddd in XBMC_Run ()                                                                                                       
#4284 0x0000555555c23831 in main ()                                                                                                           

This makes it look like a recursion problem. Looking at my library update logs, I see rar://...%252f... which seems to indicate that rar paths are URL-encoded twice, maybe that has something to do with the problem?

kraaa commented 4 years ago

I don't know. I got like 1000 rar in rar with subtitles that don't make Kodi crash hm...

amazingdash commented 4 years ago

I don't know. I got like 1000 rar in rar with subtitles that don't make Kodi crash hm...

I also have some that don't make it crash while scanning but please try to browse one that has a rar inside a rar, see if there's a .sub file, press I. It makes it crash here, always.

kraaa commented 4 years ago

Yes it does indeed crash. Hm but I got my scan to exclude sub folders. Dunno why It scans them.

amazingdash commented 4 years ago

Yes it does indeed crash. Hm but I got my scan to exclude sub folders. Dunno why It scans them.

I tried that too (with and without ending /) but it did not work either :/

<advancedsettings>
  <excludefromscan action="prepend">
    <regexp>/Subs/</regexp>
  </excludefromscan>
</advancedsettings/
notspiff commented 4 years ago

fairly certain that you are barking up the wrong tree, and that this was fixed in https://github.com/xbmc/xbmc/pull/17347

amazingdash commented 4 years ago

Thanks @notspiff It looks like you're right, I applied this patch and scans apparently don't crash Kodi anymore.

amazingdash commented 4 years ago

Well now the scan hangs when it encounters .sub files inside a rar inside a rar.

DEBUG: VideoInfoScanner: Adding new item to tvshows:rar://rar%3a%2f%2f%252fmnt%xxxx.rar%2fxxxx.rar/xxxx.sub

I've tried removing the contents from the library and re-adding it but it always blocks on this sub file. I've got no other entries in the log, I only see it closing connections to the TVDB: INFO: CheckIdle - Closing session to https://api.thetvdb.com.

When this happen, "Stop scanning" does nothing and kodi won't close, only SIGKILL closes it.

amazingdash commented 4 years ago

@notspiff I don't understand why the Subs folders aren't ignored to begin with since it's hardcoded here: https://github.com/xbmc/xbmc/blob/18.6-Leia/xbmc/settings/AdvancedSettings.cpp#L226 Does this have to do with the VFS creating URL-encoded locations which do not match this regex?

AlwinEsch commented 4 years ago

The new version is released:

@kraaa @amazingdash it should be fixed, can you test and confirm?

kraaa commented 4 years ago

The new version is released:

* 3.3.0-Matrix

* 2.3.0-Leia

@kraaa @amazingdash it should be fixed, can you test and confirm?

Still crashing with 2.3.0-Leia for me. Even started Crashing when 2.2.3 was stable. From log: 2020-04-08 03:35:18.570 T:15596 WARNING: VIDEO::CVideoInfoScanner::Process directory 'G:\rar3\movies\The.Host.2006.720p.BluRay.x264-SEPTiC\' does not exist - skipping scan. 2020-04-08 03:35:23.309 T:4316 ERROR: AddOnLog: RAR archive support: CFileRarExtractThread::Process: failed. CmdExtract::ExtractCurrentFile threw an Unknown exception 2020-04-08 03:35:53.305 T:15596 ERROR: AddOnLog: RAR archive support: CRarFile::Seek: Timeout waiting for seek to finish

kraaa commented 4 years ago

The new version is released:

* 3.3.0-Matrix

* 2.3.0-Leia

@kraaa @amazingdash it should be fixed, can you test and confirm?

Do you want the sub files? Because it's not all subs that cause crashing. Still an issue in 2.3.0 It's also rarely some episodes that check out fine on sfv crc checks.

As mentioned before I don't understand why subtitle folders get scanned when it's disabled in advancedsettings.xml. Guess it won't mather if the issue is fixed tho :)

amazingdash commented 4 years ago

@kraaa If you haven't applied the patch that was listed above, it might be the reason why you still get crashes.

@AlwinEsch After the latest plugin update and https://github.com/xbmc/xbmc/pull/17347 applied, there is no crash anymore. I have another problem though: after the last scan, a bunch of .sub files inside rars inside rars have been added to my library, it only seems to happen for TV shows. Do I need to file another issue for that? Here is an example strFilename from the files table: rar://rar%3A%2F%2Fblah%252fSubs%252fblah.subs.rar%2Fblah.rar/blah.sub

I do have this in my config and apparently it wasn't respected (maybe because slashes are URI-encoded inside rar locations?):

  <video>
    <excludetvshowsfromscan>
      <regexp>/subs/</regexp>
...
kraaa commented 4 years ago

@amazingdash how do i apply the patch? i need to build my own kodi?

amazingdash commented 4 years ago

I guess so, it doesn't look like Kodi provides automated builds :/

AlwinEsch commented 4 years ago

Have also seen this fix is not included in Leia, I'm force to have them in, on next Leia Release.

With the subtitle I'm not sure, maybe related to the %252f, has not worked so much with things like this, does this have no upper/lowercase problems? Seen subs from you is lower and on file Subs upper.

amazingdash commented 4 years ago

I'm pretty sure the regex is case-insensitive. It works this way for movies and excluding from view.

This wouldn't be a problem if .sub file were properly ignored. Anyway, I am quite confident that we are close to a solution: soon those files will be auto-added as subtitles when playing the film and excluded from the library as they should :)

kraaa commented 4 years ago

Maybe try (?i) before subs to make it 100% case-insensitive.

AlwinEsch commented 4 years ago

Have rechecked about them, the

#4238 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4239 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4240 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4241 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4242 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4243 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4244 0x000055555601aaf5 in CVideoTagLoaderNFO::FindNFO[abi:cxx11](CFileItem const&, bool) const ()
#4245 0x000055555601b66d in CVideoTagLoaderNFO::CVideoTagLoaderNFO(CFileItem const&, std::shared_ptr<ADDON::CScraper>, bool) ()
#4246 0x0000555556013b32 in VIDEO::CVideoInfoTagLoaderFactory::CreateLoader(CFileItem const&, std::shared_ptr<ADDON::CScraper>, bool, bool) ()

is fault in Kodi, all addon versions (old and new) bring this, his fix is already in Kodi but not on release now, hope that the Leia 18.7 comes really soon to have this fixed.

As only short alternative, until it is released can be a nightly used from here https://kodi.tv/download:

kraaa commented 4 years ago

I had the crash on Matrix from 8th April as well though