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

nvm.sh - executing under ksh fails as local is missing. Remediation by using typeset instead #3115

Open
chris-day opened this issue May 20, 2023 · 3 comments

Comments

@chris-day
Copy link

Operating system and version:

RHEL9, Ubuntu using ksh as the login shell

Remediation is to change the use of "local" for setting variables and replace with "typeset"

How did you install nvm?

As per the README

What steps did you perform?

What happened?

. $NVM_DIR/nvm.sh -ksh: .: line 4373: local: not found -ksh: .: line 4343: local: not found -ksh: .: line 4345: local: not found -ksh: .: line 4346: local: not found -ksh: .[1127]: local: not found -ksh: .[506]: local: not found -ksh: .[396]: local: not found -ksh: .[398]: local: not found -ksh: .[406]: local: not found -ksh: .[408]: local: not found -ksh: .[396]: local: not found -ksh: .[398]: local: not found -ksh: .[406]: local: not found -ksh: .[408]: local: not found -ksh: .[1133]: local: not found -ksh: .: line 2778: local: not found -ksh: .: line 2809: local: not found -ksh: .: line 2932: local: not found -ksh: .: line 2937: local: not found -ksh: .: line 2938: local: not found -ksh: .: line 3540: local: not found -ksh: .: line 3541: local: not found -ksh: .: line 3542: local: not found -ksh: .: line 3543: local: not found -ksh: .: line 3545: local: not found -ksh: .: line 3546: local: not found -ksh: .[2508]: local: not found -ksh: .[2510]: local: not found -ksh: .[576]: local: not found -ksh: .[578]: local: not found -ksh: .[589]: local: not found -ksh: .[1250]: local: not found -ksh: .[1252]: local: not found -ksh: .[1259]: local: not found -ksh: .[1261]: local: not found -ksh: .[1263]: local: not found -ksh: .[506]: local: not found -ksh: .[1265]: local: not found -ksh: .[506]: local: not found -ksh: .[1267]: local: not found -ksh: .[506]: local: not found -ksh: .[1209]: local: not found -ksh: .[1210]: local: not found -ksh: .[1150]: local: not found -ksh: .[1153]: local: not found -ksh: .[1155]: local: not found -ksh: .[1157]: local: not found -ksh: .[754]: local: not found -ksh: .[1240]: local: not found -ksh: .[1285]: local: not found -ksh: .[776]: local: not found -ksh: .[784]: local: not found -ksh: .[786]: local: not found -ksh: .[153]: local: not found -ksh: .[1873]: local: not found -ksh: .[1875]: local: not found -ksh: .: line 540: local: not found -ksh: .: line 542: local: not found -ksh: .: line 551: local: not found -ksh: .: line 552: local: not found -ksh: .[576]: local: not found -ksh: .[578]: local: not found -ksh: .[589]: local: not found -ksh: .[1250]: local: not found -ksh: .[1252]: local: not found -ksh: .[1259]: local: not found -ksh: .[1261]: local: not found -ksh: .[1263]: local: not found -ksh: .[506]: local: not found -ksh: .[1265]: local: not found -ksh: .[506]: local: not found -ksh: .[1267]: local: not found -ksh: .[506]: local: not found -ksh: .[1209]: local: not found -ksh: .[1210]: local: not found -ksh: .[1150]: local: not found -ksh: .[1153]: local: not found -ksh: .[1155]: local: not found -ksh: .[1157]: local: not found -ksh: .[754]: local: not found -ksh: .[1240]: local: not found -ksh: .[1285]: local: not found -ksh: .[776]: local: not found -ksh: .[784]: local: not found -ksh: .[786]: local: not found -ksh: .[153]: local: not found -ksh: .[1873]: local: not found -ksh: .[1875]: local: not found -ksh: .: line 555: local: not found -ksh: .: line 153: local: not found -ksh: .[1873]: local: not found -ksh: .[1875]: local: not found -ksh: .: line 3624: local: not found -ksh: .[525]: local: not found -ksh: .[506]: local: not found -ksh: .: line 3645: local: not found -ksh: .: line 3655: local: not found -ksh: .: line 2550: local: not found -ksh: .: line 2559: local: not found -ksh: .: line 2561: local: not found -ksh: .: line 2578: local: not found -ksh: .[1873]: local: not found -ksh: .[1875]: local: not found -ksh: .: line 2587: local: not found -ksh: .: line 2615: local: not found -ksh: .: line 2541: local: not found -ksh: .: line 2629: local: not found -ksh: .: line 2541: local: not found -ksh: .: line 2643: local: not found -ksh: .: line 2541: local: not found -ksh: .: line 2657: local: not found -ksh: .[419]: local: not found -ksh: .: line 2541: local: not found

What did you expect to happen?

dot-in of $NVM executes without error

Is there anything in any of your profile files that modifies the PATH?

@ljharb
Copy link
Member

ljharb commented May 20, 2023

I believe all these errors can be ignored and nvm will continue to work in ksh as-is.

The problem with using typeset is that it doesn’t work on all the other supported shells. If you can suggest a simple way to define a local variable that will work then I’m open to it - this is the reason ksh hasn’t been tested on nvm’s CI for a long time.

@chris-day
Copy link
Author

What about testing using "command -v local" and "command -v typeset"? Whichever returns true, you would use as an alias to define a local variable.

@ljharb
Copy link
Member

ljharb commented May 22, 2023

Whatever pattern we use would have to be repeated hundreds of times. What would that one look like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants