-
Notifications
You must be signed in to change notification settings - Fork 65
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
Only perform backquote substitution when needed #34
Conversation
@@ -2151,7 +2151,12 @@ bool cmpDirectoryCrawlRecord(DirectoryCrawlRecord* i, | |||
outstring.replace(i, std::string(MANIFEST_PREFIX).length(), | |||
stackage->path_); | |||
} | |||
|
|||
|
|||
if (outstring.find_first_of("$`") == std::string::npos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it searching for $`` and not only for ```? And if it should search for backtick only it might better use
.find()`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know exactly what the intention was, but you can use the alternative syntax $(command)
Because I didn't know exactly who is using this feature, I just preferred not taking chances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to search for ``` as well as $(
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what find_first_of
is doing. It is searching for ``` and $
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ow, sorry, I think I got what you meant. You mean that we should look specifically for $(
and not just $
, right?
Well, that would also break the previous behavior. I don't know if anybody actually relies on this, but again, not taking chances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it should process:
- commands wrapped in backticks (
...
) - commands wrapped in
$(...)
- environment variables accessed with
$name
Then the patch makes sense as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify that in the patch can you please insert the following comment above the if
line:
// skip substitution attempt when the string neither contains
// a dollar sign for $(command) and $envvar nor
// a backtick wrapping a command
@dirk-thomas the comment has been added. |
As long as it gets applied to all active branch and is in a separate commit I am fine with code style clean up. Can you please squash the first two commit into one? |
Spawning shells is an expensive operation. In a lot of cases, there is no need for any substitution. Besides, this does not work on Windows.
Here you go |
+1 with backport . The improvements are backwards compatible and provide support for more platforms. If we're backporting to hydro we might as well go to groovy too. |
+1 |
+1, yay!
This seems like legacy from the rosbuild era. As an indication, a search over all 418
+1 for
Nitpick: Please cherry-pick the changesets next time, so attribution is preserved ;-). |
@adolfo-rt Despite what is actively being used in a very small subset of packages we can simply not change behavior. What has worked before and was valid code should continue to work. All patch always go to the latest development branch and then get backported when they have proven stable. But these changes did not at all apply to indigo-devel - please try a cherry-pick - both branches have divered significantly. Therefore I just replicated the patch instead of waiting for the pull request to be modified to apply to indigo-devel. Usually I will always either cherry-pick or merge the incoming if they are good as they are. Especially the trailing white space part was also extended to cover all sources but a single file. |
I'm not suggesting breaking existing behavior in the short or medium term. Still, if platform-independence becomes important enough at some point to be addressed, this would definitely imply changing behavior. That being said, I find it a good sign that most catkin packages out there are not relying on platform-dependent behavior :). |
Cherry-picked the change (without the whitespaces) into groovy-devel. Will be released as 2.1.23. |
Thanks! |
Drop patch-aa for tinyxml location, this is now handled by devel/ros-cmake-modules. Changes since 2.1.19: 2.2.4 (2014-07-10) ------------------ * fix find_package(PythonLibs ...) with CMake 3 (`#42 <https://github.com/ros/rospack/issues/42>`_) 2.2.3 (2014-05-07) ------------------ * find library for exact Python version (even if not in CMake provided list of version numbers) (`#40 <https://github.com/ros/rospack/issues/40>`_) * find TinyXML using cmake_modules (`#24 <https://github.com/ros/rospack/issues/24>`_) * make error messages tool specific (rospack vs. rosstack) (`#38 <https://github.com/ros/rospack/issues/38>`_) 2.2.2 (2014-02-25) ------------------ * python 3 compatibility (`#35 <https://github.com/ros/rospack/issues/35>`_) 2.2.1 (2014-02-24) ------------------ * only perform backquote substitution when needed (`#34 <https://github.com/ros/rospack/issues/34>`_) 2.2.0 (2014-01-30) ------------------ * add hash of ROS_PACKAGE_PATH to rospack/rosstack cache filename, remove ROS_ROOT from cache (`#28 <https://github.com/ros/rospack/issues/28>`_) 2.1.22 (2014-01-07) ------------------- * use specific python version catkin has decided on (`#29 <https://github.com/ros/rospack/issues/29>`_) * python 3 compatibility (`#25 <https://github.com/ros/rospack/issues/25>`_, `#27 <https://github.com/ros/rospack/issues/27>`_) * fall back gracefully whe gtest is not available * update package urls 2.1.21 (2013-07-05) ------------------- * honor CATKIN_IGNORE marker file when crawling for packages (`#21 <https://github.com/ros/rospack/issues/21>`_) 2.1.20 (2013-07-03) ------------------- * improve error message to include package names when circular dependency is detected (`#18 <https://github.com/ros/rospack/issues/18>`_) * check for CATKIN_ENABLE_TESTING to enable configure without tests * add '-h' option
This pull request has several goals.
pluginlib
in aXenomai
environment, for example throughros_control
. In such an environment, callingpopen
can have disastrous consequences. While not preventing the call, the proposed fix removes unnecessary calls.pluginlib
. A call tocreateInstance()
has been benchmarked to drop from around 2 seconds to 50 milliseconds with this fix on our local setup with a near-complete ROS hydro install + extra local packages.It is proposed against
groovy-devel
because it is very small and does not break API or ABI compatibility.