Skip to content

Cmake bug fix: CMake does not install zstdgrep and zstdless#1625

Closed
LeeYoung624 wants to merge 5 commits intofacebook:devfrom
LeeYoung624:cmake_install_fix
Closed

Cmake bug fix: CMake does not install zstdgrep and zstdless#1625
LeeYoung624 wants to merge 5 commits intofacebook:devfrom
LeeYoung624:cmake_install_fix

Conversation

@LeeYoung624
Copy link
Copy Markdown
Contributor

As it's described here
CMake does not install zstdgrep and zstdless shell scripts

Copy zstdgrep and zstdless in CMake make install, and grant them execute permission

Copy link
Copy Markdown

@Mno-hime Mno-hime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this @LeeYoung624!

I think commits should be squashed or the effective commit rebased.

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdcat DESTINATION "bin")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unzstd DESTINATION "bin")
install(FILES ${CMAKE_SOURCE_DIR}/../../programs/zstdgrep DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES ${CMAKE_SOURCE_DIR}/../../programs/zstdless DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there's too much toggling or permissions?

Suggested change
install(FILES ${CMAKE_SOURCE_DIR}/../../programs/zstdless DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES ${CMAKE_SOURCE_DIR}/../../programs/zstdless DESTINATION "bin")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, the default permissions is OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ
cmake install
which means the users can not directly use zstdless and zstdgrep after make install.
Users need to chmod for zstdless and zstdgrep.
I tested on Ubuntu, Redhat, Centos and suse, and all of them show the same result if I didn't add the execute permissions
-bash: /usr/local/bin/zstdless: Permission denied

I think this should be done in cmake scripts.

And of course, the commits should be squashed. Thank you so much

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why these permissions need to be explicitly set here, while they don't on the zstd install command? I guess it's because zstd is a TARGETS object, while these are FILES objects. Would it make more sense for these to be TARGETS themselves?

Or maybe these should be PROGRAMS?

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. This form is intended to install programs that are not targets, such as shell scripts. Use the TARGETS form to install targets built within the project.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixhandte I checked the camke documentation and ask some guys familiar with CMake. I think you are right. These should be PROGRAMS. Thank you so much.

Cyan4973 added 4 commits June 11, 2019 11:01
It's re-synchronized with nextToUpdate at beginning of each block.
It only needs to be tracked from within zstd_opt block parser.

Made the logic clear, so that no code tried to maintain this variable.

An even better solution would be to make nextToUpdate3
an internal variable of ZSTD_compressBlock_opt_generic().
That would make it possible to remove it from ZSTD_matchState_t,
thus restricting its visibility to only where it's actually useful.

This would require deeper changes though,
since the matchState is the natural structure to transport parameters into and inside the parser.
it's now a local variable of ZSTD_compressBlock_opt()
Copy link
Copy Markdown
Contributor

@felixhandte felixhandte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks!

@felixhandte
Copy link
Copy Markdown
Contributor

@LeeYoung624, can you fix your stack so that it doesn't include rebases of commits already merged?

@LeeYoung624
Copy link
Copy Markdown
Contributor Author

Yes @felixhandte I will rebase this

fix cmake bugs: didn't install zstdless and zstdgrep

fix cmake bugs:
cmake doesn't install zstdless and zstdgrep
@LeeYoung624
Copy link
Copy Markdown
Contributor Author

@felixhandte seems I mess up the stack of this PR.. I will close thie PR and open a new one for this cmake fix. Sorry about this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants