Skip to content

Fix working with filesystem parent paths.#112

Merged
clalancette merged 3 commits intomasterfrom
clalancette/fix-filesystem-parent-paths
Nov 16, 2020
Merged

Fix working with filesystem parent paths.#112
clalancette merged 3 commits intomasterfrom
clalancette/fix-filesystem-parent-paths

Conversation

@clalancette
Copy link
Copy Markdown
Contributor

I found two separate bugs while working with parent paths:

  1. Asking for the first parent path of an absolute path
    would add a duplicate separator at the beginning. I fixed
    this by checking to see if the separator already exists,
    and skiping if there is already one.
  2. Asking for the grandparent path of an absolute path
    would return a relative path, which is very incorrect. The
    problem here turned out to be that we were not propagating
    empty vector pieces from a child to a parent, and so the
    grandparent would miss out that it was supposed to be absolute.
    Fix this by always adding all pieces to the parents, even
    when they are empty.

I also added tests for the above cases.

Signed-off-by: Chris Lalancette clalancette@openrobotics.org

This is currently blocking the resolution of ros/pluginlib#212 . I'll run CI on everything above rcpputils just to ensure we aren't breaking something.

@clalancette
Copy link
Copy Markdown
Contributor Author

clalancette commented Nov 4, 2020

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

I found two separate bugs while working with parent paths:

1.  Asking for the first parent path of an absolute path
would add a duplicate separator at the beginning.  I fixed
this by checking to see if the separator already exists,
and skiping if there is already one.
2.  Asking for the grandparent path of an absolute path
would return a relative path, which is very incorrect.  The
problem here turned out to be that we were not propagating
empty vector pieces from a child to a parent, and so the
grandparent would miss out that it was supposed to be absolute.
Fix this by always adding all pieces to the parents, even
when they are empty.

I also added tests for the above cases.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette clalancette force-pushed the clalancette/fix-filesystem-parent-paths branch from 9d70878 to 49aed47 Compare November 6, 2020 15:43
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Copy Markdown
Contributor Author

All right, I do believe I've fixed the Windows issues. Kicking off another CI to make sure:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette
Copy link
Copy Markdown
Contributor Author

@mjcarroll @mjeronimo I could use another review here, thanks.

Copy link
Copy Markdown
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clalancette
Copy link
Copy Markdown
Contributor Author

All of the CI failures on Windows are known to be flaky, and have failed in the last several Windows builds.

So with green CI everywhere else, and an approval, I'll go ahead and merge. Thanks for the reviews.

@clalancette clalancette merged commit 050f4de into master Nov 16, 2020
@clalancette clalancette deleted the clalancette/fix-filesystem-parent-paths branch November 16, 2020 16:51
@brawner
Copy link
Copy Markdown
Contributor

brawner commented Nov 17, 2020

It looks like this PR may have introduced an issue on windows debug. It's not immediately obvious to me where this error is occurring though.
https://ci.ros2.org/view/nightly/job/nightly_win_deb/1809/testReport/(root)/projectroot/test_filesystem_helper/

@clalancette
Copy link
Copy Markdown
Contributor Author

Sigh, yes. Thanks for pointing it out, I'll take a look.

clalancette added a commit that referenced this pull request Nov 17, 2020
This was a bug introduced by #112,
but only shows up on Windows Debug for some reason.  Regardless,
we should not try to index into an empty string.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Copy Markdown
Contributor Author

Windows Debug was right, and I had a bad bug in this patch. Fix in #113

clalancette added a commit that referenced this pull request Nov 18, 2020
This was a bug introduced by #112,
but only shows up on Windows Debug for some reason.  Regardless,
we should not try to index into an empty string.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants