Added --no-same-owner flag when extracting the NodeJs archive #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added --no-same-owner flag when extracting the NodeJs archive, so that it can behaves as expected when composer runs as root.
Rationale
When
tar
extracts an archive as root, it attempts to set the owner UID/GID of the extracted files to the UID/GID, which is for the NodeJS archives is 500.For the NodeJS iInstaller, this behaviour is not desirable, as it results in the extracted files being owned by a different user than the user that runs composer commands. It can even result in the failure to extract.
Although normally composer shouldn't be run as root, this is not necessarily true for applications that run in containers, such as Docker containers.
Solution
Add the
--no-same-owner
flag to thetar
command, so that it will behave identical regardless of whether composer runs as root or as a normal user.For reference, see https://linux.die.net/man/1/tar