New submission from Yoni Tsafir <yonix85+pyt...@gmail.com>: 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: r...@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. ---------- components: None messages: 124514 nosy: Yoni.Tsafir priority: normal severity: normal status: open title: tarfile doesn't handle sysfs well type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10760> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com