Skip site navigation (1)Skip section navigation (2)


| raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278988

            Bug ID: 278988
           Summary: diff -B -q: unintuitive or incorrect?
           Product: Base System
           Version: 14.0-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: dhekir@gmail.com

I stumbled upon a very unintuitive behavior of diff: when option -q is used=
, -B
is ignored, unless it is also accompanied by -b, as in the following exampl=
es

# create test files: one containing a single newline, another containing 2
newlines
$ echo "" > a
$ echo -e "\n" > b

$ diff a b -B # ok: no diff reported
$ diff a b -B -q # weird: -B seems ignored, diff reported (GNU diff does not
report it)
$ diff a b -b # ok: -b only ignores spaces, not entire lines
$ diff a b -b -q # ok: the diff remains, -q does not affect it
$ diff a b -B -b -q # ok: this time, -B was taken into account

So, we have:

1. -B works on its own;
2. when -B -q is used, -B seems ignored;
3. -b on its own does not suffice to remove the diff in these files
4. -B -b -q works (no diff), but since -b is irrelevant without -q, this se=
ems
like a bug.

In GNU diff, `diff a b -B -q` behaves as what I consider "expected": the fi=
les
are considered equal.

If this is intended behavior, the documentation needs to mention it.

Bug #252515 is similar to this one (it mentioned `-w`, while this one menti=
ons
`-B`).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?>