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 ...
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
As stat() gives the file a size of 0 bytes there is nothing to read so tar shouldn't even attempt to read it.
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.