Adding a Ruby to the PATH causes empty path separators

Issue #40 wontfix
Luis Lavena created an issue

Hello,

This is something I noticed recently:

C:\Users\Luis>uru ls
    187p374     : ruby 1.8.7 (2013-06-27 patchlevel 374) [i386-mingw32]
    193p448     : ruby 1.9.3p448 (2013-06-27) [i386-mingw32]
    200p247     : ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
    200p247-x64 : ruby 2.0.0p247 (2013-06-27) [x64-mingw32]

C:\Users\Luis>set PATH
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\nodejs\;C:\Users\Luis\Tools\bin;C:\Users\Luis\Tools\Git\cmd;C:\Users\Luis\Tools\Svn\bin;C:\Users\Luis\Tools\GnuWin32\bin;C:\Users\Luis\AppData\Roaming\npm

C:\Users\Luis>uru 193
---> Now using ruby 1.9.3-p448 tagged as `193p448`

C:\Users\Luis>set PATH
Path=C:\Users\Luis\Tools\Ruby\ruby-1.9.3-p448-i386-mingw32\bin;;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem ...

I noticed this when testing a script that split PATH and lookup for executables in it.

This didn't break my script, but is a minor nitpick.

Thank you

Comments (3)

  1. Jon repo owner

    You've discovered the secret that makes uru work.

    Uru only prepends new values (including GEM_HOME) to the original PATH separated by these "canary" values. See last paragraph of Background section here and Known Behaviors here

    The PATH canaries enable me to have cleaner and hopefully more performant code like:

    The canaries are a cheat/simplification to enable simple string splits rather than having to do too many scans/comparisons of the full new/old PATH.

    Glad to hear the canaries didn't break your script, and I hope they continue to work. I also haven't found any breakages, and I don't want to have to come up with a clever alternative ;)

    Given the above info, do you foresee any problems?

  2. Luis Lavena reporter

    Perfect explanation, I should have read the documentation before asking!

    I don't think this is a problem. It also serves as base for *resetting the PATH` and remove the added Ruby.

    Thank you for the clarification!

  3. Log in to comment