These are chat archives for creationix/nvm

19th
Jan 2015
Jordan Harband
@ljharb
Jan 19 2015 10:40
io.js support pull request into http://nvm.shcreationix/nvm#616 — please test it out; feedback welcome!
Sergey Rubanov
@chicoxyzzy
Jan 19 2015 10:40
:thumbsup:
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:20
Hi @ljharb
Jordan Harband
@ljharb
Jan 19 2015 18:21
hi, thanks
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:21
Let me know if you need more details to help resolve that issue
Jordan Harband
@ljharb
Jan 19 2015 18:21
ok so this is definitely weird
what shell and platform are you using?
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:21
Standard shell on OSX
Jordan Harband
@ljharb
Jan 19 2015 18:21
can you gist me the output of nvm_ls also, as contrasted to nvm ls?
(i'm going to give you a number of shell commands for you to run, if you don't mind, to help narrow this down)
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:22
~/.nvm (iojs)> nvm_ls
iojs-v1.0.2
system
Jordan Harband
@ljharb
Jan 19 2015 18:22
weird
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:22
I don’t mind helping
If only nvm could be written in JavaScript :/
Jordan Harband
@ljharb
Jan 19 2015 18:26
lol seriously
ok what about nvm_ls node vs nvm_ls iojs
also nvm_has_system_iojs ; echo $? and nvm_has_system_node ; echo $?
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:28
~/.nvm (iojs)> nvm_ls node

