Menu

#1769 REXX_PATH default always set

5.0.0
closed
Erich
None
none
1
2023-01-01
2021-05-24
Erich
No

From: Jean Louis Faucher
Subject: [Oorexx-devel] SysSearchPath Rev 11061 to cancel: the build path is hardcoded in the executable, and overrides the runtime PATH

On June 27, 2016:
Rev 11061 "Erico Mendonca: adds the capability to relocate the main REXX class directory to avoid placing everything under /usr/bin"

Impacted:
unix platform
SysSearchPath::SysSearchPath(const char * parentDir, const char * extensionPath)

Because of this change, if your REXX_PATH is empty, then a default value coming from the build step is used (hardcoded in the executable).
In my case, I get this search order:
rexxPath = /local/rexx/oorexx/build/official/main/trunk/macos/clang/debug/64/build/bin
followed by
sysPath = /local/rexx/oorexx/build/official/main/trunk/macos/clang/debug/64/delivery/bin

I discovered the problem under MacOs while testing the JSON implementation offered by Rony to the project back in 2016.
In the delivery/bin directory (which is in my PATH) I replaced the file json.cls by the implementation of Rony.
But when testing, it was still the current JSON implementation that was used: the one found in the build/bin directory.

The windows platform is not impacted.

Best regards
Jean Louis

Discussion

  • Erich

    Erich - 2021-05-24
    • status: open --> accepted
    • assigned_to: Erich
    • Pending work items: none --> tests
    • Group: None --> 5.0.0
     
  • Erich

    Erich - 2021-05-24

    ORX_REXXPATH should be an optionally settable default for the REXX_PATH environment variable for specific platform builds, and not an always-on default.

    Fixed CMake with revision [r12257]

    Jean Louis, please test .. thanks!

     

    Related

    Commit: [r12257]

  • jfaucher

    jfaucher - 2021-05-24

    Tested under MacOs, the fix is ok, thanks Erich!
    But the code must be made more robust, see the attached patch.

    The default value for REXX_PATH being an empty string "", an empty path is added in SysSearchPath for REXX_PATH.
    Adding an empty path is ok, we can do that in PATH (<path1>::<path2>).
    The problem is in SysSearchPath::addPath where a negative index is used when p is an empty string: (p[strlen(p) - 1] != ':')
    The windows platform is more robust, I applied the same solution: new method checkPathSeparator.</path2></path1>

    Other fix to apply to the unix platform:
    With the current implementation, SysFileSystem::searchPath will search for the file /<name> in case of empty path in path (::)
    It should ignore this empty path and continue with the next path.</name>

    I checked the windows platform, I didn't see similar issues.

     
  • Erich

    Erich - 2021-05-25
    • summary: REXX_PATH default alsways set --> REXX_PATH default always set
     
  • Erich

    Erich - 2021-05-25

    Committed code fixes with [r12258]

     

    Related

    Commit: [r12258]

  • Erich

    Erich - 2021-05-26

    Committed a missed code fix with [r12260]

     

    Related

    Commit: [r12260]

  • Erich

    Erich - 2022-06-24
    • status: accepted --> pending
    • Pending work items: tests --> none
     
  • Rony G. Flatscher

    • Status: pending --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB