uru auto on windows network share gets 'index out of range' error

Issue #82 new
Benjamin Flanders created an issue

When I do uru auto in a directory that has space I get an index out of range error. Here is the whole command line with error:

PS Microsoft.PowerShell.Core\FileSystem::\\FOXDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster> uru auto
panic: runtime error: index out of range

goroutine 1 [running]:
bitbucket.org/jonforums/uru/command.useRubyVersionFile(0x12542600, 0x5868f0, 0x0, 0x0, 0x0)
        C:/Users/Jon/Documents/GoDev/mygo/src/bitbucket.org/jonforums/uru/command/use_rubyversion.go:68 +0x592
bitbucket.org/jonforums/uru/command.Use(0x12542600)
        C:/Users/Jon/Documents/GoDev/mygo/src/bitbucket.org/jonforums/uru/command/use.go:22 +0xc4
bitbucket.org/jonforums/uru/command.(*CommandRouter).Dispatch(0x1258bf6c, 0x12542600, 0x12548160, 0x4)
        C:/Users/Jon/Documents/GoDev/mygo/src/bitbucket.org/jonforums/uru/command/router.go:50 +0x83
main.main()
        C:/Users/Jon/Documents/GoDev/mygo/src/bitbucket.org/jonforums/uru/uru.go:40 +0x4b5

