[mythtv-commits] mythtv commit: r26161 by beirdo

mythtv at cvs.mythtv.org mythtv at cvs.mythtv.org
Tue Sep 7 23:36:17 UTC 2010

      Author: beirdo
        Date: 2010-09-07 23:36:17 +0000 (Tue, 07 Sep 2010)
New Revision: 26161
   Changeset: http://svn.mythtv.org/trac/changeset/26161


Avoid the pain of recursively following the "." entry in a media directory scan.
While we already had it working in the majority of cases, in the off chance that
the system's locale isn't UTF-8, and there is a UTF-8 filename (such as the pi
character) that is exactly one character long, it can be falsely interpreted as
"?".  When recursing, the file globbing matches "?" to "." and we spin in a 
recursive loop until we exhaust stack.

Soo...  We now check for filenames of "?" and "??" and ".?" and "?." to get
away from these edge cases.

As an additional precaution, when we go to recurse into the subdirectory, we
now check to make sure that the underlying directory isn't the same as the 
current directory.  Granted, this won't catch the larger loops, but it will get
rid of this case.  I think it is still possible to end up recursively loop if 
some numbskull puts a symlink as (say) "parent -> .." or even worse "all -> /"
forming a bigger loop.  If we want to be absolutely safe, we need to build a
map of visited directories and refuse to recurse into a directory we already

As this code is likely to be removed with #8801 (or related subsequent code), I
think this temporary fix should be sufficient for now.



More information about the mythtv-commits mailing list