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?