This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix SBFileSpec.fullpath for Windows
ClosedPublic

Authored by kastiglione on Sep 6 2022, 10:45 AM.

Details

Summary

Fix fullpath to not assume a / path separator. This was discovered when
D133130 failed on Windows. Use os.path.join() to fix the issue.

Diff Detail

Event Timeline

kastiglione created this revision.Sep 6 2022, 10:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2022, 10:45 AM
kastiglione requested review of this revision.Sep 6 2022, 10:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2022, 10:45 AM

will add a test before committing, there was no immediately obvious place for a test.

mib accepted this revision.Sep 6 2022, 10:50 AM

LGTM!

This revision is now accepted and ready to land.Sep 6 2022, 10:50 AM
This revision was automatically updated to reflect the committed changes.

@stella.stamenova fix about to be committed.

@stella.stamenova I realized that test has more paths that need fixing. The rest are fixed in rG760c75fe2d25e06644271cb1338f8b0f8d9abc70.

Ugh, the test that is failing uses windows paths but runs on both windows and non-windows machines. I will revert this and the two fix commits.

Ugh, the test that is failing uses windows paths but runs on both windows and non-windows machines. I will revert this and the two fix commits.

You should be able to test for the operating system and set the paths accordingly in the test.

I will do that and recommit, thanks.

labath added a subscriber: labath.Nov 15 2022, 12:00 AM

The real problem here is that the __get_fullpath__ implementation does not use the path style information from within the FileSpec object. Hardcoding it to use the host os path style (instead of posix style) just changes the set of bugs.

@labath thanks, I believe a more correct fix here https://reviews.llvm.org/D138348