#475879 tar --compare gives error warnings when file does not exist

Package:
tar
Source:
tar
Description:
GNU version of the tar archiving utility
Submitter:
Paul Gevers
Date:
2024-07-19 05:39:03 UTC
Severity:
normal
#475879#5
Date:
2008-04-13 15:35:19 UTC
From:
To:
I like to report what I believe is a bug in the current stable version
of tar.

I want to compare an old archive with the current file system. According
to the documentation the --diff or --compare option should give for any
none existing file:
"""
file: does not exist
"""
Instead I get

user@server / $ tar --diff --file archive.tar
tar: directory/xxx.jpg: Warning: Cannot stat: No such file or directory

which is an error message, because if I pipe ordinary output to
/dev/null I still get it:
user@server / $ tar --diff --file archive.tar > /dev/null
tar: directory/xxx.jpg: Warning: Cannot stat: No such file or directory

I run Debian stable with a self made kernel:
user@server / $ uname -a
Linux server 2.6.18-6 #1 Sun Jan 20 22:38:09 CET 2008 i686 GNU/Linux

and libc6:
user@server / $ dpkg -s libc6 | grep ^Version
Version: 2.3.6.ds1-13etch5

With kind regards,
Paul Gevers

#475879#10
Date:
2008-04-16 16:33:49 UTC
From:
To:
Running on an other computer (Ubuntu 7.10) I have the same problem, so
it looks like upstream may be interested?

The problem:
paul@etna ~/temp $ tar --diff --file test.tar
tar: hoekro.gif: Warning: Cannot stat: No such file or directory

For my Ubuntu system:
paul@etna ~/ $ dpkg -s tar | grep ^Version
Version: 1.18-2ubuntu1

paul@etna ~/ $ dpkg -s libc6 | grep ^Version
Version: 2.6.1-1ubuntu10

paul@etna ~/ $ uname -a
Linux etna 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686
GNU/Linux

With kind regards,
Paul

#475879#13
Date:
2008-04-17 19:14:32 UTC
From:
To:
One of the users of my Debian packaging of tar reports that --compare
returns an error message on stderr instead of the expected error
notification on stdout when a specified file does not exist.

I have confirmed that the same behavior exists with tar 1.20.

The info documentation isn't entirely clear on whether the expected
behavior is a notification on stdout or an error on stderr, but the
example shown certainly looks more like what the bug reporter is
expecting than what he and I are seeing.

What's the intended behavior here?

Bdale

#475879#18
Date:
2024-07-19 05:35:06 UTC
From:
To:
Hi,

For weird reasons I looked at this bug again. The behavior of tar is
still the same: a message on stderr and no message on stdout. The
documentation [1] now says "If a file is represented in the archive but
does not exist in the file system, tar reports a difference.". It seems
the example was removed, but reading this I would *still* expect a
message on stdout and not on stderr, like the behavior for a changed file.

Paul

[1] https://www.gnu.org/software/tar/manual/tar.html#compare