OpenCyphal / pydsdl

Cyphal DSDL processing front end implemented in Python
https://opencyphal.org
MIT License
10 stars 9 forks source link

Symlinked namespace directories are mishandled #71

Closed pavel-kirienko closed 2 years ago

pavel-kirienko commented 2 years ago

Reported as:

yakut compile https://github.com/UAVCAN/public_regulated_data_types/archive/refs/heads/master.zip
Traceback (most recent call last):
  <...>
  File "<...>/pydsdl/_namespace.py", line 422, in _ensure_no_namespace_name_collisions
    raise RootNamespaceNameCollisionError("The name of this namespace conflicts with %r" % b, path=a)
pydsdl._namespace.RootNamespaceNameCollisionError: /private/var/folders/z9/y477y8hd1gn8ss5__l_x70t00000gn/T/yakut-dsdl-fg59acm6/public_regulated_data_types-master/reg: The name of this namespace conflicts with '/var/folders/z9/y477y8hd1gn8ss5__l_x70t00000gn/T/yakut-dsdl-fg59acm6/public_regulated_data_types-master/reg'

Notice the difference: /private/var/ <--> /var/. This issue appears to affect only macOS users.

The fix should be to use os.path.realpath along with abspath here:

https://github.com/UAVCAN/pydsdl/blob/7d93f00158d2145a2997c37fc16710ae291220a6/pydsdl/_namespace.py#L135-L137

@coderkalyan can you look into this, please?

coderkalyan commented 2 years ago

Sure thing, will take a look this weekend (or sooner if possible).