#77998 tar: about 0-byte input file handling - again ;)

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
#77998#5
Date:
2000-11-25 22:43:14 UTC
From:
To:
Just pondering WTF tar is actually doing with "0-byte" files at the moment:

lstat("/proc/ide/hda/smart_values", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0
open("/proc/ide/hda/smart_values", O_RDONLY|0x8000) = 3

and then no read() whatsoever - why open() if you're not going to read() ?

$ mknod foo p
$ touch bar
$ chmod 0 foo bar
$ tar cf - foo bar 2>err 1>out
$ cat err
tar: bar: Cannot open: Permission denied
tar: Error exit delayed from previous errors

And... what it "should" do (imho) - at least with some parameter combination:
Try to read the contents of the "0"-byte (regular) file - but don't error
out if the permissions forbid opening/reading it.