Author Yoni.Tsafir
Recipients Yoni.Tsafir
Date 2010-12-22.17:05:51
SpamBayes Score 3.26961e-14
Marked as misclassified No
Message-id <1293037554.87.0.808780630488.issue10760@psf.upfronthosting.co.za>
In-reply-to
Content
When I try to add a special file from sys, e.g.:
/sys/class/scsi_host/host0/cmd_per_lun (which is reported of size 4096 but actually reading it will return only several bytes of a result), I get the following exception:

Traceback (most recent call last):
  File "/opt/xpyv/lib/python26.zip/tarfile.py", line 1975, in add
    self.addfile(tarinfo, f)
  File "/opt/xpyv/lib/python26.zip/tarfile.py", line 2004, in addfile
    copyfileobj(fileobj, self.fileobj, tarinfo.size)
  File "/opt/xpyv/lib/python26.zip/tarfile.py", line 287, in copyfileobj
    raise IOError("end of file reached")
IOError: end of file reached

Notice what happens if I try to add the file with regular tar:
root@buzaglo # tar cvzf /tmp/blat.tgz /sys/class/scsi_host/host0/cmd_per_lun
tar: Removing leading `/' from member names
/sys/class/scsi_host/host0/cmd_per_lun
tar: /sys/class/scsi_host/host0/cmd_per_lun: File shrank by 4094 bytes; padding with zeros
tar: Error exit delayed from previous errors

So it handles the issue by padding the rest of the file size with zeros.

I think this should be the behavior as well, instead of throwing an IOError.
History
Date User Action Args
2010-12-22 17:05:54Yoni.Tsafirsetrecipients: + Yoni.Tsafir
2010-12-22 17:05:54Yoni.Tsafirsetmessageid: <1293037554.87.0.808780630488.issue10760@psf.upfronthosting.co.za>
2010-12-22 17:05:51Yoni.Tsafirlinkissue10760 messages
2010-12-22 17:05:51Yoni.Tsafircreate