[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Non-unified patches and dpkg source format ‘3.0 (quilt)’.



Cyril Brulebois <kibi@debian.org> writes:

> Oh, if you really need an example, what about the following? We tend to
> fix GCC issues. We tweak headers. Some might get added, some might be
> removed. We have such a patch. A CVE arrives. A context diff gets
> published. It gets applies on the top of the other patches. Say it's
> something like:
> | > BUGON(my_pointer_shall_not_be_null);
>
> But, since we tweak the headers, the check can get added before the
> first dereferencement. Of course, there are the fuzzy stuff with patch,
> but sounds less likely to happen.

If you are going to argue against diffs that do not have any
context, please say so.  Do not confuse the issue by instead
arguing against "context diffs", because context diffs and
unified diffs have exactly the same properties, just different
formatting.

Here is the diff manual's introduction to showing context:

    Usually, when you are looking at the differences between files, you will
    also want to see the parts of the files near the lines that differ, to
    help you understand exactly what has changed.  These nearby parts of the
    files are called the "context".

       GNU `diff' provides two output formats that show context around the
    differing lines: "context format" and "unified format".  It can
    optionally show in which function or section of the file the differing
    lines are found.

Here is the example of a context diff from the "diff" manual:

     *** lao	Sat Jan 26 23:30:39 1991
     --- tzu	Sat Jan 26 23:30:50 1991
     ***************
     *** 1,7 ****
     - The Way that can be told of is not the eternal Way;
     - The name that can be named is not the eternal name.
       The Nameless is the origin of Heaven and Earth;
     ! The Named is the mother of all things.
       Therefore let there always be non-being,
         so we may see their subtlety,
       And let there always be being,
     --- 1,6 ----
       The Nameless is the origin of Heaven and Earth;
     ! The named is the mother of all things.
     !
       Therefore let there always be non-being,
         so we may see their subtlety,
       And let there always be being,
     ***************
     *** 9,11 ****
     --- 8,13 ----
       The two are the same,
       But after they are produced,
         they have different names.
     + They both may be called deep and profound.
     + Deeper and more profound,
     + The door of all subtleties!

Here is the diff manual's comparison between context diffs and
unified diffs:

    The unified output format is a variation on the context format that is
    more compact because it omits redundant context lines.  To select this
    output format, use the `-U LINES', `--unified[=LINES]', or `-u' option.
    The argument LINES is the number of lines of context to show.  When it
    is not given, it defaults to three.

       At present, only GNU `diff' can produce this format and only GNU
    `patch' can automatically apply diffs in this format.  For proper
    operation, `patch' typically needs at least two lines of context.
-- 
Ben Pfaff 
http://benpfaff.org


Reply to: