-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
nvm_get_arch(): fix for arm64 kernel running armv7l userland #2469
Conversation
…rect arch Co-authored-by: Botspot <[email protected]> Co-authored-by: Jordan Harband <[email protected]> Co-authored-by: Sladyn Nunes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Can we add something to the unit tests for nvm_get_arch
to cover this?
I don't know if In this case, it's only being used to detect if |
ah, the other issue is that |
I found an alternative method that may be workable. |
I don't, but it appears to be on my local copies of ksh and dash, which is a good sign. |
Okay, then this could work:
|
# If Linux and running a 64bit ARM kernel but a 32bit ARM userland, change NVM_ARCH to 32bit ARM (armv7l)
if [[ $(uname) == "Linux" ]]; then
if [ "${NVM_ARCH}" = arm64 ] && [ "$(od -An -t x1 -j 4 -N 1 "$(readlink /sbin/init)")" = ' 01' ]; then
NVM_ARCH=armv7l
fi
fi |
If the only systems where uname is Linux and NVM_ARCH is arm64 do in fact have both |
All systems I've ever encountered will work fine. |
@Botspot I was reading a thread https://groups.google.com/g/comp.unix.shell/c/3s8cuwcVnTk where you could use an alterantive to readlink that would be |
Currently it's using the |
I guess od is posix so that should be fine 👍 |
Then it ought to be ready to merge. |
It still needs a test. |
It appears you "assigned" this to me. What do I do? |
@Botspot yay, it worked :-p for this PR to land, we'd need a test for it. In this case, modifying nvm/test/fast/Unit tests/nvm_get_arch Lines 73 to 80 in c26bd93
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @sladyn98 for the test :-)
(i'll land this once tests are fixed on master) |
I just tried to install Node on my Raspberry Pi again and noticed that this fix failed to work. Please re-open this PR. I'm using an armhf OS, but a 64-bit kernel. Who changed it to |
@Botspot thats because this PR hasn’t been released yet. |
If you can check with this fix, and it’s still not working, a PR with your suggestion would be appreciated. |
Actually somehow it did work with this fix. Strange. I wonder why this works flawlessly inside a script, but not in a terminal! |
How long will it be before there will be a new release with the past several months' changes? |
No way to know for sure; i tend to do 1-2 releases a year. |
Several people in the Raspberry Pi community have had issues with
nvm
. We realized that everyone affected had one thing in common: they were using armhf (armv7l) Raspberry Pi OS, but had enabled the arm64 kernel.nvm
mistakenly detected the OS to be 64-bit arm, while in reality it was armhf. This pull request solves the problem.