perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

Support reading files using symlinks

Open aMayzner opened this issue 1 year ago • 1 comments

Support files with symlinks. The change was suggested in http://yaqs/2182006114088910848

aMayzner avatar Apr 25 '25 10:04 aMayzner

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?

ddiproietto avatar Apr 25 '25 13:04 ddiproietto

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.

LalitMaganti avatar May 22 '25 20:05 LalitMaganti

Fix courtesy of afontan@ internally. Just copied and posted on behalf of them.

LalitMaganti avatar May 22 '25 21:05 LalitMaganti