DLu / roscompile

106 stars 19 forks source link

roscompile scripts have issues with plugin.xml files #77

Open fmessmer opened 3 years ago

fmessmer commented 3 years ago

I have been using both noetic_migration and upgrade_manifest scripts I did not really look into the code to figure out what the problem is, but I wanted to report this here

whenever there is a plugin.xml file in the repository, I get errors similar to the following:

ERROR: Trouble parsing package @ ./ur_kinematics
Traceback (most recent call last):
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/util.py", line 15, in get_packages
    packages.append(Package(root))
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/package.py", line 30, in __init__
    self.plugin_configs.append(PluginXML(rel_fn, file_path))
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/plugin_xml.py", line 18, in __init__
    self.read()
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/plugin_xml.py", line 21, in read
    tree = parse(self.file_path)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
ExpatError: junk after document element: line 11, column 0

what I did to work around this is:

DLu commented 3 years ago

It looks like its breaking on this plugin xml

On the one hand, roscompile should accept the same XML that pluginlib can parse.

On the other hand, to me that looks like invalid XML since there is not a <class_libraries> tag surrounding all three libraries.

I will look into what pluginlib is doing, and will see if I can add a rule to fix it.

fmessmer commented 3 years ago

here is another plugin.xml that roscompile has issues with:

<class_libraries>
  <library path="lib/liboutlier_scan_filters">
    <class name="outlier_scan_filters/ClusterScanFilter" type="outlier_scan_filters::ClusterScanFilter"
            base_class_type="filters::FilterBase<sensor_msgs::LaserScan>">
      <description>
        Cluster filters outliers based on cluster building.
      </description>
    </class>
    <class name="outlier_scan_filters/NeighbourScanFilter" type="outlier_scan_filters::NeighbourScanFilter"
            base_class_type="filters::FilterBase<sensor_msgs::LaserScan>">
      <description>
        Neighbour filters out outliers based on the distance from a points left and right neighbour.
      </description>
    </class>
  </library>
</class_libraries>

results in the following error:

rosrun roscompile noetic_migration -m
ERROR: Trouble parsing package @ ./outlier_scan_filters
Traceback (most recent call last):
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/util.py", line 17, in get_packages
    packages.append(Package(root))
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/package.py", line 31, in __init__
    self.plugin_configs.append(PluginXML(rel_fn, file_path))
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/plugin_xml.py", line 18, in __init__
    self.read()
  File "/home/fxm/projects/default/care-o-bot/src/roscompile/ros_introspection/src/ros_introspection/plugin_xml.py", line 21, in read
    tree = parse(self.file_path)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
ExpatError: not well-formed (invalid token): line 4, column 4
DLu commented 3 years ago

That's another fun one. XMLLint tells me Unescaped '<' not allowed in attributes values, which makes sense, but also works with pluginlib apparently.