fetched from upstream
added check for "diff" since that tool is not part of the core utils therefore it may not be present on all machines