Closed rgleichman closed 10 years ago
Okay, we can fix this by sanitizing strings after generating the MD5 during Haskell code gen, but this still leaves me uncertain how to handle string constants. The one example on the wiki has a quoted part and an unquoted part, how would we want to handle that? I suspect they are counting on a loosely specified "do what I mean" interpretation, in which case we could detect the case where a constant is bracketed by quotes. The simplest fix is to just change how the Haskell message code is generated to avoid double quotes.
To follow up here: I don't have a horse in this race, so I could use some input. Do you think your example (string BLAH = "all") is representative? Would you expect the string constant to have quotation marks as part of its content?
The spec says the entire line after the equals sign is taken after trimming leading and trailing whitespace. Given that rule, the use of quotation marks only makes sense to me if they are intended to be included in the string literal rather than delimiting its extents.
Edit to clarify: My feeling is that we should escape the quotation marks in the generated code, but we just have to be careful to not escape them before computing the MD5. Your example would then produce a string literal "\"all\"".
String constants in ROS messages seem uncommon, so I would support escaping quotation marks if that would be more consistent with the specification.
Can you check if the commit referenced there (the StringConstants branch) works for you? I can't run against the test case you gave as I don't have moveit installed.
Yes, StringConstants generates the correct MD5 for the example message arm_navigation_msgs/AttachedCollisionObject.
Thanks, this is now merged into the dev
and master
branches.
Added a set of quotation marks around the string literals in generated message code.
Hopefully this is fixed now, but, even if it's not we at least have tests and expected output in the repo to pin things down.
Roshask generates the wrong MD5 sum for messages with String constants. The culprit is
sanitizeConstants
. IfsanitizeConstants
is changed fromto the identity for strings
It generates the correct MD5 sum.
Example msg file: arm_navigation_msgs/AttachedCollisionObject Its MD5 should be "3fd8ca730863e3d97d109c317d106cf9"