Problem when comparing .jar files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    Problem when comparing .jar files

    I have a script that does a binary and version compare and ignores timestamps. However, I have matching .jar files that come up as a mismatch. After manually comparing those .jar files using binary and timestamp, they are exactly the same. Is this a known bug? Can I get around this?

    Thanks,
    David
  • Zoë
    Team Scooter
    • Oct 2007
    • 2666

    #2
    Re: Problem when comparing .jar files

    I'm not aware of any bugs in the jar support right now.

    When you did a binary compare of the jar files, did you check the jars themselves, or the files that are contained in them? Do you have "Always treat archive files as folders" checked?

    What does your script look like, and if you do the same comparisons in an interactive session, does it have the same problem?
    Zoë P Scooter Software

    Comment

    • Guest's Avatar

      #3
      Re: Problem when comparing .jar files

      My script looks as follows:

      # Turn logging on
      log normal "bclog.txt"

      # Load the default session and exclude all but certain file types
      # load <default>

      # Overrides the defaults
      criteria version binary

      # Ignore the following files
      filter &
      -"docs\" &
      -"doc\" &
      -".\is\docs\" &

      # Load the base folders
      load &
      "C:\folder1" &
      "C:\folder2"

      expand all
      select all
      compare binary

      expand all
      select all
      compare rules-based


      folder-report layout:side-by-side &
      options:display-mismatches,column-size,column-version,column-timestamp &
      output-options:html-color &
      output-to:"mismatches.html"

      folder-report layout:side-by-side &
      options:display-mismatches,column-size,column-version,column-timestamp &
      output-to:"mismatches.txt"

      folder-report layout:summary &
      options:display-mismatches,column-size,column-version,column-timestamp &
      output-options:html-color &
      output-to:"mismatches-summary.html"

      folder-report layout:summary &
      options:display-mismatches,column-size,column-version,column-timestamp &
      output-to:"mismatches-summary.txt"


      It works when I use the application normally. How do I set it to treat archives as folders?

      Also, is there a way that the script can open the BC application after its done running so that I can poke around?

      Comment

      • Chris
        Team Scooter
        • Oct 2007
        • 5538

        #4
        Re: Problem when comparing .jar files

        In the session mangager, go to the More tab. Under the Miscellaneous section you can check "Always Treat Archives As Folders".
        Chris K Scooter Software

        Comment

        • Chris
          Team Scooter
          • Oct 2007
          • 5538

          #5
          Re: Problem when comparing .jar files

          Also, I don't think it is possible to launch an interactive session of BC from a script.
          Chris K Scooter Software

          Comment

          • Zoë
            Team Scooter
            • Oct 2007
            • 2666

            #6
            Re: Problem when comparing .jar files

            David,

            What are you trying to do with the "criteria" commands and the "expand/select/compare" commands? As it is right now, it's going to compare every file 3 times. Also, binary and rules-based comparisons override the results of timestamp, attribute, and version comparisons, so if a file's version matches but the binary comparison is different they'll show up as a mismatch.

            What are the exact steps that you use interactively that produce correct results?

            To treat jar files as folders in a script you'll need to use the "Always treat archives as folders" comparison setting. There isn't a way to set the from within the script, so you'd need to save a named session and load that instead of the named folders.

            It isn't possible to open an interactive session from a script right now. We're considering it as a future enhancement, but it won't be in the near future. What we've been suggesting so far (if you can) is parsing the text version of the "Summary List" report outside of the script, and calling BC's command line based on that.
            Zoë P Scooter Software

            Comment

            • Guest's Avatar

              #7
              Re: Problem when comparing .jar files

              Hi Craig,

              To produce the results that I want interactively, I first set the comparison control options to:
              - binary compare
              - ignore timestamp
              - compare verisons
              Then I let it finish the binary compare. Finally, I do a rules based on the remaining files.

              So it looks like I should configure a saved session and load those settings in from the script?

              Comment

              • Chris
                Team Scooter
                • Oct 2007
                • 5538

                #8
                Re: Problem when comparing .jar files

                Yes, the easiest way to to this is to load a saved session.

                You can also set the comparison criteria using the line:
                criteria version binary
                at the start of the script.
                You will still need to load the session to get the "Always treat archives as folders", so it is probably easiest to handle all of the settings in the session.
                Chris K Scooter Software

                Comment

                • Zoë
                  Team Scooter
                  • Oct 2007
                  • 2666

                  #9
                  Re: Problem when comparing .jar files

                  As of 2.1 rules-based comparisons will do a binary comparison first, so explicitly doing it like you are isn't necessary. Also in 2.1, when comparing the contents of jar and zip files it will do a CRC comparison instead, which is much faster than either. That is, a plain rules-based comparison will do exactly what you want, faster than you're currently doing it.

                  Since the "Always Treat Archive Files As Folders" option seems to confuse some users, I want to clarify that too. BC's zip/jar support is always on, and you can expand zips and set them as base folders even if that's not checked. If you haven't opened a zip it will get compared as a single file, and the "expand all" command doesn't affect it. The above setting makes them get treated as folders all the time: expand all opens them, they're built automatically, they'll sort at the top of the directory listing, and they're filtered using the folder name filters instead of the filename filters.

                  You will need to load a saved session if you want to use the "Always Treat Archives As Folders" option though, so the easiest thing to do would be to handle it all in there. Set the criteria to rules-based compare, ignore timestamps, compare versions, check the "Expand Folders on Session Load" option, and the archive option. You can set up the filters at the same time, then save it.

                  Once that's done your script should just be:

                  Code:
                  log normal "bclog.txt"
                  load SessionName
                  folder-report...
                  folder-report...
                  folder-report...
                  folder-report...
                  Zoë P Scooter Software

                  Comment

                  • Guest's Avatar

                    #10
                    Re: Problem when comparing .jar files

                    Craig,

                    I tried the minimized script that you suggested, but it doesn't seem to do what I want. I use the script to do more than just load up a session and output the results. I think your script will work if I hardcode the folders into the session. However, I use the script to load the target folders and to provide a list of files to ignore.

                    So to do what I want, can I just create a session and load the session before I do the load, expand, compare, and output?

                    Btw, I tried the compare on the jar after expanding, and it turns out its a match. That being the case, I will be selecting the "Always Treat Archive Files As Folders" option in my session.

                    Comment

                    • Chris
                      Team Scooter
                      • Oct 2007
                      • 5538

                      #11
                      Re: Problem when comparing .jar files

                      Yes, it should work to load the session first and then load different folders afterwords.
                      Chris K Scooter Software

                      Comment

                      Working...