Details

    • Number of attachments :
      2

      Description

      FileTest.identical? is currently implemented in such a way that it only compares stat info of two files, so different files with same stats would be considered equal, which is obviously wrong. This happens more often on Windows, since stat info (dates) are with granularity 1 sec or so. So the two files created quickly one after another would be considered the same!

      This leads to rubyspec failures:

      D:\work\jruby-dev\rubyspec.git>mspec -t j core\filetest\identical_spec.rb
      jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-10 c3a86fb) (Java HotSpot(TM) Client VM 1.6.0_17) [x86-java]
      ...F
      
      1)
      FileTest.identical? returns true if both named files are identical FAILED
      Expected true to be false
      D:/work/jruby-dev/rubyspec.git/shared/file/identical.rb:41
      D:/work/jruby-dev/rubyspec.git/core/filetest/identical_spec.rb:4
      D:/work/jruby-dev/rubyspec.git/core/filetest/identical_spec.rb:55:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-run:8
      

      MRI compares not only the sizes and stat info, but the file names as well (after proper expanding).

      1. 4445.patch
        1 kB
        Nick Sieger
      2. JIRA-4445.patch
        0.7 kB
        Miquel Oliete

        Activity

        Hide
        Miquel Oliete added a comment -

        This is the patch file for this issue. If you think it's not correct, send me a message in order to code a new fix.

        Show
        Miquel Oliete added a comment - This is the patch file for this issue. If you think it's not correct, send me a message in order to code a new fix.
        Hide
        Nick Sieger added a comment -

        Did you test this on Windows? Something must not be right with this spec on Windows because even with your changes (and some I tried including comparing canonical paths) the spec still fails.

        Show
        Nick Sieger added a comment - Did you test this on Windows? Something must not be right with this spec on Windows because even with your changes (and some I tried including comparing canonical paths) the spec still fails.
        Hide
        Nick Sieger added a comment -

        Here's the version I tried.

        Show
        Nick Sieger added a comment - Here's the version I tried.
        Hide
        Luca Simone added a comment -

        Nick, with your patch the test pass on Windows. There's still a problem with link obviously, can I submit a pull request or you do it?

        C:\Develop\rubyspec>mspec -t j core\filetest\identical_spec.rb
        jruby 1.6.0.RC3 (ruby 1.8.7 patchlevel 330) (2011-03-08 c3a0969) (Java HotSpot(T
        M) Client VM 1.6.0_16) [Windows XP-x86-java]
        F...

        1)
        FileTest.identical? returns true for a file and its link FAILED
        Expected false
        to equal true

        Show
        Luca Simone added a comment - Nick, with your patch the test pass on Windows. There's still a problem with link obviously, can I submit a pull request or you do it? C:\Develop\rubyspec>mspec -t j core\filetest\identical_spec.rb jruby 1.6.0.RC3 (ruby 1.8.7 patchlevel 330) (2011-03-08 c3a0969) (Java HotSpot(T M) Client VM 1.6.0_16) [Windows XP-x86-java] F... 1) FileTest.identical? returns true for a file and its link FAILED Expected false to equal true
        Hide
        Hiro Asari added a comment -

        Nick,

        Do you have further comments on https://github.com/jruby/jruby/pull/28 ?

        Show
        Hiro Asari added a comment - Nick, Do you have further comments on https://github.com/jruby/jruby/pull/28 ?
        Hide
        Thomas E Enebo added a comment -

        Fixed on master ( d2cad2c, 678368e ) and on 1.6 branch ( 93b3d1f, ea2466e ). Thanks for the fix and sorry it took so long.

        Show
        Thomas E Enebo added a comment - Fixed on master ( d2cad2c, 678368e ) and on 1.6 branch ( 93b3d1f, ea2466e ). Thanks for the fix and sorry it took so long.
        Hide
        Thomas E Enebo added a comment -

        Backing out this fix since it causes a problem with some rubyspecs. I was a little too quick on the draw with this one.

        Show
        Thomas E Enebo added a comment - Backing out this fix since it causes a problem with some rubyspecs. I was a little too quick on the draw with this one.
        Hide
        bob mcwhirter added a comment -

        Relates to JRUBY-5726 I think, also.

        Show
        bob mcwhirter added a comment - Relates to JRUBY-5726 I think, also.
        Hide
        bob mcwhirter added a comment -

        Also, Toby has a pull-request related to JRUBY-5762 here, which might fix JRUBY-4445 (this one).

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

        Show
        bob mcwhirter added a comment - Also, Toby has a pull-request related to JRUBY-5762 here, which might fix JRUBY-4445 (this one). https://github.com/jruby/jruby/pull/71

          People

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

            Dates

            • Created:
              Updated: