Skip to content

Fix absolute symlinks in PHP artifact bundled libs#99

Merged
ramonskie merged 1 commit intomainfrom
fix-absolute-symlinks-in-php-artifact
Apr 14, 2026
Merged

Fix absolute symlinks in PHP artifact bundled libs#99
ramonskie merged 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.

Failing PRs: cloudfoundry/php-buildpack#1256 and cloudfoundry/php-buildpack#1257

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.
@ramonskie ramonskie merged commit 6e0f023 into main Apr 14, 2026
1 check passed
@ramonskie ramonskie deleted the fix-absolute-symlinks-in-php-artifact branch April 14, 2026 14:39
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.

2 participants