← All tasks
cppledger/ledger #531Not a task: not reproduced

Permissions of /usr/lib64/python2.7/site-packages/ledger.so under Fedora

envgap__ledger__ledger-531

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
7ae943a0bb0a133964e93c9a8e76d0e1afdb41b2
Manifest
src/CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

ledger/ledger #531 · read the original issue
In Fedora, dynamic libraries are to be installed with their executable bit set, i. e. `775`.  However `ledger` installs `/usr/lib64/python2.7/site-packages/ledger.so` as `644`.  Therefore, Fedora's [`ledger.spec`](https://src.fedoraproject.org/rpms/ledger/blob/master/f/ledger.spec#_120) needs to call `chmod`:



    chmod +x %{buildroot}%{python2_sitearch}/ledger.so



It would be nice to integrate this into `ledger`'s build system.  The trivial patch:



    diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt

    index 65e58edb..5a00d9e8 100644

    --- a/src/CMakeLists.txt

    +++ b/src/CMakeLists.txt

    @@ -313,7 +313,8 @@ print(s.get_python_lib(True, prefix=''))"

           $<TARGET_FILE:libledger> "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}")

         install(

           FILES "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}"

    -      DESTINATION ${PYTHON_SITE_PACKAGES})

    +      DESTINATION ${PYTHON_SITE_PACKAGES}

    +      PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

       else()

         message(WARNING "PYTHON_SITE_PACKAGES not set. Will not install python module.")

       endif()



fixes the issue for Fedora, but would need to be `if`-guarded to only apply to Fedora and related distributions.



It would be more elegant to treat `ledger.so` as a simple dynamic library, because on Fedora `cmake` is configured in such a way that it sets the correct permissions by itself, but unfortunately the naive patch:



    diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt

    index 65e58edb..53604669 100644

    --- a/src/CMakeLists.txt

    +++ b/src/CMakeLists.txt

    @@ -307,13 +307,7 @@ print(s.get_python_lib(True, prefix=''))"

         # maybe using install(CODE "...") and

         # execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ...).

         # Windows will need a special case due to not supporting symlinks.

    -    add_custom_command(

    -      TARGET libledger POST_BUILD

    -      COMMAND ${CMAKE_COMMAND} -E copy_if_different

    -      $<TARGET_FILE:libledger> "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}")

    -    install(

    -      FILES "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}"

    -      DESTINATION ${PYTHON_SITE_PACKAGES})

    +    install(TARGETS libledger DESTINATION ${PYTHON_SITE_PACKAGES} RENAME "${_ledger_python_module_name}")

       else()

         message(WARNING "PYTHON_SITE_PACKAGES not set. Will not install python module.")

       endif()



works as far as permissions are concerned, but the `RENAME` signature (?) does not seem to work for `TARGETS`, i. e. the library gets installed as `/usr/lib64/python2.7/site-packages/libledger.so.3`.



Today was the first time I looked at `CMakeLists.txt` files, so maybe someone with more `cmake` knowledge has a better idea :-) (for example, maybe `cmake` exposes the permissions it applies to shared libraries via a variable or something).
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]