Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Jan 2026 13:29:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 292198] /usr/bin/diff silently ignores hardware errors
Message-ID:  <bug-292198-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292198

            Bug ID: 292198
           Summary: /usr/bin/diff silently ignores hardware errors
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: ml@netfence.it

Created attachment 266843
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=266843&action=edit
Git patch (works against current and 14.3)

I just burned a couple of Blu Ray data disks.
Since I don't trust optical media that much, I thought I should check.
So...

> mount /mnt/bluray
> diff -rq /mnt/bluray originaldata/

No output, so everything good, isn't it?
Hadn't I by chance seen some ahci MEDIUM ERROR (uncorrectable error) in the
logs I would have stored these disks away and could only hope I wouldn't ever
need them!

Let's check again...

> diff -rqs /mnt/bluray originaldata/

No output???

> mkdir newdata/
> cp -R /mnt/bluray/* newdata/
> cp: /mnt/bluray/file1: Input/output error
> cp: /mnt/bluray/file2: Input/output error
> cp: /mnt/bluray/file4: Input/output error
> ...

So I had to conclude that diff silently ignores files when an underlying
hardware error happens and cannot be trusted!!!

For comparison:
> gdiff -rq /mnt/bluray originaldata/
gdiff: /mnt/bluray/file1: Input/output error

Now I wonder how many of my optical disk were not readable when I put them
away.
IMO this is so bad it should deserve an EN.

The patch I'm attaching is not perfect (at this point in the code, we don't
know which of the two files failed), but at least gives an hint something is
wrong. Perhaps someone can come up with a better solution, but if that takes
times, I think this is better than a silent failure.

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

home | help

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