You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "cmcfarlen (via GitHub)" <gi...@apache.org> on 2025/03/03 16:06:17 UTC

Re: [PR] Create directory before chown on install (#10954) [trafficserver]

cmcfarlen commented on PR #12036:
URL: https://github.com/apache/trafficserver/pull/12036#issuecomment-2694872875

   I think your fix is masking the real issue here.  We have `cmake/layout.cmake` that sets up up the directory layout, including the logdir directory.  That uses the CMAKE_INSTALL_PREFIX variable as a base.  However, if you don't specify this variable in the build, it defaults to `/usr/local/trafficserver`, but only *after* including the layout script.  This creates a mismatch in the full logdir and the defaulted prefix.  Would you mind trying this diff instead of yours to fix this issue?
   
   ```diff --git a/CMakeLists.txt b/CMakeLists.txt
   index e691ab2c9..6b8d3856f 100644
   --- a/CMakeLists.txt
   +++ b/CMakeLists.txt
   @@ -45,6 +45,14 @@ set(CMAKE_CXX_EXTENSIONS OFF)
    list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
    list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE -DATS_BUILD)
   
   +# Setup default install directory
   +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   +  set(CMAKE_INSTALL_PREFIX
   +      /usr/local/trafficserver
   +      CACHE PATH "Default install path" FORCE
   +  )
   +endif()
   +
    include(layout)
    include(ClangTidy)
   
   @@ -161,14 +169,6 @@ else()
    endif()
    set(TS_PKGSYSUSER ${WITH_USER})
   
   -# Setup default install directory
   -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   -  set(CMAKE_INSTALL_PREFIX
   -      /usr/local/trafficserver
   -      CACHE PATH "Default install path" FORCE
   -  )
   -endif()
   -
    if(CMAKE_SYSTEM_NAME STREQUAL Linux)
      set(DEFAULT_POSIX_CAP ON)
    endif()
   ```
   
   It just moves defaulting the install prefix before including layout.
   
   Thank!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org