Skip to content

Symbolic links in DebugLoc.File paths may have unexpected effects #24

@abbriggs

Description

@abbriggs

The DebugLoc for a optimization record is created from several sources:

  • the path from the root of the build to this record's associated source file
    • This is effectively controlled by the project's makefiles and how they invoke their build system.
  • the location of an #included file
    • This depends on how the source file invokes #include and how the include directories are specified by the makefiles.

Both of these may include . and .. in their paths.

Working with a few projects, I've noticed a couple of minor issues due to symlinks in DebugLocs:

  1. If a remark exists with a DebugLoc.File that begins with ., the HTML file name will still contain the . at the beginning. On Unix-like systems, this hides the HTML file from typical file explorers.
    • Example: ./common/foo.h ==> ._common_foo.h.html.
  2. If source files in multiple directories include the same header using relative paths, one HTML file will be created for each directory.
    • Example: ./dir1/foo.c and ./dir2/bar.c both contain #include <../lib/baz.h>. Two HTML files will be created: ._dir1_.._lib_baz.h.html and ._dir2_.._lib_baz.h.html.

I think both of these could be resolved by transforming the DebugLoc.File into an absolute path w.r.t the source_dir, but I'm not sure exactly where to do so. It seems like the code partially supports dumping remarks back into YAML, and it's likely that resolving these paths would remove compatibility (since dumping back to YAML would produce absolute paths).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions