usdot-fhwa-stol / carma-msgs

ROS Message definitions used by the CARMA Platform
6 stars 9 forks source link

UTF-8 characters in `LaneAttributesTrackedVehicle.msg` file #112

Closed adamlm closed 3 years ago

adamlm commented 3 years ago

Types of Issue

Descriptive summary

The LaneAttributesTrackedVehicle.msg file has UTF-8 quotation marks, which prevents the message file from being generated on systems with a POSIX locale.

Carma version where this issue was discovered

Problem discovered in develop, but issue present starting with versions CARMAPlatform_2.9.0 (earliest chronological) and CARMAMsgs_1.1.0 (earliest numerical).

Expected behavior

LaneAttributesTrackedVehicle.msg file should be ASCII encoded, and catkin_make should build the j2735_msgs package successfully.

Actual behavior

catkin_make fails while trying to build j2735_msgs with the following (partial) output

-- +++ processing catkin package: 'j2735_msgs'
-- ==> add_subdirectory(carma-msgs/j2735_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
/opt/ros/noetic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xe2 in position 255: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/em.py", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/lib/python3/dist-packages/em.py", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/em.py", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/lib/python3/dist-packages/em.py", line 2295, in wrap
    self.fail(e)
  File "/usr/lib/python3/dist-packages/em.py", line 2284, in wrap
    callable(*args)
  File "/usr/lib/python3/dist-packages/em.py", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2421, in parse
    token.run(self, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "<string>", line 38, in <module>
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/deps.py", line 48, in find_msg_dependencies_with_type
    genmsg.msg_loader.load_depends(msg_context, spec, search_paths)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/msg_loader.py", line 349, in load_depends
    return load_msg_depends(msg_context, spec, msg_search_path)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/msg_loader.py", line 326, in load_msg_depends
    load_msg_depends(msg_context, depspec, search_path)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/msg_loader.py", line 326, in load_msg_depends
    load_msg_depends(msg_context, depspec, search_path)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/msg_loader.py", line 318, in load_msg_depends
    depspec = load_msg_by_type(msg_context, resolved_type, search_path)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/msg_loader.py", line 128, in load_msg_by_type
    spec = load_msg_from_file(msg_context, file_path, msg_type)
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/msg_loader.py", line 285, in load_msg_from_file
    text = f.read()
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 255: ordinal not in range(128)
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/catkin_ws/build/catkin_generated/env_cached.sh
  "/usr/bin/python3" "/usr/lib/python3/dist-packages/em.py" "--raw-errors"
  "-F"
  "/catkin_ws/build/carma-msgs/j2735_msgs/cmake/j2735_msgs-genmsg-context.py"
  "-o" "/catkin_ws/build/carma-msgs/j2735_msgs/cmake/j2735_msgs-genmsg.cmake"
  "/opt/ros/noetic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/noetic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  carma-msgs/j2735_msgs/CMakeLists.txt:93 (generate_messages)

Steps to reproduce the actual behavior

Start in an environment with a POSIX locale. This issue was discovered while using the dustynv/ros:noetic-ros-base-l4t-r32.4.4 Docker container on the NVIDIA Jetson TX2.

  1. Create a clean catkin workspace
    $ mkdir -p catkin_ws/src && cd catkin_ws/src
  2. Clone the carma-msgs repository
    $ git clone https://github.com/usdot-fhwa-stol/carma-msgs.git
  3. Attempt to build the j2735_msgs package
    $ catkin_make --only-pkg-with-deps j2735_msgs

Other notes

To confirm that LaneAttributesTrackedVehicle.msg is UTF-8 encoded, run the command

$ file -i LaneAttributesTrackedVehicle.msg

The output should be

LaneAttributesTrackedVehicle.msg: text/plain; charset=utf-8

Related work