Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 186027 - filterdiff filename match is unpredictable
Summary: filterdiff filename match is unpredictable
Alias: None
Product: Fedora
Classification: Fedora
Component: patchutils
Version: 8
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
Whiteboard: bzcl34nup
Depends On:
Blocks: F7Update
TreeView+ depends on / blocked
Reported: 2006-03-21 04:08 UTC by Rik van Riel
Modified: 2008-06-16 08:31 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-06-16 08:31:17 UTC

Attachments (Terms of Use)

Description Rik van Riel 2006-03-21 04:08:20 UTC
Description of problem:

When trying to build a script to filter certain parts out of a series of
patches, the behaviour of filterdiff is unpredictable.

Instead of simply picking the file name after +++ (new file name) as the key for
-x and -i, filterdiff choses the shorter of the two file names.  This makes it
impossible to use eg. the output from diffstat for constructing an exclude list.

To make things worse, this behaviour appears to be undocumented.

Version-Release number of selected component (if applicable):


Expected results:

The filenames that filterdiff works on should correspond to the ones shown in
diffstat output.  Yes, I know these are different packages, but they're used
together all the time and having one of the tools exhibit such an unpredictable
behaviour is a problem.

Comment 1 Tim Waugh 2007-10-31 13:31:11 UTC
The algorithm that filterdiff/lsdiff uses is the one described in the patch(1)
man page:

       To determine the best of a nonempty list of  file  names,  patch  first
       takes  all the names with the fewest path name components; of those, it
       then takes all the names with the shortest basename; of those, it  then
       takes  all  the  shortest  names; finally, it takes the first remaining

However, I take your point that this can make -x and -i rather difficult to use
in conjuction with other programs that use different rules.

How are you invoking diffstat to get a parseable list of filenames to
exclude/include?  Really -x and -i were designed with lsdiff/grepdiff output in

Comment 2 Bug Zapper 2008-04-03 17:09:54 UTC
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:

We will be following the process here: to ensure this
doesn't happen again.

Comment 3 Tim Waugh 2008-04-03 17:15:13 UTC
There's been no code change, so this is still an issue.

Comment 4 Tim Waugh 2008-06-16 08:31:17 UTC
Seems like '-p1' (for example) will do what you want in the majority of cases.

Note You need to log in before you can comment on or make changes to this bug.