JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-4523

[windows] File.dirname handles some edge cases differently compared to MRI

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: JRuby 1.4
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Fails to RubySpec tests on Windows:

      mspec -t j core\file\dirname_spec.rb
      jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-26 8d3d80c) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]
      .....F..F.
      
      1)
      File.dirname returns all the components of filename except the last one (edge cases on windows) FAILED
      Expected "/"
       to equal "//foo"
      
      D:/work/jruby-dev/rubyspec.git/core/file/dirname_spec.rb:57
      D:/work/jruby-dev/rubyspec.git/core/file/dirname_spec.rb:3
      D:/work/jruby-dev/rubyspec.git/core/file/dirname_spec.rb:55:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-run:8
      
      2)
      File.dirname returns the return all the components of filename except the last one (windows unc) FAILED
      Expected "\\"
       to equal "\\\\foo"
      
      D:/work/jruby-dev/rubyspec.git/core/file/dirname_spec.rb:89
      D:/work/jruby-dev/rubyspec.git/core/file/dirname_spec.rb:3
      D:/work/jruby-dev/rubyspec.git/core/file/dirname_spec.rb:55:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-run:8
      
      Finished in 0.090000 seconds
      
      1 file, 10 examples, 45 expectations, 2 failures, 0 errors
      

      It boils down to the following examples:

      jruby -e "p File.dirname('\\\\foo\\bar.txt')"
      "\\\\foo"
      ruby -e "p File.dirname('\\\\foo\\bar.txt')"
      "\\\\foo\\bar.txt"
      

        Issue Links

          Activity

          Hide
          Luca Simone added a comment -

          This is a 2724 duplicate, pull request for a fix here:

          https://github.com/jruby/jruby/pull/178

          Show
          Luca Simone added a comment - This is a 2724 duplicate, pull request for a fix here: https://github.com/jruby/jruby/pull/178

            People

            • Assignee:
              Unassigned
              Reporter:
              Vladimir Sizikov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: