#63907 tar: unable to backup 0-byte non-readable files

Package:
tar
Source:
tar
Description:
GNU version of the tar archiving utility
Submitter:
Tuomas Heino
Date:
2005-07-18 03:12:10 UTC
Severity:
wishlist
#63907#5
Date:
2000-05-10 19:19:48 UTC
From:
To:
tar seems to actually try to read 0-byte regular files...
This is rather annoying when you're using 0-byte write-only files as lockfiles
and want to create a backup of the directory - changing to root to be able
to read those 0-bytes sounds idiotic to me - so maybe tar should be fixed ;)

$ touch dummy
$ chmod -r dummy
$ tar cvf dummy.tar dummy
tar: dummy: Cannot open: Permission denied
tar: Error exit delayed from previous errors
$ stat dummy
  File: "dummy"
  Size: 0          Blocks: 0         Regular File
Access: (0220/--w--w----)         Uid: ( 1001/  iheino)  Gid: ( 1001/  iheino)
Device: 344        Inode: 114553     Links: 1
...

#63907#10
Date:
2000-05-10 20:25:29 UTC
From:
To:
In article <E12pc1M-0001oX-00@bx3.bx.fi> you wrote:

I don't understand your complaint?  You have made the file unreadable, so of
course tar can't read it unless you elevate priveledge.

Unless I'm missing something, this is exactly how it is supposed to work, not
a bug!

Bdale

#63907#15
Date:
2000-05-13 07:49:30 UTC
From:
To:
As stat() gives the file a size of 0 bytes there is nothing to read so tar
shouldn't even attempt to read it.

#63907#20
Date:
2000-05-13 08:00:41 UTC
From:
To:
As stat() gives the file a size of 0 bytes there is nothing to read so tar
shouldn't even attempt to read it.

A little example with a non-regular file:

$ mknod dummy p
$ chmod 0 dummy
$ tar cvf dummy.tar dummy
dummy

So what I'm saying is that the 0-byte files should be special-cased just
like the other "non-regular" files.