Comments (13)

  1. Benjamin Flanders reporter

    Opps Relevant system info: Windows 7 64bit running in powershell what else would help?

  2. Benjamin Flanders reporter

    OK. it might not be spaces. I cd up one directory and I can uru auto without issue.

  3. Benjamin Flanders reporter

    The .ruby_version file in :\FOXDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects contains 222.

    When in this directory uru auto works as it should. In :\FOXDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster\ it panics, as it does in any directory under ruby2projects.

    I tried putting a .ruby_version file in route blaster and it still panics.

  4. Jon repo owner

    Strange.

    Show the results of running the following sequence in powershell and put the results in a code block formatted section so your results are readable. You can code block format via the 3rd icon from right in editing box, or surround your results with ~~~ console and ~~~ markdown syntax and click the Preview button before submitting.

    1. $env:PATH
    2. uru ver
    3. uru ls --verbose
    4. pwd
    5. uru auto

    Also, show what's in your %USERPROFILE%\.uru\rubies.json file.

    If none of this helps us, I may ask you to download the 0.8.0.rc3 and have you run it in debug mode. Let's see what we find first with the version of uru you currently have installed.

  5. Jon repo owner

    I cannot repro your issue with the following test sequence. Although I'm likely using a different uru version than you are, there's been no change to the .ruby-version code. Something else is going on.

    What uru and rubies do I have installed on my win8.1 x64 system?

    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru ver
    uru v0.8.0.rc3 [windows/386 devel +3ae1704 Fri Aug 7 17:55:26 2015 +0000]
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru ls --verbose
        217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
                      ID: 2.1.7-p379
                      Home: C:\Apps\rubies\ruby-2.1\bin
                      GemHome:
    
     => 223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
                      ID: 2.2.3-p150
                      Home: C:\Apps\rubies\ruby-2.2\bin
                      GemHome:
    
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
                      ID: 9.0.0
                      Home: C:\Apps\rubies\jruby\bin
                      GemHome:
    

    What is my test dir structure?

    C:\Users\Jon\Documents\RubyDev\spacey dir> ls -r
    
        Directory: C:\Users\Jon\Documents\RubyDev\spacey dir
    
    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    d----          8/8/2015   2:40 PM            Ruby2Projects
    
    
        Directory: C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects
    
    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    d----          8/8/2015   2:40 PM            route_blaster
    -a---          8/8/2015   2:37 PM          6 .ruby-version
    
    
        Directory: C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects\route_blaster
    
    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    -a---          8/8/2015   2:43 PM          5 .ruby-version
    

    What do the two .ruby-version files contain?

    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> cat .\.ruby-version
    223
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> cat .\route_blaster\.ruby-version
    217
    

    Ok, let's walk down the dir structure and auto set rubies

    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru ls
        217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
        223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru auto
    ---> Now using ruby 2.2.3-p150 tagged as `223p150-x32`
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru ls
        217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
     => 223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> cd .\route_blaster
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects\route_blaster> uru auto
    ---> Now using ruby 2.1.7-p379 tagged as `217p379-x32`
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects\route_blaster> uru ls
     => 217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
        223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
    

    Now let's walk back up the dir structure and auto set rubies

    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects\route_blaster> uru ls
     => 217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
        223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects\route_blaster> cd ..
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru auto
    ---> Now using ruby 2.2.3-p150 tagged as `223p150-x32`
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> uru ls
        217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
     => 223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
    
    C:\Users\Jon\Documents\RubyDev\spacey dir\Ruby2Projects> cd ..
    
    C:\Users\Jon\Documents\RubyDev\spacey dir> uru auto
    ---> unable to find or process a `.ruby-version` file
    
    C:\Users\Jon\Documents\RubyDev\spacey dir> uru ls
        217p379-x32 : ruby 2.1.7p379 (2015-07-07 revision 51178) [i386-mingw32]
     => 223p150-x32 : ruby 2.2.3p150 (2015-08-04 revision 51475) [i386-mingw32]
        jruby       : jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit...
    
  6. Benjamin Flanders reporter

    Back at work again, sorry I didn't get back with you this weekend. Here you go

    Uru Verison

    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects> uru ver
    uru v0.8.0.rc3 [windows/386 devel +48b4263 Thu Jul 30 15:19:17 2015 +0000]
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects>
    

    Installed Rubies

    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects> uru ls -verbose
    
        193p286     : ruby 1.9.3p286 (2012-10-12) [i386-mingw32]
     => 222p95      : ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects>
    

    Directory Structure

    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects> ls
    
    
        Directory: \\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects
    
    
    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    d----         2/19/2015  12:54 PM            lib
    d----          8/7/2015   4:33 PM            route_blaster
    d----         7/30/2015  11:25 AM            territory
    -a---         7/30/2015  11:10 AM          4 .ruby-version
    
    
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects> cd .\route_blas
    ter
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster> l
    s
    
    
        Directory: \\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster
    
    
    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    d----          8/4/2015   4:30 PM            app
    d----          8/4/2015   4:30 PM            bin
    d----          8/4/2015   4:30 PM            config
    d----          8/4/2015   4:30 PM            lib
    d----          8/4/2015   4:30 PM            log
    d----          8/4/2015   4:52 PM            spec
    -a---          8/7/2015   2:51 PM          4 .ruby_version
    -a---          8/6/2015   3:22 PM        125 Gemfile
    -a---          8/4/2015   5:02 PM        223 Gemfile.lock
    -a---          8/4/2015   4:30 PM        211 Rakefile
    -a---          8/6/2015   1:52 PM      23404 RouteBlaster.rb
    -a---          8/4/2015   4:30 PM        157 route_blaster.rb
    -a---         8/10/2015   2:11 PM        683 test.rb
    
    
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster>
    

    .ruby-version

    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects> cat .ruby-versi
    on
    222
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects> cat .\route_bla
    ster\.ruby_version
    222
    PS Microsoft.PowerShell.Core\FileSystem::\\foxDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects>
    

    darn there it is!!!!!!! I accidently had .ruby_version instead of .ruby-version

    I changed it to .ruby-version and this fixed it.

    Sir, you are a scholar and a genious. Thank you for helping and I am sorry I bothered you with this issue. While I am at it, thank you for putting uru out here.

  7. Benjamin Flanders reporter

    So, I don't know the etiquette here, should I resolve the ticket? Should I change the title to uru crashes when it sees .ruby_version and let you resolve it?

  8. Benjamin Flanders reporter

    Son of a motherless biscuit. I just created another project under Ruby2Projects, and I am getting the same error. You know, I don't think I am helping. Im so sorry.

    so creating a .ruby-version file in this new directory fixes the issue. I remove it and I get the index out of range error.

    I found the issue. (I think)

    Notice from the pwd

    PS Microsoft.PowerShell.Core\FileSystem::\\FOXDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster> pwd                                                                            
    
    Path                                                                                                                                                                                                  
    ----                                                                                                                                                                                                  
    Microsoft.PowerShell.Core\FileSystem::\\FOXDC01\UserDocs\flanders\My Documents\dev\fox\Ruby2Projects\route_blaster 
    

    This is a network drive but not mapped to a letter.

    When I map this to a letter

    PS X:\My Documents\dev\fox\Ruby2Projects\route_blaster> pwd
    
    Path
    ----
    X:\My Documents\dev\fox\Ruby2Projects\route_blaster
    
    
    PS X:\My Documents\dev\fox\Ruby2Projects\route_blaster> uru auto
    ---> Now using ruby 2.2.2-p95 tagged as `222p95`
    PS X:\My Documents\dev\fox\Ruby2Projects\route_blaster>
    
  9. Jon repo owner

    I think you nailed it regarding using raw network paths. In fact, it's likely code like this that needs to be refined.

    While I don't like how uru panic'd on you (it should have failed more gracefully) I need to think a bit about if/how network shares should be handled. I'll likely never use uru with windows network shares, but I think it would be cool if uru could support it without too much added complexity.

    If the following doesn't summarize how you would like to use uru, let me know:

    1. All your rubies are installed on your local machine, not a network share (your uru ls --verbose omitted the details)
    2. Regardless of whether the current dir is a local dir or a network share, you want to be able to use uru. You'd prefer not to need to map the network drive to a letter, but this isn't a showstopper for you.
  10. Benjamin Flanders reporter

    You are correct. We have our home directories on our windows server, so going to "My Computer" goes to a synced network drive(done for backup purposes).

    I do have all my rubies installed locally on the c: drive. It seems I missed the double dash in front of verbose, sorry.

    I mapped a drive letter to the network location and everything is working, I don't know how the off line access will for for that location yet, but I'll try tonight. Regardless it isn't a show stopper for me.

    Thank you for your help. You've been very patient and kind while I fumbled around trying to find the real issue after assuming something completely wrong, twice.

  11. Jon repo owner

    I'd like uru to support windows network shares and will need your help on these next steps:

    1. Keep testing with your drive letter workaround. Document any further issues on this issue.
    2. I'll create an entry in the FAQ's Troubleshooting section with the issue and drive letter workaround. Please review/refine to ensure correctness
    3. I'll tweak the code to handle both \\share\path\to\somewhere and Y:\path\to\somewhere style dirs when searching for .ruby-version files. I'll ask you to test new builds. The tweak will not make it into the upcoming uru v0.8.0 release, but I think that is OK since your drive letter workaround appears to be working.
    4. I'll keep the existing .ruby-version search algorithm for both path styles: walk up to the "root" dir and do a final fallback check in %USERPROFLE%. I like this behavior even with network shares because it allows us to create a default %USERPROFILE%\.ruby-version that works regardless of whether the current dir is on a local or remote machine.

    We'll see how all this works out, but it might be as simple as fixing my original assumption of splitting on : as part of determining root dir.

  12. Log in to comment