Simple diff returning exit code 13

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bigmike_f
    Visitor
    • Jul 2010
    • 3

    Simple diff returning exit code 13

    First, great product... nice to be away from vimdiff.

    Environment:
    Ubuntu 10.04 - 32bit
    Subversion 1.6.x
    Beyond Compare 3.2 build 12469

    I noticed that the bcompare command returns and exit code of 13 when no changes are made. I think this is a problem.

    To show this:
    - run the command: bcompare <file1> <file2> -readonly
    - When beyond compare comes up, press esc or exit from menu.
    - run the command: echo $?
    ** Notice the exist code of 13.

    I would like it very much if this could be fixed. In the interim I've implemented this quick fix....

    #!/bin/sh
    bcompare "$6" "$7" -title1="$3" -title2="$5" -readonly
    if [ "$?" -eq "13" ]
    then
    exit 0
    fi

    I've read on the forums that this was fixed prior to my build, but I'm not sure if it made it to the linux port.

    Any help would be appreciated.

    Big Mike
  • Chris
    Team Scooter
    • Oct 2007
    • 5538

    #2
    Hi Big Mike,

    This is intended behavior. Beyond Compare returns error codes to indicate the comparison result. 13 indicates there are rules-based differences in the compared files.

    To see all of the error codes returned by Beyond Compare, see the "Command line reference" topic in the help file.
    Chris K Scooter Software

    Comment

    • bigmike_f
      Visitor
      • Jul 2010
      • 3

      #3
      Therefore, the supplied subversion script should be changed...

      I'll agree that your tool can use it's own sets of return codes.

      However, the current script to allow BeyondCompare to work with subversion returns incorrect return values. They are incorrect because Subversion specifies this interface.

      Quote from http://svnbook.red-bean.com/en/1.5/s...difftools.html
      - Finally, Subversion expects that your program return an error code of 1 if your program detected differences, or 0 if it did not—any other error code is considered a fatal error.

      Therefore, the supplied script on your subversion integration page is incorrect. Basically all of the return codes that signify differences should only return a value of 1. In the case of errors, any other return code other then 0 or 1 may be returned.

      I'm more then willing to supply a script to provide this solution...

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16007

        #4
        Thanks for the offer.

        For your above example, should 13 be equal to 0 or 1? A list of our codes is listed in our Help file's Command Line Reference section. 13 means there is a Rules-based (Text) Difference found.

        I would think that our exit codes 0,1,2 would translate to 0; 11,13,14 would be 1, and 12 could have some extra logic (if unimportant is ignored, it would be 0, if not it would be 1). How does that look to you?
        Aaron P Scooter Software

        Comment

        • bigmike_f
          Visitor
          • Jul 2010
          • 3

          #5
          Possible script implementation...

          I've worked a little bit with the suggestion. This is my current version of the script.


          Code:
          #!/bin/sh
          IFS=
          bcompare "$6" "$7" -title1="$3" -title2="$5" -readonly
          case $? in
             '0','1','2')
                exit 0
                ;;
             '11','13','14')
                exit 1
                ;;
             '12')
                echo "Important error???"
                exit $?
                ;;
             '*')
                exit $?
                ;;
          esac
          Last edited by bigmike_f; 31-Aug-2010, 03:15 PM.

          Comment

          Working...