Skip to content
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

cmake find_package fails due to too restrictive permissions of /usr/local/lib64/cmake directory #1634

Closed
szevzol opened this issue Dec 19, 2022 · 4 comments

Comments

@szevzol
Copy link

szevzol commented Dec 19, 2022

Describe the bug
Trying to build my code with nng. When I put this line to my CMakeLists.txt:

find_package(nng CONFIG REQUIRED)

then cmake fails, it cannot find the necessary cmake files:

  Could not find a package configuration file provided by "nng" with any of
  the following names:

    nngConfig.cmake
    nng-config.cmake

  Add the installation prefix of "nng" to CMAKE_PREFIX_PATH or set "nng_DIR"
  to a directory containing one of the above files.  If "nng" provides a
  separate development package or SDK, be sure it has been installed.

Expected behavior
find_package should run successfully.

Actual Behavior
find_package fails.

To Reproduce
Create a CMakeLists.txt which calls find_package for nng

** Environment Details **

cat /etc/os-release
NAME="SLES"
VERSION="15-SP4"
VERSION_ID="15.4"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP4"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp4"
DOCUMENTATION_URL="https://documentation.suse.com/"

nng build with master 5385b78

g++ --version
g++ (SUSE Linux) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Additional context

I found that nng cmake files are installed, but the cmake directory is not accessible.

/usr/local/lib64/cmake> ls -l
total 0
drwxr-x--- 1 root root 166 Dec 19 08:53 nng

I had to do chmod 755 to the directory and then it was OK.

@szevzol szevzol changed the title cmake find_package fails because of too retrictive permissions of /usr/local/lib64/cmake cmake find_package fails due to too restrictive permissions of /usr/local/lib64/cmake directory Dec 19, 2022
@szevzol
Copy link
Author

szevzol commented Dec 19, 2022

Important note: I ran the installation inside a docker container where umask was 0027 which is a more restrictive mask then the host's 0022. And I think this is the main cause.

@gdamore
Copy link
Contributor

gdamore commented Feb 21, 2023

Sounds plausible. If you install things with insufficient permission to allow others to read them, then it won't be much surprise when they fail because they can't read them.

@gdamore
Copy link
Contributor

gdamore commented Mar 20, 2023

It isn't clear to me that there is anything really for me to do here.

The relevant rules are:

# Install the header files.
install(DIRECTORY ../include/nng
        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
        COMPONENT Headers)

I suppose I could add the FILE_PERMISSIONS and DIRECTORY_PERMISSIONS attributes to those command lines instead of relying on the default, but I'm not sure that's a great idea.

I honestly think if you use a very strict umask (like 027), then you probably want that umask to be honored. If that means that stuff breaks for stuff you installed for others (for example while operating in a root account) -- perhaps the umask setting is contra-indicated?

Put another way, I don't feel comfortable changing (or overriding) a umask that a user may have set here.

@gdamore
Copy link
Contributor

gdamore commented Mar 20, 2023

I'm closing this as "won't fix" for now.

@gdamore gdamore closed this as completed Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants