Filesystem.Base->find() calls cause backtrace because of Filesystem.Stat->cd() failing
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=3532
Reported by Emils Klotins, Public Affairs Section, US Embassy Riga emils@tvnet.lv
I noticed the behaviour and Johan Sundström helped debug it and he put it in better words:
"It seems Filesystem.System (or some other Filesystem component) is bugged here; find() will in turn call stat->cd() to recurse into directories, which fails trying to call filesystem->cd(fullpath), where fullpath for some reason lacks a leading slash. I do not know which of these involved parts is doing something wrong, though, but at least one of them is working on broken assumptions.
The problem exists in recent 7.5:s and has probably always been there."
I noticed this when trying to develop a module for Roxen 3.3, Pike 7.2, which would need to traverse directory tree and get file & directory list.
so essentially:
// need to have some kind of masking defined,
// this one should simply filter out dirs.
int mask(Stat fobj)
{
if (fobj->isdir())
return 1;
return 0;
}
...
Filesystem.System fs=Filesystem.System("any_dir");
return sprintf("%O", fs->find(mask));
will cause:
Attempting to index NULL value.
Would be nice if could be fixed in 7.2, as there are no other ways to traverse Filesys there...