system
~/.nvm (iojs)> nvm_ls iojs
iojs-v1.0.2
~/.nvm (iojs)> nvm_has_system_iojs ; echo $?
1
~/.nvm (iojs)> nvm_has_system_node ; echo $?
0
~/.nvm (iojs)>
Jordan Harband
@ljharb
Jan 19 2015 18:29
i have system node, and you have system iojs, but i can't see how that'd be different.
ok try command find $(nvm_version_dir old) $(nvm_version_dir new) -maxdepth 1 -type d -name "*"
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:30
~/.nvm (iojs)> command find $(nvm_version_dir old) $(nvm_version_dir new) -maxdepth 1 -type d -name "*"
find: /Users/psteeleidem/.nvm/versions/node: No such file or directory
Jordan Harband
@ljharb
Jan 19 2015 18:31
oh sorry try command find $(nvm_version_dir old) -maxdepth 1 -type d -name "*"
(nvm itself already filters out the version dirs that don't exist, so that's not a big deal)
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:31
~/.nvm (iojs)> command find $(nvm_version_dir old) -maxdepth 1 -type d -name "*"
~/.nvm (iojs)>
(no output)
Jordan Harband
@ljharb
Jan 19 2015 18:32
ok nvm_version_dir old just to be sure?
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:32
~/.nvm (iojs)> nvm_version_dir old
/Users/psteeleidem/.nvm
Jordan Harband
@ljharb
Jan 19 2015 18:32
so literally the shell built in "find" is unable to locate the node version directories you have inside ~/.nvm . wtf
can you think of anything at all you may have done or installed or changed dealing with hidden files, or anything like that?
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:33
umm, no
Jordan Harband
@ljharb
Jan 19 2015 18:33
so when i do that on my mac's default bash shell, i get a huge list of the entire contents of ~/.nvm
what's ls -la ~/.nvm show?
  • not the entire contents, just the directories, rather
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:34
oh…… I know what is going on
I created a symbolic link for ~/.nvm/
Jordan Harband
@ljharb
Jan 19 2015 18:35
ah ha
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:35
does it make sense that nvm would not like ~/.nvm/ being a symbolic link?
Jordan Harband
@ljharb
Jan 19 2015 18:35
yes, symlinks make a bunch of shell commands behave differently
ok try that same find command again but add a -H
also try -L
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:36
ls -laH ~/.nvm shows everything as expected
ls -laL ~/.nvm also shows everything as expected
Jordan Harband
@ljharb
Jan 19 2015 18:38
awesome, i think i have a fix then
this would have broken for you on master too
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:38
Ok, I might be the only person to use a symbolic link, but if the fix is easy then great :)
Jordan Harband
@ljharb
Jan 19 2015 18:39
lol yeah but this just makes it more robust
thanks for walking through it
Patrick Steele-Idem
@patrick-steele-idem
Jan 19 2015 18:39
I was previously installing nvm using the curl approach. Decided to git clone into my normal development directories and sym link it to my home folder
thanks for your time and working on this!
Jordan Harband
@ljharb
Jan 19 2015 18:40
np :-)
Kris Williams
@kriswill
Jan 19 2015 20:16
@ljharb is there a reason that old node doesn’t appear under ~/.nvm/versions/node/*?
Jordan Harband
@ljharb
Jan 19 2015 20:18
kriswill: yes, legacy
Kris Williams
@kriswill
Jan 19 2015 20:19
ah, to preserve existing installs, got it.
Jordan Harband
@ljharb
Jan 19 2015 20:19
it would probably break countless things if i tried to move old ones; it'd also mean everybody would have to have someway to "repair" after updating, or they'll have to reinstall
yeah
so 0.12 and later will be in there
Kris Williams
@kriswill
Jan 19 2015 20:20
maybe have it look in versions first, and fall-back to old style?
and make all new installs go into versions?
Jordan Harband
@ljharb
Jan 19 2015 20:24
i thought about that (the new directory is something i shipped awhile ago)
but that's a lot of complexity
nobody's going to keep around old nodes very long after a couple stable >= 0.12s anyways
Kris Williams
@kriswill
Jan 19 2015 20:26
yeah it could be somewhat complex using a fall-back resolver. I’m just happy to have iojs 1.0 :)
what’s the problem with using SHA-256?
Jordan Harband
@ljharb
Jan 19 2015 20:29
not every system has the ability to compute sha-256 sums
Kris Williams
@kriswill
Jan 19 2015 20:29
anything newer than 2009 should be able to
Jordan Harband
@ljharb
Jan 19 2015 20:29
and even when i tried shasum --algorithm=256 on my mac it didn't compute the right sum
nvm supports many things older than that.
but personally i don't get why it makes a difference (1 vs 256)
someone would have to manually construct a file that sha1s to the same as a node/iojs tar, and then also have that tar follow a similar enough structure that it could be used as an exploit
that kind of defies logic imo
Kris Williams
@kriswill
Jan 19 2015 20:31
yeah they could mess with metadata to coerce the sha1
it’s not as intensive as 256
echo -n foobar | shasum -a 256
c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2  -
vs
echo -n "foobar" | openssl dgst -sha256
c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
seems like, shasum put’s a hiefen at the end.
Jordan Harband
@ljharb
Jan 19 2015 20:34
i was seeing wildly different shas, not just the hyphen
Kris Williams
@kriswill
Jan 19 2015 20:35
I’ll try it on linux
→ fig run api echo -n "foobar" | openssl dgst -sha256
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
in a docker container on boot2docker
Jordan Harband
@ljharb
Jan 19 2015 20:38
see that's the same content but it's a different sha
how does that make sense
Kris Williams
@kriswill
Jan 19 2015 20:38
it doesn’t
it’s even openssl, which should be consistent across platforms
docker@boot2docker:~$ echo -n "foobar" | openssl dgst -sha256
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
(stdin)= c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
Kris Williams
@kriswill
Jan 19 2015 20:44
so, did it inside the boot2docker vm and got the same hash, even tho there’s some warning
Kris Williams
@kriswill
Jan 19 2015 20:59
root@lizardmonkey:~# echo -n "foobar" | shasum -a 256
c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2  -
root@lizardmonkey:~# uname -a
Linux lizardmonkey 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
not sure why the fig run command is producing different results, it could be because echo with a pipe isn’t what it seems when run interactively from docker.
Jordan Harband
@ljharb
Jan 19 2015 21:01
hm, maybe
i'll have to play with it. i don't think checksums are that critical tho
just good to have in the long term
Kris Williams
@kriswill
Jan 19 2015 21:03
seems like shasum puts a - on linux also