-
Notifications
You must be signed in to change notification settings - Fork 279
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
env.sh's new shell when no arguments are given lacks same env changes if .bashrc changes env vars #370
Conversation
Why would the resulting environment not be correct? |
Invoking env.sh without arguments has a very valid purpose: |
I think he might be talking about CMI's? https://github.com/ros/catkin/blob/groovy-devel/python/catkin/builder.py#L322 Does this one do anything without arguments? |
Sorry, I should have explained more. It was late, I was in a hurry, and i thought William knew what I mean. This relates to catkin_make_isolated, and the effect I noticed in #367 To reproduce, in a groovy underlay catkin workspace (after running catkin_make_isolated):
This gives me differences for CMAKE_PREFIX_PATH, CPATH, LD_LIBRARY_PATH, PATH, PKG_CONFIG_PATH, PYTHONPATH |
I knew, I hadn't talked to dirk about it. (I did not know that other env.sh's worked like that) |
I can tell you that env.sh generated by CMI (at least for third party packages) does not work unless the command is passed to it. I don't know if this is a failing of CMI or actually a bug in the env.sh generation, or something implicit to your environment. |
I also updated the ticket title, the use of 'useless' was pretty unhelpful. |
I would suggest that CMI generates the same files as catkin (env.sh, setup.sh|bash|zsh) and also uses the templates available in catkin instead of generating them separately. Then the semantic and functionality is the same. |
@dirk-thomas I agree, but at the time of implementation we considered this, I think there was some problem with reusing the catkin templates, but I can't remember what that was now. (possibly the templates are generated with CMake not python?) |
Yes, the templates are .in files but expanding them in Python should be not difficult. All except setup.sh are very simple and should reuse the existing files. setup.sh will either only redirect to an already generated setup.sh in one of the package folders or be generated for non-catkin as the env is currently. |
I have opened a new ticket: That ticket addresses the problem on inconsistency of env.sh files generated for non-catkin packages. @tkruse's original example indicates that genmsg's env.sh does not behave correctly, I'd have to test that locally to confirm, but that might still be a bug or something. |
Regarding the new issue title, I believe that env.sh does generate a new On Thu, Feb 28, 2013 at 9:36 PM, William Woodall
|
I see, you can change it to something more appropriate then. |
I can neither reproduce it with the currently released catkin version nor with latest groovy-devel. The only diff in the environment is Please post a reproducible command sequence and post the actual and expected output (than the issue will get reopened). |
Given that you did not get the same results as me, I tried guessing the difference, and I found a likely one. My .bashrc changes those env variables that I mentioned. So a prepending entry like this in the .bashrc (or any othe file processed for new shells I guess):
Will cause the PATH to be different in the diff:
and a replacing entry like this:
will cause this difference:
The complete steps to reproduce are to make the above changes to the bashrc, then to perform these steps:
|
When you invoke env.sh without arguments a new shell will be spawn which will source your .bashrc. If you invoke it with arguments no new shell will be spawn and therefore assignments from your .bashrc will not be effective instead the current environment is just carried over. Is that the scenario you describe? |
Yes, I believe that is what happens. What should happen is either when On Sat, Mar 2, 2013 at 8:35 PM, Dirk Thomas notifications@github.comwrote:
|
Just to clarify: that behavior is not catkin_make(_isolated) specific. This has been they way it works since some ROS releases. I don't know a way to implement what you suggest - spawning a new shell and performing a command like sourcing the setup in the interactive shell after .bashrc etc has been evaluated. Please suggest a way to perform that (at best a generic solution which works for the different supported shells) or suggest a formulation which you think is necessary to describe the existing behavior. |
I am only aware of an env.sh that was introduced in fuerte, which to me does not mean "many" releases ago. And yes, the one in /opt/ros/fuerte suffers the same problem and should also be fixed. I don't know of any way to implement this neither, in which case I would prefer env.sh not to offer this functionality at all. For bash though, I found this though: In any case, if it is decided to keep this flawed behavior for the convenience of a few hackers, I would phrase a warning like:
|
env.sh's new shell when no arguments are given lacks same env changes if .bashrc changes env vars
@wjwwood as discussed env.sh could do a better job of explaining that running or sourcing it without further arguments is not a valid usecase, as the resulting env is not what can be expected.