Skip to content

Fix absolute symlinks in PHP artifact bundled libs#99

Open
ivanovac wants to merge 1 commit intomainfrom
fix-absolute-symlinks-in-php-artifact
Open

Fix absolute symlinks in PHP artifact bundled libs#99
ivanovac wants to merge 1 commit intomainfrom
fix-absolute-symlinks-in-php-artifact

Conversation

@ivanovac
Copy link
Copy Markdown
Contributor

@ivanovac ivanovac commented Apr 9, 2026

cp -a preserves symlinks verbatim. On some cflinuxfs4 build hosts, /usr/lib/x86_64-linux-gnu/libgpg-error.so is an absolute symlink pointing to /lib/x86_64-linux-gnu/libgpg-error.so.0. libbuildpack rejects absolute symlinks during extraction as a security measure, causing PHP staging to fail with:

ERROR Could not install PHP: cannot link to an absolute path when extracting archives

Fix: after all cp -a lib copies in setupTar(), scan lib/ for absolute symlinks and rewrite them to relative (basename only). This is safe because all the referenced targets are copied into the same lib/ dir.

This is closely connected with PR cloudfoundry/php-buildpack#1250

cp -a preserves symlinks verbatim. On some cflinuxfs4 build hosts,
/usr/lib/x86_64-linux-gnu/libgpg-error.so is an absolute symlink
pointing to /lib/x86_64-linux-gnu/libgpg-error.so.0. libbuildpack
rejects absolute symlinks during extraction as a security measure,
causing PHP staging to fail with:

  **ERROR** Could not install PHP: cannot link to an absolute path when extracting archives

Fix: after all cp -a lib copies in setupTar(), scan lib/ for absolute
symlinks and rewrite them to relative (basename only). This is safe
because all the referenced targets are copied into the same lib/ dir.
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

Successfully merging this pull request may close these issues.

1 participant