Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix symlink resolution on Windows w/short filenames #365

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/catkin_pkg/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def order_paths(paths_to_order, prefix_paths):


def _is_equal_or_in_parents(dir_, path):
dir_ = os.path.normcase(os.path.realpath(dir_))
path = os.path.normcase(os.path.realpath(path))
dir_ = os.path.normcase(os.path.realpath(os.path.realpath(dir_)))
path = os.path.normcase(os.path.realpath(os.path.realpath(path)))
return path == dir_ or path.startswith(dir_ + os.sep)


Expand Down
4 changes: 4 additions & 0 deletions test/test_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import shutil
import sys
import tempfile
import unittest

Expand Down Expand Up @@ -43,6 +44,9 @@ def test_order_paths(self):
self.assertEqual(['foo' + os.sep + 'bim', 'bar'], order_paths(['bar', 'foo' + os.sep + 'bim'], ['foo']))

def test_order_paths_with_symlink(self):
if os.name == 'nt' and sys.version_info < (3, 8):
self.skipTest('symlinks are not resolved on Windows prior to Python 3.8')

root_dir = tempfile.mkdtemp()
try:
foo = os.path.join(root_dir, 'foo')
Expand Down