I was running diff --brief -r /home/mateusz/ /media/mateusz/Database/backup_test_tmp_folder/home/mateusz/ command that completed with error code 2. According to documentation "Exit status is 0 if inputs are the same, 1 if different, 2 if trouble."
Unfortunately command exited without giving any clue why it failed. I tried using straces but unfortunately I am unable to diagnose anything based on produced log (last 150 lines of 3.5GB strace file are posted to https://gist.github.com/matkoniecz/15ed855bd3f161ad6354c7d637234804 - and also for diff running with sudo that failed after producing 78KB of strace log).
I considered modifying diff command to output some explanation before dying and returning 2, but given that it is unlikely that my program is unique lack of support for such debugging seems to indicate that there are better solutions (hopefully it is not "learn how to interpret strace").
So how I am supposed to check why my diff command failed? Is there any better tool than strace or adding printf debugging to diff command?
diff: /xyz: Permission deniedwhen getting the exit status of 2. – choroba Apr 03 '16 at 14:19-q, --briefmeans "report only when files differ", remove that and try it again. And looks like you're comparing a bunch of files. If you randiffonce for each individual pair of files, it should be pretty obvious which files aren't the same. – Xen2050 Apr 03 '16 at 19:59