Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tar syntax to support OpenBSD. #2693

Merged
merged 2 commits into from
Dec 20, 2021
Merged

Update tar syntax to support OpenBSD. #2693

merged 2 commits into from
Dec 20, 2021

Conversation

opsbob
Copy link
Contributor

@opsbob opsbob commented Dec 19, 2021

This PR special-cases the archive extraction code when executed on OpenBSD. This is to workaround the use of the -J and --strip-components options, which OpenBSD's tar does not support. If the xz format archive was downloaded, it correctly calls xzcat and pipes the output to tar. If not, it correctly calls the tar with the normal compression flag. In either case, it does not append the --strip-components=1 option, but rather uses the -s option to perform ed(1)-style basic regex replacement on the path.

This is tested to execute correctly on OpenBSD 7.0 (current release as of this PR). It does not address compilation issues of the downloaded node source code, as mentioned in #2134, which will likely require upstreaming of some subset of the OpenBSD-specific source patches that were developed for the OpenBSD ports build of node (see the OpenBSD patches for node-12.22.7 here or the implementation of binary builds for OpenBSD, but it does allow you to reach that step without error. This should, however, fully address #2660.

Fixes #2660.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

nvm.sh Outdated Show resolved Hide resolved
nvm.sh Outdated Show resolved Hide resolved
@ljharb ljharb added the installing node Issues with installing node/io.js versions. label Dec 19, 2021
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! You'll also need to add nvm_extract_tarball to the nvm unload list. It'd also be ideal to add a unit test for this function - even if all it does is check that it requires 4 arguments (altho a step up from that would be overriding the PATH to point to a faked tar/gtar/xzcat and actually test that the right thing is invoked in each scenario)

nvm.sh Show resolved Hide resolved
@ljharb ljharb merged commit 79ad72d into nvm-sh:master Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installing node Issues with installing node/io.js versions. OS: FreeBSD / OpenBSD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenBSD: install fails, tar: unknown option -- J
2 participants