| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
expose: fix ebin wrapper symlink resolution for multi-distro support ## Problem The ebin wrappers were generated using store paths directly, which broke for distros that use symlinks differently: - Alpine: /usr/bin/npm -> ../share/nodejs/npm/bin/npm-cli.js - OpenEuler: /usr/bin/npm -> ../share/nodejs/npm/bin/npm (shell script) - Debian: /usr/bin/nodejs -> node, /usr/bin/npm -> ../share/nodejs/npm/bin/npm-cli.js The wrappers pointed to wrong paths because symlink resolution was done in the store context, not the env context. ## Solution 1. Added resolve_ebin_target_path() function that: - Starts from the env path (e.g., $env_root/usr/bin/npm) - Follows symlinks within the env context - Stops when hitting a real file or symlink staying inside env - Returns the resolved path for use in the wrapper 2. Updated get_exec_command() to: - Accept already-resolved env paths (no store-to-env conversion needed) - Handle npm/npx shell scripts specially (call -cli.js directly) 3. Added comprehensive block comments explaining the ebin wrapper design ## Testing Added unit tests in src/expose.rs with real-world symlink layouts from: - Alpine (npm, npx -> npm-cli.js, npx-cli.js) - OpenEuler (npm -> npm shell script) - Debian (nodejs -> node, npm -> npm-cli.js) Test command: cargo test resolve_ebin_target_path ## Verified - ./tests/dev-projects/run.sh -o alpine -t node - PASSED - ./tests/dev-projects/run.sh -o openeuler -t node - PASSED - cargo test resolve_ebin_target_path - 6 tests PASSED | 4 个月前 | |
expose: fix ebin wrapper symlink resolution for multi-distro support ## Problem The ebin wrappers were generated using store paths directly, which broke for distros that use symlinks differently: - Alpine: /usr/bin/npm -> ../share/nodejs/npm/bin/npm-cli.js - OpenEuler: /usr/bin/npm -> ../share/nodejs/npm/bin/npm (shell script) - Debian: /usr/bin/nodejs -> node, /usr/bin/npm -> ../share/nodejs/npm/bin/npm-cli.js The wrappers pointed to wrong paths because symlink resolution was done in the store context, not the env context. ## Solution 1. Added resolve_ebin_target_path() function that: - Starts from the env path (e.g., $env_root/usr/bin/npm) - Follows symlinks within the env context - Stops when hitting a real file or symlink staying inside env - Returns the resolved path for use in the wrapper 2. Updated get_exec_command() to: - Accept already-resolved env paths (no store-to-env conversion needed) - Handle npm/npx shell scripts specially (call -cli.js directly) 3. Added comprehensive block comments explaining the ebin wrapper design ## Testing Added unit tests in src/expose.rs with real-world symlink layouts from: - Alpine (npm, npx -> npm-cli.js, npx-cli.js) - OpenEuler (npm -> npm shell script) - Debian (nodejs -> node, npm -> npm-cli.js) Test command: cargo test resolve_ebin_target_path ## Verified - ./tests/dev-projects/run.sh -o alpine -t node - PASSED - ./tests/dev-projects/run.sh -o openeuler -t node - PASSED - cargo test resolve_ebin_target_path - 6 tests PASSED | 4 个月前 | |
expose: fix ebin wrapper symlink resolution for multi-distro support ## Problem The ebin wrappers were generated using store paths directly, which broke for distros that use symlinks differently: - Alpine: /usr/bin/npm -> ../share/nodejs/npm/bin/npm-cli.js - OpenEuler: /usr/bin/npm -> ../share/nodejs/npm/bin/npm (shell script) - Debian: /usr/bin/nodejs -> node, /usr/bin/npm -> ../share/nodejs/npm/bin/npm-cli.js The wrappers pointed to wrong paths because symlink resolution was done in the store context, not the env context. ## Solution 1. Added resolve_ebin_target_path() function that: - Starts from the env path (e.g., $env_root/usr/bin/npm) - Follows symlinks within the env context - Stops when hitting a real file or symlink staying inside env - Returns the resolved path for use in the wrapper 2. Updated get_exec_command() to: - Accept already-resolved env paths (no store-to-env conversion needed) - Handle npm/npx shell scripts specially (call -cli.js directly) 3. Added comprehensive block comments explaining the ebin wrapper design ## Testing Added unit tests in src/expose.rs with real-world symlink layouts from: - Alpine (npm, npx -> npm-cli.js, npx-cli.js) - OpenEuler (npm -> npm shell script) - Debian (nodejs -> node, npm -> npm-cli.js) Test command: cargo test resolve_ebin_target_path ## Verified - ./tests/dev-projects/run.sh -o alpine -t node - PASSED - ./tests/dev-projects/run.sh -o openeuler -t node - PASSED - cargo test resolve_ebin_target_path - 6 tests PASSED | 4 个月前 |