-
Notifications
You must be signed in to change notification settings - Fork 281
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
Fix symlink install python when shebang line is rewritten #1100
Fix symlink install python when shebang line is rewritten #1100
Conversation
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
@dirk-thomas Thank you for your quick response! I've fixed my PR for |
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.
LGTM!
If I was going to nitpick, I would say this should set the permissions on the generated file to be executable instead of copying the source file permissions via USE_SOURCE_PERMISSIONS
since that's what install(PROGRAMS)
would do:
https://cmake.org/cmake/help/v3.5/command/install.html
The PROGRAMS form is identical to the FILES form except that the default permissions for the installed file also include OWNER_EXECUTE, GROUP_EXECUTE, and WORLD_EXECUTE.
@sloretz Do you have a suggestion how to do that? Afaik there is no way to set permissions on a file in CMake (beyond |
I think it could be done with |
The current patch already uses I then asked if you can recommend a function to set the permissions without copying the file (#1100 (comment)). |
I'm proposing using |
Ok, the nitpick is not about the "hacky copy a file and then overwrite its content anyway" but about enforcing an executable bit - even if the source file doesn't have one. In the case where the shebang line doesn't have to be rewritten the source file is symlinked and therefore must have the executable bit set already. I would rather not workaround a missing executable bit for the source file only in the case when the shebang line is rewritten. Otherwise it would magically work when the executable bit is missing for the source file as long as the shebang line is rewritten but as soon as the shebang line is update to not require rewriting anymore the symlinked file wouldn't be executable anymore. |
@kenji-miyake Thank you for the patch. |
@dirk-thomas Thank you, too.
Yes, no problem. It's what I mentioned here.
Thank you, looks nice! |
@dirk-thomas By the way, will this be backported to melodic? |
Yes, that is what the |
* Refactor catkin_install_python.cmake Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * Use source-permissions for rewritten_files Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * rename temp variable * add comment Co-authored-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
Cherry-picked to |
Overview
This PR fixes
catkin_install_python
whenCATKIN_SYMLINK_INSTALL=ON
.I'm sending this PR to-> Changed tokinetic-devel
because I'm still usingmelodic
, but I believe the same change can be applied tonoetic-devel
.noetic-devel
.Problem
In
catkin_install_python.cmake
, new (shebang-replaced) files which are generated byfile(WRITE ...)
, which drops the permissions.catkin/cmake/catkin_install_python.cmake
Line 42 in 4fe89dd
This disables python-scripts execution with
rosrun
.Supplemental
The permissions of symlink files (inside
install/
) are executable because ofinstall(PROGRAMS ...)
catkin/cmake/catkin_install_python.cmake
Line 53 in 4fe89dd
However, the real files (inside
catkin_generated/installspace
) are not executable.Solution
I just added
file(COPY ...)
beforefile(WRITE ...)
.aead61d#diff-3cfcccb0a4b1968a8dae7de378653f99R41
I also added a variable
installspace
in order to avoid overwriting the variable, but I can drop this change from this PR.8f23bf5
How to test (Melodic)
How to test (Noetic)