Support reading files using symlinks
Support files with symlinks. The change was suggested in http://yaqs/2182006114088910848
Discussed offline:
the ideal solution would be to use something like fts_read, at least on linux, so that:
- We also handle symlinks in directories
- We're protected against symlinks loop
There's already a piece of code that uses fts_read in external/perfetto/src/profiling/symbolizer/filesystem_posix.cc
Maybe we can move that to base and reuse it from ListFilesRecursive?
the ideal solution would be to use something like fts_read, at least on linux, so that:
I agree this is an ideal solution but given that that code is already quite tricky to reason about with the presence of ifdefs for NACL and Windows, I think complicating the code even more is not a great idea. Looking at the man page (https://man7.org/linux/man-pages/man3/fts.3.html) this looks a very complex API and getting all the details right here will take quite some time.
Also this is actively blocking folks (http://yaqs/2182006114088910848#a1n1) so I'm inclined to merge this PR. This code is currently only used for trace processor so if we think this is not high quality enough to have in base, happy to move it to trace_processor instead.
Alternatively, if we think the priority is high enough, let me know and I'll rewrite this with fts. But I want to merge this to not block people.
Fix courtesy of afontan@ internally. Just copied and posted on behalf of them.