GNU bug report logs - #21942
Files with incorrect file sizes

Previous Next

Package: diffutils;

Reported by: Stephan Müller <fruktopus <at> gmail.com>

Date: Tue, 17 Nov 2015 17:44:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jim Meyering <jim <at> meyering.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#21942: closed (Files with incorrect file sizes)
Date: Sun, 06 Dec 2015 19:41:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 6 Dec 2015 11:39:44 -0800
with message-id <CA+8g5KFQ5U9LTQT6ynkPU92c3VX964sKK0==+uBqsKNNsFJLPg <at> mail.gmail.com>
and subject line Re: [bug-diffutils] bug#21942: Files with incorrect file sizes
has caused the debbugs.gnu.org bug report #21942,
regarding Files with incorrect file sizes
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
21942: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21942
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stephan Müller <fruktopus <at> gmail.com>
To: bug-diffutils <at> gnu.org
Subject: Files with incorrect file sizes
Date: Tue, 17 Nov 2015 12:44:08 +0100
Hi there,

recently I had to debug weird problem. Finally I figured it out.

Virtual file systems like /sys or /proc usually don't care about file
sizes. All files have a size of 0. This leads to difficulties as diff
sometimes looks for file sizes.

Say you do:

> $ cp /proc/cmdline my_cmdline
> $ diff /proc/cmdline my_cmdline ; echo $?
> 0      // ok, files don't differ
> $ diff --brief /proc/cmdline my_cmdline
> Files /proc/cmdline and mycmdline differ  

The --brief option triggers a binary compare, as we aren't interested
in the actual differences this makes sense. As a first step, file sizes
are compared (0 vs ~150) and the files are reported as different.

I am not sure how to fix this. I.e. are the files different or not? What
is the correct behavior. In any case --brief should have no influence on
the overall result! I see the following options (I prefer the 2nd):

1: Don't use file sizes in comparing. This is rather expensive but
would certainly fix it.

2: add a --use-file-sizes flag which enables decisions
based on file sizes. Without this flag, always look into the files.
And --brief should report, if the files differ because of their data or
size. That is 

> $ diff /proc/cmdline my_cmdline ; echo $?
> 0      // ok, files don't differ  

> $ diff --brief /proc/cmdline my_cmdline ; echo $0
> 0  

> $ diff --brief --use-file-sizes /proc/cmdline my_cmdline
> Files /proc/cmdline and mycmdline differ in file size  

3: Leave it at it is and add a warning in the man page. However that
would be very inconvenient.


   best, stephan


[Message part 3 (message/rfc822, inline)]
From: Jim Meyering <jim <at> meyering.net>
To: Stephan Müller <fruktopus <at> gmail.com>
Cc: 21942-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#21942: Files with incorrect file sizes
Date: Sun, 6 Dec 2015 11:39:44 -0800
On Sun, Dec 6, 2015 at 11:27 AM, Jim Meyering <jim <at> meyering.net> wrote:
...
> Thank you, but I don't want to have to specify some new option to
> avoid this misbehavior, so will push the attached patch shortly.
> If someone finds a system for which a falsely reported stat.st_size
> is nonzero, we can revisit this.

Pushed with commit log changes and one fewer blank line in NEWS.


This bug report was last modified 9 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.