Subject: Binary files and --label option

From: Jean Delvare <[email-masked]>
Date: Fri, 9 Sep 2016 11:30:32 +0200

Hi all,

I am maintaining quilt [1]. Up to diffutils version 3.3, diff would
return an error for binary files. This made it easy for us to detect
binary files and exclude them from the patches generated by quilt.

However since version 3.4 of diffutils, binary files no longer trigger
an error. This causes quilt to add the output of the command to the
generated patch. In my example, it looks like this:

Binary files w.orig/test.bin    2016-09-09 10:19:10.621752409 +0200 and w/test.bin      2016-09-09 10:19:24.349917252 +0200 differ

The reason for this strange output is that we use the --label option to
fine-tune the generated patches. It works fine for text files, but as
you can see, for binary files the result isn't as expected. Timestamps
are not supposed to be printed in the output in this case. Without the
--label options I get:

Binary files .pc/test.diff/test.bin and test.bin differ

which no longer has the timestamps, but doesn't have the names I want
(it exposes quilt internals which the user should not have to care
about.) So I am stuck.

Do you have any idea how this problem could be solved? In quilt I will
most likely add a test to check if the output starts with "Binary
files" and exclude the file again. But I think the problem is more
general than this. It seems we would need separate --label options for
the text and binary cases, as you may want to include the timestamp (or
any other extra information) for regular diff output, while you only
want the file names in the binary case. Maybe we need a new option
--file-name for the latter?

[1] https://savannah.nongnu.org/projects/quilt

Thanks,
-- 
Jean Delvare
SUSE L3 Support