tools-utils: Do not skip symbolic links when analyzing a linux tree
Commit Message
For various reasons, (parts of) a linux kernel tree containing vmlinux
and kernel modules might be organized using symbolic links. One reason
is that those binaries physically reside on a different storage and are
linked into place. To support such scenarios by allowing to traverse
symbolic links when discovering linux kernel binaries.
I could not see a reason why this was disabled in the first place.
Ignoring symbolic links had been the default since the inception of the
kernel mode.
Hence, allow valid symbolic links and that is what this patch does.
* src/abg-tools-utils.cc (find_vmlinux_and_module_paths): Do not
skip valid symbolic links.
Signed-off-by: Matthias Maennich <maennich@google.com>
---
src/abg-tools-utils.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hello Matthias,
Matthias Maennich <maennich@google.com> a écrit:
> For various reasons, (parts of) a linux kernel tree containing vmlinux
> and kernel modules might be organized using symbolic links. One reason
> is that those binaries physically reside on a different storage and are
> linked into place. To support such scenarios by allowing to traverse
> symbolic links when discovering linux kernel binaries.
>
> I could not see a reason why this was disabled in the first place.
> Ignoring symbolic links had been the default since the inception of the
> kernel mode.
Following symbolic link is disabled because there can be cases where the
link points to a directory of the kernel tree, causing cycles in the
tree. In that case, fts_read can return the same file several times.
I seem to remember that it had noticeable performance impacts on the
tests I did with our kernels.
So to support symbolic link, we'd need to properly handle (avoid?) those
cycles, probably by taking into account the FTS_DC bit of the
FTSENT::fts_info data member. I haven't looked into it in details,
though.
Have you seen the same think in those cases?
Thanks.
[...]
@@ -2298,8 +2298,8 @@ find_vmlinux_and_module_paths(const string& from,
FTSENT *entry;
while ((entry = fts_read(file_hierarchy)))
{
- // Skip descendents of symbolic links.
- if (entry->fts_info == FTS_SL || entry->fts_info == FTS_SLNONE)
+ // Skip descendents of dead symbolic links.
+ if (entry->fts_info == FTS_SLNONE)
{
fts_set(file_hierarchy, entry, FTS_SKIP);
continue;